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
.JOptionPane
;
16 import javax
.swing
.table
.DefaultTableModel
;
17 import javax
.swing
.table
.TableModel
;
19 import org
.tianocore
.PackageSurfaceAreaDocument
;
20 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPackageType
;
21 import org
.tianocore
.frameworkwizard
.platform
.ui
.ListEditor
;
24 GUI for create library definition elements of spd file.
26 @since PackageEditor 1.0
28 public class SpdPpiDecls
extends SpdGuidDecls
{
33 private static final long serialVersionUID
= 1L;
34 private SpdFileContents sfc
= null;
35 private OpeningPackageType docConsole
= null;
37 public SpdPpiDecls() {
39 // TODO Auto-generated constructor stub
42 public SpdPpiDecls(PackageSurfaceAreaDocument
.PackageSurfaceArea inPsa
) {
44 sfc
= new SpdFileContents(inPsa
);
48 public SpdPpiDecls(OpeningPackageType opt
) {
49 this(opt
.getXmlSpd());
51 if (sfc
.getSpdPkgDefsRdOnly().equals("true")) {
52 JOptionPane
.showMessageDialog(frame
, "This is a read-only package. You will not be able to edit contents in table.");
57 protected void initFrame() {
59 this.setTitle("PPI Declarations");
60 starLabel
.setVisible(false);
61 ((ListEditor
)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
64 protected void init(SpdFileContents sfc
){
66 // initialize table using SpdFileContents object
68 DefaultTableModel model
= getModel();
69 if (sfc
.getSpdPpiDeclarationCount() == 0) {
72 saa
= new String
[sfc
.getSpdPpiDeclarationCount()][7];
73 sfc
.getSpdPpiDeclarations(saa
);
75 while (i
< saa
.length
) {
82 protected void updateRow(int row
, int column
, TableModel m
){
83 String
[] sa
= new String
[7];
84 sfc
.getSpdPpiDeclaration(sa
, row
);
85 Object cellData
= m
.getValueAt(row
, column
);
86 if (cellData
== null) {
89 if (cellData
.equals(sa
[column
])) {
92 if (cellData
.toString().length() == 0 && sa
[column
] == null) {
96 String name
= m
.getValueAt(row
, 0) + "";
97 String cName
= m
.getValueAt(row
, 1) + "";
98 String guid
= m
.getValueAt(row
, 2) + "";
99 String help
= m
.getValueAt(row
, 3) + "";
100 String archList
= null;
101 if (m
.getValueAt(row
, 4) != null) {
102 archList
= m
.getValueAt(row
, 4).toString();
104 String modTypeList
= null;
105 if (m
.getValueAt(row
, 5) != null) {
106 modTypeList
= m
.getValueAt(row
, 5).toString();
108 String guidTypeList
= null;
109 if (m
.getValueAt(row
, 6) != null) {
110 guidTypeList
= m
.getValueAt(row
, 6).toString();
112 String
[] rowData
= {name
, cName
, guid
, help
};
113 if (!dataValidation(rowData
)){
116 docConsole
.setSaved(false);
117 sfc
.updateSpdPpiDecl(row
, name
, cName
, guid
, help
, archList
, modTypeList
, guidTypeList
);
120 protected int addRow(String
[] row
) {
122 if (!dataValidation(row
)){
125 docConsole
.setSaved(false);
126 sfc
.genSpdPpiDeclarations(row
[0], row
[1], row
[2], row
[3], stringToVector(row
[4]), stringToVector(row
[5]), stringToVector(row
[6]));
130 protected void removeRow(int i
){
131 sfc
.removeSpdPpiDeclaration(i
);
132 docConsole
.setSaved(false);
135 protected void clearAllRow(){
136 sfc
.removeSpdPpiDeclaration();
137 docConsole
.setSaved(false);
141 * @return Returns the sfc.
143 protected SpdFileContents
getSfc() {