]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@671 6f19259b...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / packaging / ui / SpdProtocolDecls.java
1 /** @file
2 Java class SpdProtocolDecls is GUI for create library definition elements of spd file.
3
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
9
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.
12 **/
13 package org.tianocore.frameworkwizard.packaging.ui;
14
15 import javax.swing.table.DefaultTableModel;
16 import javax.swing.table.TableModel;
17
18 import org.tianocore.PackageSurfaceAreaDocument;
19
20 /**
21 GUI for create library definition elements of spd file.
22
23 @since PackageEditor 1.0
24 **/
25 public class SpdProtocolDecls extends SpdGuidDecls {
26
27 private SpdFileContents sfc = null;
28
29 public SpdProtocolDecls() {
30 super();
31 // TODO Auto-generated constructor stub
32 }
33
34 public SpdProtocolDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) {
35 this();
36 sfc = new SpdFileContents(inPsa);
37 init(sfc);
38 }
39
40 protected void initFrame() {
41
42 this.setTitle("Protocol Declarations");
43 getJScrollPaneGuid().setVisible(false);
44 getJLabel3().setVisible(false);
45
46 getJTable().getColumn("GuidTypes").setPreferredWidth(0);
47 getJTable().getColumn("GuidTypes").setWidth(0);
48 getJTable().getColumn("GuidTypes").setHeaderValue(" ");
49 }
50
51 protected void init(SpdFileContents sfc){
52 //
53 // initialize table using SpdFileContents object
54 //
55 DefaultTableModel model = getModel();
56 if (sfc.getSpdProtocolDeclarationCount() == 0) {
57 return ;
58 }
59 String[][] saa = new String[sfc.getSpdProtocolDeclarationCount()][6];
60 sfc.getSpdProtocolDeclarations(saa);
61 int i = 0;
62 while (i < saa.length) {
63 model.addRow(saa[i]);
64 i++;
65 }
66
67 }
68
69 protected void updateRow(int row, TableModel m){
70 String name = m.getValueAt(row, 0) + "";
71 String cName = m.getValueAt(row, 1) + "";
72 String guid = m.getValueAt(row, 2) + "";
73 String help = m.getValueAt(row, 3) + "";
74 String archList = null;
75 if (m.getValueAt(row, 4) != null) {
76 archList = m.getValueAt(row, 4).toString();
77 }
78 String modTypeList = null;
79 if (m.getValueAt(row, 5) != null) {
80 modTypeList = m.getValueAt(row, 5).toString();
81 }
82
83 sfc.updateSpdProtocolDecl(row, name, cName, guid, help, archList, modTypeList);
84 }
85
86 protected void addRow(String[] row) {
87 sfc.genSpdProtocolDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]));
88 }
89
90 protected void removeRow(int i){
91 sfc.removeSpdProtocolDeclaration(i);
92 }
93
94 protected void clearAllRow(){
95 sfc.removeSpdProtocolDeclaration();
96 }
97 }