]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.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 / SpdPpiDecls.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.event.TableModelEvent;
16 import javax.swing.table.DefaultTableModel;
17 import javax.swing.table.TableModel;
18
19 import org.tianocore.PackageSurfaceAreaDocument;
20
21 /**
22 GUI for create library definition elements of spd file.
23
24 @since PackageEditor 1.0
25 **/
26 public class SpdPpiDecls extends SpdGuidDecls {
27
28 private SpdFileContents sfc = null;
29
30 public SpdPpiDecls() {
31 super();
32 // TODO Auto-generated constructor stub
33 }
34
35 public SpdPpiDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) {
36 this();
37 sfc = new SpdFileContents(inPsa);
38 init(sfc);
39 }
40
41 protected void initFrame() {
42
43 this.setTitle("PPI Declarations");
44 getJScrollPaneGuid().setVisible(false);
45 getJLabel3().setVisible(false);
46
47 getJTable().getColumn("GuidTypes").setPreferredWidth(0);
48 getJTable().getColumn("GuidTypes").setWidth(0);
49 getJTable().getColumn("GuidTypes").setHeaderValue(" ");
50 }
51
52 protected void init(SpdFileContents sfc){
53 //
54 // initialize table using SpdFileContents object
55 //
56 DefaultTableModel model = getModel();
57 if (sfc.getSpdPpiDeclarationCount() == 0) {
58 return ;
59 }
60 String[][] saa = new String[sfc.getSpdPpiDeclarationCount()][6];
61 sfc.getSpdPpiDeclarations(saa);
62 int i = 0;
63 while (i < saa.length) {
64 model.addRow(saa[i]);
65 i++;
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 sfc.updateSpdPpiDecl(row, name, cName, guid, help, archList, modTypeList);
83 }
84
85 protected void addRow(String[] row) {
86 sfc.genSpdPpiDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]));
87 }
88
89 protected void removeRow(int i){
90 sfc.removeSpdPpiDeclaration(i);
91 }
92
93 protected void clearAllRow(){
94 sfc.removeSpdPpiDeclaration();
95 }
96 }