]>
Commit | Line | Data |
---|---|---|
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 | |
15 | package org.tianocore.frameworkwizard.packaging.ui;\r | |
16 | \r | |
17 | import javax.swing.JPanel;\r | |
a13899c5 | 18 | import javax.swing.JLabel;\r |
19 | import javax.swing.JComboBox;\r | |
20 | import java.awt.Dimension;\r | |
21 | \r | |
22 | import org.tianocore.PackageSurfaceAreaDocument;\r | |
d6d24759 | 23 | import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;\r |
a13899c5 | 24 | import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r |
25 | import org.tianocore.frameworkwizard.common.ui.StarLabel;\r | |
26 | \r | |
27 | public 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 |
4da2e625 | 34 | private JLabel jLabelRdOnly = null;\r |
a13899c5 | 35 | private JComboBox jComboBoxReadOnly = null;\r |
4da2e625 | 36 | private JLabel jLabelRePkg = null;\r |
a13899c5 | 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 | |
4da2e625 | 94 | jLabelRePkg = new JLabel();\r |
95 | jLabelRePkg.setPreferredSize(new java.awt.Dimension(65,20));\r | |
96 | jLabelRePkg.setLocation(new java.awt.Point(22,62));\r | |
97 | jLabelRePkg.setSize(new java.awt.Dimension(65,20));\r | |
98 | jLabelRePkg.setText("RePackage");\r | |
99 | jLabelRdOnly = new JLabel();\r | |
100 | jLabelRdOnly.setPreferredSize(new java.awt.Dimension(57,20));\r | |
101 | jLabelRdOnly.setLocation(new java.awt.Point(22,22));\r | |
102 | jLabelRdOnly.setSize(new java.awt.Dimension(57,20));\r | |
103 | jLabelRdOnly.setText("Read Only");\r | |
a13899c5 | 104 | jContentPane = new JPanel();\r |
105 | jContentPane.setLayout(null);\r | |
4da2e625 | 106 | jContentPane.add(jLabelRdOnly, null);\r |
a13899c5 | 107 | jContentPane.add(getJComboBox(), null);\r |
4da2e625 | 108 | jContentPane.add(jLabelRePkg, null);\r |
a13899c5 | 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 | |
a490bca8 | 131 | if (jComboBoxReadOnly.getSelectedItem().equals(sfc.getSpdPkgDefsRdOnly())) {\r |
132 | return;\r | |
133 | }\r | |
f46d7c21 | 134 | if (docConsole != null) {\r |
a490bca8 | 135 | docConsole.setSaved(false);\r |
f46d7c21 | 136 | }\r |
a13899c5 | 137 | sfc.setSpdPkgDefsRdOnly(jComboBoxReadOnly.getSelectedItem()+"");\r |
138 | }\r | |
139 | });\r | |
140 | }\r | |
141 | return jComboBoxReadOnly;\r | |
142 | }\r | |
143 | \r | |
144 | /**\r | |
145 | * This method initializes jComboBox1 \r | |
146 | * \r | |
147 | * @return javax.swing.JComboBox \r | |
148 | */\r | |
149 | private JComboBox getJComboBox1() {\r | |
150 | if (jComboBoxRePackage == null) {\r | |
151 | jComboBoxRePackage = new JComboBox();\r | |
152 | jComboBoxRePackage.setBounds(new java.awt.Rectangle(95,62,116,20));\r | |
153 | jComboBoxRePackage.setPreferredSize(new Dimension(80, 20));\r | |
ce73a791 | 154 | jComboBoxRePackage.addItem("false");\r |
155 | jComboBoxRePackage.addItem("true");\r | |
a13899c5 | 156 | jComboBoxRePackage.setSelectedIndex(0);\r |
157 | jComboBoxRePackage.addItemListener(new java.awt.event.ItemListener() {\r | |
158 | public void itemStateChanged(java.awt.event.ItemEvent e) {\r | |
a490bca8 | 159 | if (jComboBoxRePackage.getSelectedItem().equals(sfc.getSpdPkgDefsRePkg())) {\r |
160 | return;\r | |
161 | }\r | |
f46d7c21 | 162 | if (docConsole != null) {\r |
60e97865 | 163 | docConsole.setSaved(false);\r |
f46d7c21 | 164 | }\r |
a13899c5 | 165 | sfc.setSpdPkgDefsRePkg(jComboBoxRePackage.getSelectedItem()+"");\r |
166 | }\r | |
167 | });\r | |
168 | }\r | |
169 | return jComboBoxRePackage;\r | |
170 | }\r | |
171 | \r | |
172 | }\r |