]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageDefinitions.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 / SpdPackageDefinitions.java
1 /** @file
2
3 The file is used to create, update Package Definitions of Spd file
4
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15 package org.tianocore.frameworkwizard.packaging.ui;
16
17 import javax.swing.JPanel;
18 import javax.swing.JDialog;
19 import javax.swing.JLabel;
20 import javax.swing.JComboBox;
21 import java.awt.Dimension;
22
23 import org.tianocore.PackageSurfaceAreaDocument;
24 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
25 import org.tianocore.frameworkwizard.common.ui.StarLabel;
26
27 public class SpdPackageDefinitions extends IInternalFrame {
28
29 private JPanel jContentPane = null;
30 private JLabel jLabel = null;
31 private JComboBox jComboBoxReadOnly = null;
32 private JLabel jLabel1 = null;
33 private JComboBox jComboBoxRePackage = null;
34 private StarLabel starLabel = null;
35 private StarLabel starLabel1 = null;
36 private SpdFileContents sfc = null;
37
38 /**
39 * This is the default constructor
40 */
41 public SpdPackageDefinitions() {
42 super();
43 initialize();
44 }
45
46 public SpdPackageDefinitions(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa){
47 this();
48 sfc = new SpdFileContents(inPsa);
49 init(sfc);
50 }
51
52 private void init(SpdFileContents sfc) {
53 if (sfc.getSpdPkgDefsRdOnly() != null) {
54 jComboBoxReadOnly.setSelectedItem(sfc.getSpdPkgDefsRdOnly());
55 }
56 if (sfc.getSpdPkgDefsRePkg() != null) {
57 jComboBoxRePackage.setSelectedItem(sfc.getSpdPkgDefsRePkg());
58 }
59 this.setVisible(true);
60 }
61 /**
62 * This method initializes this
63 *
64 * @return void
65 */
66 private void initialize() {
67 this.setSize(300, 200);
68 this.setTitle("Package Definitions");
69 this.setContentPane(getJContentPane());
70 }
71
72 /**
73 * This method initializes jContentPane
74 *
75 * @return javax.swing.JPanel
76 */
77 private JPanel getJContentPane() {
78 if (jContentPane == null) {
79 starLabel1 = new StarLabel();
80 starLabel1.setBounds(new java.awt.Rectangle(4,62,10,20));
81 starLabel1.setVisible(true);
82 starLabel = new StarLabel();
83 starLabel.setBounds(new java.awt.Rectangle(4,22,10,20));
84 jLabel1 = new JLabel();
85 jLabel1.setPreferredSize(new java.awt.Dimension(65,20));
86 jLabel1.setLocation(new java.awt.Point(22,62));
87 jLabel1.setSize(new java.awt.Dimension(65,20));
88 jLabel1.setText("RePackage");
89 jLabel = new JLabel();
90 jLabel.setPreferredSize(new java.awt.Dimension(57,20));
91 jLabel.setLocation(new java.awt.Point(22,22));
92 jLabel.setSize(new java.awt.Dimension(57,20));
93 jLabel.setText("Read Only");
94 jContentPane = new JPanel();
95 jContentPane.setLayout(null);
96 jContentPane.add(jLabel, null);
97 jContentPane.add(getJComboBox(), null);
98 jContentPane.add(jLabel1, null);
99 jContentPane.add(getJComboBox1(), null);
100 jContentPane.add(starLabel, null);
101 jContentPane.add(starLabel1, null);
102 }
103 return jContentPane;
104 }
105
106 /**
107 * This method initializes jComboBox
108 *
109 * @return javax.swing.JComboBox
110 */
111 private JComboBox getJComboBox() {
112 if (jComboBoxReadOnly == null) {
113 jComboBoxReadOnly = new JComboBox();
114 jComboBoxReadOnly.setBounds(new java.awt.Rectangle(95,22,117,20));
115 jComboBoxReadOnly.setPreferredSize(new Dimension(80, 20));
116 jComboBoxReadOnly.addItem("TRUE");
117 jComboBoxReadOnly.addItem("FALSE");
118 jComboBoxReadOnly.setSelectedIndex(1);
119 jComboBoxReadOnly.addItemListener(new java.awt.event.ItemListener() {
120 public void itemStateChanged(java.awt.event.ItemEvent e) {
121 sfc.setSpdPkgDefsRdOnly(jComboBoxReadOnly.getSelectedItem()+"");
122 }
123 });
124 }
125 return jComboBoxReadOnly;
126 }
127
128 /**
129 * This method initializes jComboBox1
130 *
131 * @return javax.swing.JComboBox
132 */
133 private JComboBox getJComboBox1() {
134 if (jComboBoxRePackage == null) {
135 jComboBoxRePackage = new JComboBox();
136 jComboBoxRePackage.setBounds(new java.awt.Rectangle(95,62,116,20));
137 jComboBoxRePackage.setPreferredSize(new Dimension(80, 20));
138 jComboBoxRePackage.addItem("FALSE");
139 jComboBoxRePackage.addItem("TRUE");
140 jComboBoxRePackage.setSelectedIndex(0);
141 jComboBoxRePackage.addItemListener(new java.awt.event.ItemListener() {
142 public void itemStateChanged(java.awt.event.ItemEvent e) {
143 sfc.setSpdPkgDefsRePkg(jComboBoxRePackage.getSelectedItem()+"");
144 }
145 });
146 }
147 return jComboBoxRePackage;
148 }
149
150 }