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
;
22 GUI for create library definition elements of spd file.
24 @since PackageEditor 1.0
26 public class SpdPpiDecls
extends SpdGuidDecls
{
31 private static final long serialVersionUID
= 1L;
32 private SpdFileContents sfc
= null;
33 private OpeningPackageType docConsole
= null;
35 public SpdPpiDecls() {
37 // TODO Auto-generated constructor stub
40 public SpdPpiDecls(PackageSurfaceAreaDocument
.PackageSurfaceArea inPsa
) {
42 sfc
= new SpdFileContents(inPsa
);
46 public SpdPpiDecls(OpeningPackageType opt
) {
47 this(opt
.getXmlSpd());
51 protected void initFrame() {
53 this.setTitle("PPI Declarations");
57 protected void init(SpdFileContents sfc
){
59 // initialize table using SpdFileContents object
61 DefaultTableModel model
= getModel();
62 if (sfc
.getSpdPpiDeclarationCount() == 0) {
65 saa
= new String
[sfc
.getSpdPpiDeclarationCount()][7];
66 sfc
.getSpdPpiDeclarations(saa
);
68 while (i
< saa
.length
) {
74 protected void updateRow(int row
, int column
, TableModel m
){
75 String
[] sa
= new String
[7];
76 sfc
.getSpdPpiDeclaration(sa
, row
);
77 Object cellData
= m
.getValueAt(row
, column
);
78 if (cellData
== null) {
81 if (cellData
.equals(sa
[column
])) {
84 if (cellData
.toString().length() == 0 && sa
[column
] == null) {
88 String name
= m
.getValueAt(row
, 0) + "";
89 String cName
= m
.getValueAt(row
, 1) + "";
90 String guid
= m
.getValueAt(row
, 2) + "";
91 String help
= m
.getValueAt(row
, 3) + "";
92 String archList
= null;
93 if (m
.getValueAt(row
, 4) != null) {
94 archList
= m
.getValueAt(row
, 4).toString();
96 String modTypeList
= null;
97 if (m
.getValueAt(row
, 5) != null) {
98 modTypeList
= m
.getValueAt(row
, 5).toString();
100 String guidTypeList
= null;
101 if (m
.getValueAt(row
, 6) != null) {
102 guidTypeList
= m
.getValueAt(row
, 6).toString();
104 String
[] rowData
= {name
, cName
, guid
, help
};
105 if (!dataValidation(rowData
)){
108 docConsole
.setSaved(false);
109 sfc
.updateSpdPpiDecl(row
, name
, cName
, guid
, help
, archList
, modTypeList
, guidTypeList
);
112 protected int addRow(String
[] row
) {
114 if (!dataValidation(row
)){
117 docConsole
.setSaved(false);
118 sfc
.genSpdPpiDeclarations(row
[0], row
[1], row
[2], row
[3], stringToVector(row
[4]), stringToVector(row
[5]), stringToVector(row
[6]));
122 protected void removeRow(int i
){
123 sfc
.removeSpdPpiDeclaration(i
);
124 docConsole
.setSaved(false);
127 protected void clearAllRow(){
128 sfc
.removeSpdPpiDeclaration();
129 docConsole
.setSaved(false);