]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateGuids.java
2 Java class UpdateGuids is GUI for update GUID declarations in spd file.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 package org
.tianocore
.packaging
;
15 import javax
.swing
.JPanel
;
16 import javax
.swing
.JFrame
;
17 import javax
.swing
.JLabel
;
18 import javax
.swing
.JTextField
;
19 import javax
.swing
.JButton
;
21 import javax
.swing
.JScrollPane
;
22 import javax
.swing
.JTable
;
23 import javax
.swing
.table
.*;
25 import org
.tianocore
.common
.Tools
;
27 import java
.awt
.event
.ActionEvent
;
28 import java
.awt
.event
.ActionListener
;
32 GUI for update GUID declarations in spd file
34 @since PackageEditor 1.0
36 public class UpdateGuids
extends JFrame
implements ActionListener
{
38 private JPanel jContentPane
= null;
40 private JScrollPane jScrollPane
= null;
42 private JTable jTable
= null;
44 private SpdFileContents sfc
= null;
46 private JButton jButtonOk
= null;
48 private JButton jButtonCancel
= null;
50 private DefaultTableModel model
= null;
52 private JButton jButton
= null;
55 This is the default constructor
57 public UpdateGuids(SpdFileContents sfc
) {
64 public void actionPerformed(ActionEvent arg0
) {
65 if (arg0
.getSource() == jButtonOk
) {
70 if (arg0
.getSource() == jButtonCancel
) {
74 if (arg0
.getSource() == jButton
) {
75 String
[] o
= { "", "", "" };
81 This method initializes this
85 private void initialize() {
86 this.setSize(604, 553);
87 this.setDefaultCloseOperation(javax
.swing
.WindowConstants
.DISPOSE_ON_CLOSE
);
88 this.setTitle("Update GUID Declarations");
89 this.setContentPane(getJContentPane());
93 This method initializes jContentPane
95 @return javax.swing.JPanel
97 private JPanel
getJContentPane() {
98 if (jContentPane
== null) {
99 jContentPane
= new JPanel();
100 jContentPane
.setLayout(null);
101 jContentPane
.add(getJScrollPane(), null);
102 jContentPane
.add(getJButtonOk(), null);
103 jContentPane
.add(getJButtonCancel(), null);
104 jContentPane
.add(getJButton(), null);
110 This method initializes jScrollPane
112 @return javax.swing.JScrollPane
114 private JScrollPane
getJScrollPane() {
115 if (jScrollPane
== null) {
116 jScrollPane
= new JScrollPane();
117 jScrollPane
.setBounds(new java
.awt
.Rectangle(38, 45, 453, 419));
118 jScrollPane
.setViewportView(getJTable());
124 This method initializes jTable
126 @return javax.swing.JTable
128 private JTable
getJTable() {
129 if (jTable
== null) {
130 model
= new DefaultTableModel();
131 jTable
= new JTable(model
);
132 jTable
.setRowHeight(20);
133 model
.addColumn("Name");
134 model
.addColumn("C_Name");
135 model
.addColumn("GUID");
136 if (sfc
.getSpdGuidDeclarationCount() == 0) {
140 // initialize table using SpdFileContents object
142 String
[][] saa
= new String
[sfc
.getSpdGuidDeclarationCount()][3];
143 sfc
.getSpdGuidDeclarations(saa
);
145 while (i
< saa
.length
) {
146 model
.addRow(saa
[i
]);
155 Remove original GUID declarations before saving updated ones
157 protected void save() {
158 sfc
.removeSpdGuidDeclaration();
159 int rowCount
= model
.getRowCount();
162 while (i
< rowCount
) {
164 if (model
.getValueAt(i
, 0) != null) {
165 name
= model
.getValueAt(i
, 0).toString();
168 if (model
.getValueAt(i
, 1) != null) {
169 cName
= model
.getValueAt(i
, 1).toString();
172 if (model
.getValueAt(i
, 2) != null) {
173 guid
= model
.getValueAt(i
, 2).toString();
175 sfc
.genSpdGuidDeclarations(name
, cName
, guid
, null);
181 This method initializes jButtonOk
183 @return javax.swing.JButton
185 private JButton
getJButtonOk() {
186 if (jButtonOk
== null) {
187 jButtonOk
= new JButton();
188 jButtonOk
.setText("Ok");
189 jButtonOk
.setSize(new java
.awt
.Dimension(84, 20));
190 jButtonOk
.setLocation(new java
.awt
.Point(316, 486));
191 jButtonOk
.addActionListener(this);
197 This method initializes jButtonCancel
199 @return javax.swing.JButton
201 private JButton
getJButtonCancel() {
202 if (jButtonCancel
== null) {
203 jButtonCancel
= new JButton();
204 jButtonCancel
.setText("Cancel");
205 jButtonCancel
.setSize(new java
.awt
.Dimension(82, 20));
206 jButtonCancel
.setLocation(new java
.awt
.Point(411, 486));
207 jButtonCancel
.addActionListener(this);
209 return jButtonCancel
;
213 This method initializes jButton
215 @return javax.swing.JButton
217 private JButton
getJButton() {
218 if (jButton
== null) {
219 jButton
= new JButton();
220 jButton
.setBounds(new java
.awt
.Rectangle(219, 487, 78, 18));
221 jButton
.setText("Insert");
222 jButton
.addActionListener(this);
226 } // @jve:decl-index=0:visual-constraint="11,7"