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 SpdProtocolDecls
extends SpdGuidDecls
{
31 private static final long serialVersionUID
= 1L;
32 private SpdFileContents sfc
= null;
33 private OpeningPackageType docConsole
= null;
35 public SpdProtocolDecls() {
37 // TODO Auto-generated constructor stub
40 public SpdProtocolDecls(PackageSurfaceAreaDocument
.PackageSurfaceArea inPsa
) {
42 sfc
= new SpdFileContents(inPsa
);
46 public SpdProtocolDecls(OpeningPackageType opt
) {
47 this(opt
.getXmlSpd());
51 protected void initFrame() {
53 this.setTitle("Protocol Declarations");
54 getJScrollPaneGuid().setVisible(false);
55 getJLabel3().setVisible(false);
57 getJTable().getColumn("GuidTypes").setPreferredWidth(0);
58 getJTable().getColumn("GuidTypes").setWidth(0);
59 getJTable().getColumn("GuidTypes").setHeaderValue(" ");
62 protected void init(SpdFileContents sfc
){
64 // initialize table using SpdFileContents object
66 DefaultTableModel model
= getModel();
67 if (sfc
.getSpdProtocolDeclarationCount() == 0) {
70 String
[][] saa
= new String
[sfc
.getSpdProtocolDeclarationCount()][6];
71 sfc
.getSpdProtocolDeclarations(saa
);
73 while (i
< saa
.length
) {
80 protected void updateRow(int row
, TableModel m
){
81 String name
= m
.getValueAt(row
, 0) + "";
82 String cName
= m
.getValueAt(row
, 1) + "";
83 String guid
= m
.getValueAt(row
, 2) + "";
84 String help
= m
.getValueAt(row
, 3) + "";
85 String archList
= null;
86 if (m
.getValueAt(row
, 4) != null) {
87 archList
= m
.getValueAt(row
, 4).toString();
89 String modTypeList
= null;
90 if (m
.getValueAt(row
, 5) != null) {
91 modTypeList
= m
.getValueAt(row
, 5).toString();
93 String
[] rowData
= {name
, cName
, guid
, help
};
94 if (!dataValidation(rowData
)){
97 docConsole
.setSaved(false);
98 sfc
.updateSpdProtocolDecl(row
, name
, cName
, guid
, help
, archList
, modTypeList
);
101 protected void addRow(String
[] row
) {
102 if (!dataValidation(row
)){
105 sfc
.genSpdProtocolDeclarations(row
[0], row
[1], row
[2], row
[3], stringToVector(row
[4]), stringToVector(row
[5]));
108 protected void removeRow(int i
){
109 sfc
.removeSpdProtocolDeclaration(i
);
112 protected void clearAllRow(){
113 sfc
.removeSpdProtocolDeclaration();