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