]> git.proxmox.com Git - mirror_edk2.git/blame - 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
CommitLineData
a13899c5 1/** @file\r
2 Java class SpdProtocolDecls is GUI for create library definition elements of spd file.\r
3 \r
4Copyright (c) 2006, Intel Corporation\r
5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12**/\r
13package org.tianocore.frameworkwizard.packaging.ui;\r
14\r
15import javax.swing.table.DefaultTableModel;\r
16import javax.swing.table.TableModel;\r
17\r
18import org.tianocore.PackageSurfaceAreaDocument;\r
19\r
20/**\r
21GUI for create library definition elements of spd file.\r
22 \r
23@since PackageEditor 1.0\r
24**/\r
25public class SpdProtocolDecls extends SpdGuidDecls {\r
26\r
27 private SpdFileContents sfc = null;\r
28 \r
29 public SpdProtocolDecls() {\r
30 super();\r
31 // TODO Auto-generated constructor stub\r
32 }\r
33\r
34 public SpdProtocolDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) {\r
35 this();\r
36 sfc = new SpdFileContents(inPsa);\r
37 init(sfc);\r
38 }\r
39 \r
40 protected void initFrame() {\r
41 \r
42 this.setTitle("Protocol Declarations");\r
43 getJScrollPaneGuid().setVisible(false);\r
44 getJLabel3().setVisible(false);\r
45 \r
46 getJTable().getColumn("GuidTypes").setPreferredWidth(0);\r
47 getJTable().getColumn("GuidTypes").setWidth(0);\r
48 getJTable().getColumn("GuidTypes").setHeaderValue(" ");\r
49 }\r
50 \r
51 protected void init(SpdFileContents sfc){\r
52 //\r
53 // initialize table using SpdFileContents object\r
54 //\r
55 DefaultTableModel model = getModel();\r
56 if (sfc.getSpdProtocolDeclarationCount() == 0) {\r
57 return ;\r
58 }\r
59 String[][] saa = new String[sfc.getSpdProtocolDeclarationCount()][6];\r
60 sfc.getSpdProtocolDeclarations(saa);\r
61 int i = 0;\r
62 while (i < saa.length) {\r
63 model.addRow(saa[i]);\r
64 i++;\r
65 }\r
66 \r
67 }\r
68 \r
69 protected void updateRow(int row, TableModel m){\r
70 String name = m.getValueAt(row, 0) + "";\r
71 String cName = m.getValueAt(row, 1) + "";\r
72 String guid = m.getValueAt(row, 2) + "";\r
73 String help = m.getValueAt(row, 3) + "";\r
74 String archList = null;\r
75 if (m.getValueAt(row, 4) != null) {\r
76 archList = m.getValueAt(row, 4).toString();\r
77 }\r
78 String modTypeList = null;\r
79 if (m.getValueAt(row, 5) != null) {\r
80 modTypeList = m.getValueAt(row, 5).toString();\r
81 }\r
82 \r
83 sfc.updateSpdProtocolDecl(row, name, cName, guid, help, archList, modTypeList);\r
84 }\r
85 \r
86 protected void addRow(String[] row) {\r
87 sfc.genSpdProtocolDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]));\r
88 }\r
89 \r
90 protected void removeRow(int i){\r
91 sfc.removeSpdProtocolDeclaration(i);\r
92 }\r
93 \r
94 protected void clearAllRow(){\r
95 sfc.removeSpdProtocolDeclaration();\r
96 }\r
97}\r