]>
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() {
155 if (jTable
.isEditing()) {
156 jTable
.getCellEditor().stopCellEditing();
158 sfc
.removeSpdMsaFile();
159 int rowCount
= jTable
.getRowCount();
161 while (i
< rowCount
) {
162 String msaFile
= null;
163 if (jTable
.getValueAt(i
, 0) != null) {
164 msaFile
= jTable
.getValueAt(i
, 0).toString();
166 sfc
.genSpdMsaFiles(msaFile
, null);
172 This method initializes jButtonOk
174 @return javax.swing.JButton
176 private JButton
getJButtonOk() {
177 if (jButtonOk
== null) {
178 jButtonOk
= new JButton();
179 jButtonOk
.setText("Ok");
180 jButtonOk
.setSize(new java
.awt
.Dimension(84, 20));
181 jButtonOk
.setLocation(new java
.awt
.Point(316, 486));
182 jButtonOk
.addActionListener(this);
188 This method initializes jButtonCancel
190 @return javax.swing.JButton
192 private JButton
getJButtonCancel() {
193 if (jButtonCancel
== null) {
194 jButtonCancel
= new JButton();
195 jButtonCancel
.setText("Cancel");
196 jButtonCancel
.setSize(new java
.awt
.Dimension(82, 20));
197 jButtonCancel
.setLocation(new java
.awt
.Point(411, 486));
198 jButtonCancel
.addActionListener(this);
200 return jButtonCancel
;
204 This method initializes jButton
206 @return javax.swing.JButton
208 private JButton
getJButton() {
209 if (jButton
== null) {
210 jButton
= new JButton();
211 jButton
.setBounds(new java
.awt
.Rectangle(219, 486, 79, 19));
212 jButton
.setText("Insert");
213 jButton
.addActionListener(this);
218 } // @jve:decl-index=0:visual-constraint="11,7"