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
.table
.DefaultTableModel
;
16 import javax
.swing
.table
.TableModel
;
18 import org
.tianocore
.PackageSurfaceAreaDocument
;
19 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningPackageType
;
20 import org
.tianocore
.frameworkwizard
.platform
.ui
.ListEditor
;
23 GUI for create library definition elements of spd file.
25 @since PackageEditor 1.0
27 public class SpdPpiDecls
extends SpdGuidDecls
{
32 private static final long serialVersionUID
= 1L;
33 private SpdFileContents sfc
= null;
34 private OpeningPackageType docConsole
= null;
36 public SpdPpiDecls() {
38 // TODO Auto-generated constructor stub
41 public SpdPpiDecls(PackageSurfaceAreaDocument
.PackageSurfaceArea inPsa
) {
43 sfc
= new SpdFileContents(inPsa
);
47 public SpdPpiDecls(OpeningPackageType opt
) {
48 this(opt
.getXmlSpd());
52 protected void initFrame() {
54 this.setTitle("PPI Declarations");
55 starLabel
.setVisible(false);
56 ((ListEditor
)getJTable().getColumnModel().getColumn(6).getCellEditor()).setCanNotBeEmpty(false);
59 protected void init(SpdFileContents sfc
){
61 // initialize table using SpdFileContents object
63 DefaultTableModel model
= getModel();
64 if (sfc
.getSpdPpiDeclarationCount() == 0) {
67 saa
= new String
[sfc
.getSpdPpiDeclarationCount()][7];
68 sfc
.getSpdPpiDeclarations(saa
);
70 while (i
< saa
.length
) {
76 protected void updateRow(int row
, int column
, TableModel m
){
77 String
[] sa
= new String
[7];
78 sfc
.getSpdPpiDeclaration(sa
, row
);
79 Object cellData
= m
.getValueAt(row
, column
);
80 if (cellData
== null) {
83 if (cellData
.equals(sa
[column
])) {
86 if (cellData
.toString().length() == 0 && sa
[column
] == null) {
90 String name
= m
.getValueAt(row
, 0) + "";
91 String cName
= m
.getValueAt(row
, 1) + "";
92 String guid
= m
.getValueAt(row
, 2) + "";
93 String help
= m
.getValueAt(row
, 3) + "";
94 String archList
= null;
95 if (m
.getValueAt(row
, 4) != null) {
96 archList
= m
.getValueAt(row
, 4).toString();
98 String modTypeList
= null;
99 if (m
.getValueAt(row
, 5) != null) {
100 modTypeList
= m
.getValueAt(row
, 5).toString();
102 String guidTypeList
= null;
103 if (m
.getValueAt(row
, 6) != null) {
104 guidTypeList
= m
.getValueAt(row
, 6).toString();
106 String
[] rowData
= {name
, cName
, guid
, help
};
107 if (!dataValidation(rowData
)){
110 docConsole
.setSaved(false);
111 sfc
.updateSpdPpiDecl(row
, name
, cName
, guid
, help
, archList
, modTypeList
, guidTypeList
);
114 protected int addRow(String
[] row
) {
116 if (!dataValidation(row
)){
119 docConsole
.setSaved(false);
120 sfc
.genSpdPpiDeclarations(row
[0], row
[1], row
[2], row
[3], stringToVector(row
[4]), stringToVector(row
[5]), stringToVector(row
[6]));
124 protected void removeRow(int i
){
125 sfc
.removeSpdPpiDeclaration(i
);
126 docConsole
.setSaved(false);
129 protected void clearAllRow(){
130 sfc
.removeSpdPpiDeclaration();
131 docConsole
.setSaved(false);