]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java
Reverted back to Old style not using the library and fixed the code to do PE32 and...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / ui / ArchCheckBox.java
CommitLineData
06a19cee 1/** @file\r
2 \r
3 The file is used to provid 6 kinds of arch in one jpanel \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\r
16package org.tianocore.frameworkwizard.common.ui;\r
17\r
18import java.util.Vector;\r
19\r
20import javax.swing.JPanel;\r
21import javax.swing.JCheckBox;\r
22\r
55a2762d 23import org.tianocore.frameworkwizard.common.DataType;\r
24\r
06a19cee 25public class ArchCheckBox extends JPanel {\r
26\r
27 ///\r
28 ///\r
29 ///\r
30 private static final long serialVersionUID = 4792669775676953990L;\r
31\r
32 private JCheckBox jCheckBoxIa32 = null;\r
33\r
34 private JCheckBox jCheckBoxX64 = null;\r
35\r
36 private JCheckBox jCheckBoxIpf = null;\r
37\r
38 private JCheckBox jCheckBoxEbc = null;\r
39\r
40 private JCheckBox jCheckBoxArm = null;\r
41\r
42 private JCheckBox jCheckBoxPpc = null;\r
43\r
44 /**\r
45 * This method initializes jCheckBoxIa32 \r
46 * \r
47 * @return javax.swing.JCheckBox \r
48 */\r
49 private JCheckBox getJCheckBoxIa32() {\r
50 if (jCheckBoxIa32 == null) {\r
51 jCheckBoxIa32 = new JCheckBox();\r
52 jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 50, 20));\r
53 jCheckBoxIa32.setText("IA32");\r
55a2762d 54 jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
06a19cee 55 }\r
56 return jCheckBoxIa32;\r
57 }\r
58\r
59 /**\r
60 * This method initializes jCheckBoxX64 \r
61 * \r
62 * @return javax.swing.JCheckBox \r
63 */\r
64 private JCheckBox getJCheckBoxX64() {\r
65 if (jCheckBoxX64 == null) {\r
66 jCheckBoxX64 = new JCheckBox();\r
67 jCheckBoxX64.setBounds(new java.awt.Rectangle(50, 0, 50, 20));\r
68 jCheckBoxX64.setText("X64");\r
55a2762d 69 jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
06a19cee 70 }\r
71 return jCheckBoxX64;\r
72 }\r
73\r
74 /**\r
75 * This method initializes jCheckBoxIpf \r
76 * \r
77 * @return javax.swing.JCheckBox \r
78 */\r
79 private JCheckBox getJCheckBoxIpf() {\r
80 if (jCheckBoxIpf == null) {\r
81 jCheckBoxIpf = new JCheckBox();\r
82 jCheckBoxIpf.setBounds(new java.awt.Rectangle(100, 0, 50, 20));\r
83 jCheckBoxIpf.setText("IPF");\r
55a2762d 84 jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
06a19cee 85 }\r
86 return jCheckBoxIpf;\r
87 }\r
88\r
89 /**\r
90 * This method initializes jCheckBoxEbc \r
91 * \r
92 * @return javax.swing.JCheckBox \r
93 */\r
94 private JCheckBox getJCheckBoxEbc() {\r
95 if (jCheckBoxEbc == null) {\r
96 jCheckBoxEbc = new JCheckBox();\r
97 jCheckBoxEbc.setBounds(new java.awt.Rectangle(150, 0, 50, 20));\r
98 jCheckBoxEbc.setText("EBC");\r
55a2762d 99 jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
06a19cee 100 }\r
101 return jCheckBoxEbc;\r
102 }\r
103\r
104 /**\r
105 * This method initializes jCheckBoxArm \r
106 * \r
107 * @return javax.swing.JCheckBox \r
108 */\r
109 private JCheckBox getJCheckBoxArm() {\r
110 if (jCheckBoxArm == null) {\r
111 jCheckBoxArm = new JCheckBox();\r
112 jCheckBoxArm.setBounds(new java.awt.Rectangle(200, 0, 55, 20));\r
113 jCheckBoxArm.setText("ARM");\r
55a2762d 114 jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
06a19cee 115 }\r
116 return jCheckBoxArm;\r
117 }\r
118\r
119 /**\r
120 * This method initializes jCheckBoxPrc \r
121 * \r
122 * @return javax.swing.JCheckBox \r
123 */\r
124 private JCheckBox getJCheckBoxPpc() {\r
125 if (jCheckBoxPpc == null) {\r
126 jCheckBoxPpc = new JCheckBox();\r
127 jCheckBoxPpc.setBounds(new java.awt.Rectangle(255, 0, 50, 20));\r
128 jCheckBoxPpc.setText("PPC");\r
55a2762d 129 jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
06a19cee 130 }\r
131 return jCheckBoxPpc;\r
132 }\r
133\r
134 /**\r
135 \r
136 @param args\r
137 \r
138 **/\r
139 public static void main(String[] args) {\r
140 // TODO Auto-generated method stub\r
141\r
142 }\r
143\r
144 /**\r
145 * This is the default constructor\r
146 */\r
147 public ArchCheckBox() {\r
148 super();\r
149 initialize();\r
150 }\r
151\r
152 /**\r
153 * This method initializes this\r
154 * \r
155 * @return void\r
156 */\r
157 private void initialize() {\r
158 this.setSize(320, 20);\r
159 this.setLayout(null);\r
160 this.add(getJCheckBoxIa32(), null);\r
161 this.add(getJCheckBoxX64(), null);\r
162 this.add(getJCheckBoxIpf(), null);\r
163 this.add(getJCheckBoxEbc(), null);\r
164 this.add(getJCheckBoxArm(), null);\r
165 this.add(getJCheckBoxPpc(), null);\r
55a2762d 166 this.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
06a19cee 167 }\r
168 \r
169 public Vector<String> getSelectedItemsVector() {\r
170 Vector<String> v = new Vector<String>();\r
171 if (this.jCheckBoxIa32.isSelected()) {\r
172 v.addElement(jCheckBoxIa32.getText());\r
173 }\r
174 if (this.jCheckBoxX64.isSelected()) {\r
175 v.addElement(jCheckBoxX64.getText());\r
176 }\r
177 if (this.jCheckBoxIpf.isSelected()) {\r
178 v.addElement(jCheckBoxIpf.getText());\r
179 }\r
180 if (this.jCheckBoxEbc.isSelected()) {\r
181 v.addElement(jCheckBoxEbc.getText());\r
182 }\r
183 if (this.jCheckBoxArm.isSelected()) {\r
184 v.addElement(jCheckBoxArm.getText());\r
185 }\r
186 if (this.jCheckBoxPpc.isSelected()) {\r
187 v.addElement(jCheckBoxPpc.getText());\r
188 }\r
189 return v;\r
190 }\r
191 \r
192 public String getSelectedItemsString() {\r
193 String s = "";\r
194 if (this.jCheckBoxIa32.isSelected()) {\r
195 s = s + jCheckBoxIa32.getText() + " ";\r
196 }\r
197 if (this.jCheckBoxX64.isSelected()) {\r
198 s = s + jCheckBoxX64.getText() + " ";\r
199 }\r
200 if (this.jCheckBoxIpf.isSelected()) {\r
201 s = s + jCheckBoxIpf.getText() + " ";\r
202 }\r
203 if (this.jCheckBoxEbc.isSelected()) {\r
204 s = s + jCheckBoxEbc.getText() + " ";\r
205 }\r
206 if (this.jCheckBoxArm.isSelected()) {\r
207 s = s + jCheckBoxArm.getText() + " ";\r
208 }\r
209 if (this.jCheckBoxPpc.isSelected()) {\r
210 s = s + jCheckBoxPpc.getText() + " ";\r
211 }\r
212 return s.trim();\r
213 }\r
214 \r
215 public void setAllItmesSelected(boolean isSelected) {\r
216 this.jCheckBoxIa32.setSelected(isSelected);\r
217 this.jCheckBoxX64.setSelected(isSelected);\r
218 this.jCheckBoxIpf.setSelected(isSelected);\r
219 this.jCheckBoxEbc.setSelected(isSelected);\r
220 this.jCheckBoxArm.setSelected(isSelected);\r
221 this.jCheckBoxPpc.setSelected(isSelected);\r
222 }\r
223 \r
224 public void setSelectedItems(Vector<String> v) {\r
225 setAllItmesSelected(false);\r
226 if (v != null) {\r
227 for (int index = 0; index < v.size(); index++) {\r
228 if (v.get(index).equals(this.jCheckBoxIa32.getText())) {\r
229 this.jCheckBoxIa32.setSelected(true);\r
230 continue;\r
231 }\r
232 if (v.get(index).equals(this.jCheckBoxIpf.getText())) {\r
233 this.jCheckBoxIpf.setSelected(true);\r
234 continue;\r
235 }\r
236 if (v.get(index).equals(this.jCheckBoxX64.getText())) {\r
237 this.jCheckBoxX64.setSelected(true);\r
238 continue;\r
239 }\r
240 if (v.get(index).equals(this.jCheckBoxEbc.getText())) {\r
241 this.jCheckBoxEbc.setSelected(true);\r
242 continue;\r
243 }\r
244 if (v.get(index).equals(this.jCheckBoxArm.getText())) {\r
245 this.jCheckBoxArm.setSelected(true);\r
246 continue;\r
247 }\r
248 if (v.get(index).equals(this.jCheckBoxPpc.getText())) {\r
249 this.jCheckBoxPpc.setSelected(true);\r
250 continue;\r
251 }\r
252 }\r
253 }\r
254 }\r
255}\r