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 SpdProtocolDecls
extends SpdGuidDecls
{
32 private static final long serialVersionUID
= 1L;
33 private SpdFileContents sfc
= null;
34 private OpeningPackageType docConsole
= null;
36 public SpdProtocolDecls() {
38 // TODO Auto-generated constructor stub
41 public SpdProtocolDecls(PackageSurfaceAreaDocument
.PackageSurfaceArea inPsa
) {
43 sfc
= new SpdFileContents(inPsa
);
47 public SpdProtocolDecls(OpeningPackageType opt
) {
48 this(opt
.getXmlSpd());
52 protected void initFrame() {
54 this.setTitle("Protocol 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
.getSpdProtocolDeclarationCount() == 0) {
67 saa
= new String
[sfc
.getSpdProtocolDeclarationCount()][7];
68 sfc
.getSpdProtocolDeclarations(saa
);
70 while (i
< saa
.length
) {
77 protected void updateRow(int row
, int column
, TableModel m
){
78 String
[] sa
= new String
[7];
79 sfc
.getSpdProtocolDeclaration(sa
, row
);
80 Object cellData
= m
.getValueAt(row
, column
);
81 if (cellData
== null) {
84 if (cellData
.equals(sa
[column
])) {
87 if (cellData
.toString().length() == 0 && sa
[column
] == null) {
91 String name
= m
.getValueAt(row
, 0) + "";
92 String cName
= m
.getValueAt(row
, 1) + "";
93 String guid
= m
.getValueAt(row
, 2) + "";
94 String help
= m
.getValueAt(row
, 3) + "";
95 String archList
= null;
96 if (m
.getValueAt(row
, 4) != null) {
97 archList
= m
.getValueAt(row
, 4).toString();
99 String modTypeList
= null;
100 if (m
.getValueAt(row
, 5) != null) {
101 modTypeList
= m
.getValueAt(row
, 5).toString();
103 String guidTypeList
= null;
104 if (m
.getValueAt(row
, 6) != null) {
105 guidTypeList
= m
.getValueAt(row
, 6).toString();
107 String
[] rowData
= {name
, cName
, guid
, help
};
108 if (!dataValidation(rowData
)){
111 docConsole
.setSaved(false);
112 sfc
.updateSpdProtocolDecl(row
, name
, cName
, guid
, help
, archList
, modTypeList
, guidTypeList
);
115 protected int addRow(String
[] row
) {
116 if (!dataValidation(row
)){
119 docConsole
.setSaved(false);
120 sfc
.genSpdProtocolDeclarations(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
.removeSpdProtocolDeclaration(i
);
126 docConsole
.setSaved(false);
129 protected void clearAllRow(){
130 sfc
.removeSpdProtocolDeclaration();
131 docConsole
.setSaved(false);