2 Java class SpdProtocolDecls is GUI for create library definition elements of 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
.frameworkwizard
.packaging
.ui
;
15 import javax
.swing
.JFrame
;
16 import javax
.swing
.JOptionPane
;
17 import javax
.swing
.table
.DefaultTableModel
;
18 import javax
.swing
.table
.TableModel
;
20 import org
.tianocore
.PackageSurfaceAreaDocument
;
21 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPackageType
;
22 import org
.tianocore
.frameworkwizard
.platform
.ui
.ListEditor
;
25 GUI for create library definition elements of spd file.
27 @since PackageEditor 1.0
29 public class SpdPpiDecls
extends SpdGuidDecls
{
34 private static final long serialVersionUID
= 1L;
35 private SpdFileContents sfc
= null;
36 private OpeningPackageType docConsole
= null;
37 // private JFrame topFrame = null;
39 public SpdPpiDecls(JFrame frame
) {
41 // TODO Auto-generated constructor stub
44 public SpdPpiDecls(PackageSurfaceAreaDocument
.PackageSurfaceArea inPsa
, JFrame frame
) {
46 sfc
= new SpdFileContents(inPsa
);
50 public SpdPpiDecls(OpeningPackageType opt
, JFrame frame
) {
51 this(opt
.getXmlSpd(), frame
);
53 if (sfc
.getSpdPkgDefsRdOnly().equals("true")) {
54 JOptionPane
.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table.");
59 protected void initFrame() {
61 this.setTitle("PPI Declarations");
62 starLabel
.setVisible(false);
63 ((ListEditor
)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
66 protected void init(SpdFileContents sfc
){
68 // initialize table using SpdFileContents object
70 DefaultTableModel model
= getModel();
71 if (sfc
.getSpdPpiDeclarationCount() == 0) {
74 saa
= new String
[sfc
.getSpdPpiDeclarationCount()][7];
75 sfc
.getSpdPpiDeclarations(saa
);
77 while (i
< saa
.length
) {
84 protected void updateRow(int row
, int column
, TableModel m
){
85 String
[] sa
= new String
[7];
86 sfc
.getSpdPpiDeclaration(sa
, row
);
87 Object cellData
= m
.getValueAt(row
, column
);
88 if (cellData
== null) {
91 if (cellData
.equals(sa
[column
])) {
94 if (cellData
.toString().length() == 0 && sa
[column
] == null) {
98 String name
= m
.getValueAt(row
, 0) + "";
99 String cName
= m
.getValueAt(row
, 1) + "";
100 String guid
= m
.getValueAt(row
, 2) + "";
101 String help
= m
.getValueAt(row
, 3) + "";
102 String archList
= null;
103 if (m
.getValueAt(row
, 4) != null) {
104 archList
= m
.getValueAt(row
, 4).toString();
106 String modTypeList
= null;
107 if (m
.getValueAt(row
, 5) != null) {
108 modTypeList
= m
.getValueAt(row
, 5).toString();
110 String guidTypeList
= null;
111 if (m
.getValueAt(row
, 6) != null) {
112 guidTypeList
= m
.getValueAt(row
, 6).toString();
114 String
[] rowData
= {name
, cName
, guid
, help
};
115 if (!dataValidation(rowData
)){
118 docConsole
.setSaved(false);
119 sfc
.updateSpdPpiDecl(row
, name
, cName
, guid
, help
, archList
, modTypeList
, guidTypeList
);
122 protected int addRow(String
[] row
) {
124 if (!dataValidation(row
)){
127 docConsole
.setSaved(false);
128 sfc
.genSpdPpiDeclarations(row
[0], row
[1], row
[2], row
[3], stringToVector(row
[4]), stringToVector(row
[5]), stringToVector(row
[6]));
132 protected void removeRow(int i
){
133 sfc
.removeSpdPpiDeclaration(i
);
134 docConsole
.setSaved(false);
137 protected void clearAllRow(){
138 sfc
.removeSpdPpiDeclaration();
139 docConsole
.setSaved(false);
143 * @return Returns the sfc.
145 protected SpdFileContents
getSfc() {