]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateMsaFile.java
2 Java class UpdateLibraryClass is GUI for msa files 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
;
31 GUI for msa files in spd file
33 @since PackageEditor 1.0
35 public class UpdateMsaFile
extends JFrame
implements ActionListener
{
37 private JPanel jContentPane
= null;
39 private JScrollPane jScrollPane
= null;
41 private JTable jTable
= null;
43 private SpdFileContents sfc
= null;
45 private JButton jButtonOk
= null;
47 private JButton jButtonCancel
= null;
49 private DefaultTableModel model
= null;
51 private JButton jButton
= null;
54 This is the default constructor
56 public UpdateMsaFile(SpdFileContents sfc
) {
63 public void actionPerformed(ActionEvent arg0
) {
64 if (arg0
.getSource() == jButtonOk
) {
69 if (arg0
.getSource() == jButtonCancel
) {
73 if (arg0
.getSource() == jButton
) {
80 This method initializes this
84 private void initialize() {
85 this.setSize(604, 553);
86 this.setDefaultCloseOperation(javax
.swing
.WindowConstants
.DISPOSE_ON_CLOSE
);
87 this.setTitle("Update MSA Files");
88 this.setContentPane(getJContentPane());
92 This method initializes jContentPane
94 @return javax.swing.JPanel
96 private JPanel
getJContentPane() {
97 if (jContentPane
== null) {
98 jContentPane
= new JPanel();
99 jContentPane
.setLayout(null);
100 jContentPane
.add(getJScrollPane(), null);
101 jContentPane
.add(getJButtonOk(), null);
102 jContentPane
.add(getJButtonCancel(), null);
103 jContentPane
.add(getJButton(), null);
109 This method initializes jScrollPane
111 @return javax.swing.JScrollPane
113 private JScrollPane
getJScrollPane() {
114 if (jScrollPane
== null) {
115 jScrollPane
= new JScrollPane();
116 jScrollPane
.setBounds(new java
.awt
.Rectangle(38, 45, 453, 419));
117 jScrollPane
.setViewportView(getJTable());
123 This method initializes jTable
125 @return javax.swing.JTable
127 private JTable
getJTable() {
128 if (jTable
== null) {
129 model
= new DefaultTableModel();
130 jTable
= new JTable(model
);
131 jTable
.setRowHeight(20);
132 model
.addColumn("MSA File");
134 if (sfc
.getSpdMsaFileCount() == 0) {
138 // initialize table using SpdFileContents object
140 String
[][] saa
= new String
[sfc
.getSpdMsaFileCount()][1];
141 sfc
.getSpdMsaFiles(saa
);
143 while (i
< saa
.length
) {
144 model
.addRow(saa
[i
]);
152 Remove original Msa files before saving updated ones
154 protected void save() {
156 sfc
.removeSpdMsaFile();
157 int rowCount
= jTable
.getRowCount();
159 while (i
< rowCount
) {
160 String msaFile
= null;
161 if (jTable
.getValueAt(i
, 0) != null) {
162 msaFile
= jTable
.getValueAt(i
, 0).toString();
164 sfc
.genSpdMsaFiles(msaFile
, null);
170 This method initializes jButtonOk
172 @return javax.swing.JButton
174 private JButton
getJButtonOk() {
175 if (jButtonOk
== null) {
176 jButtonOk
= new JButton();
177 jButtonOk
.setText("Ok");
178 jButtonOk
.setSize(new java
.awt
.Dimension(84, 20));
179 jButtonOk
.setLocation(new java
.awt
.Point(316, 486));
180 jButtonOk
.addActionListener(this);
186 This method initializes jButtonCancel
188 @return javax.swing.JButton
190 private JButton
getJButtonCancel() {
191 if (jButtonCancel
== null) {
192 jButtonCancel
= new JButton();
193 jButtonCancel
.setText("Cancel");
194 jButtonCancel
.setSize(new java
.awt
.Dimension(82, 20));
195 jButtonCancel
.setLocation(new java
.awt
.Point(411, 486));
196 jButtonCancel
.addActionListener(this);
198 return jButtonCancel
;
202 This method initializes jButton
204 @return javax.swing.JButton
206 private JButton
getJButton() {
207 if (jButton
== null) {
208 jButton
= new JButton();
209 jButton
.setBounds(new java
.awt
.Rectangle(219, 486, 79, 19));
210 jButton
.setText("Insert");
211 jButton
.addActionListener(this);
216 } // @jve:decl-index=0:visual-constraint="11,7"