]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java
Changed spelling to manifest
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / ui / ArchCheckBox.java
1 /** @file
2
3 The file is used to provid 6 kinds of arch in one jpanel
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
16 package org.tianocore.frameworkwizard.common.ui;
17
18 import java.util.Vector;
19
20 import javax.swing.JCheckBox;
21 import javax.swing.JPanel;
22
23 import org.tianocore.frameworkwizard.common.DataType;
24
25 public class ArchCheckBox extends JPanel {
26
27 ///
28 /// Define class members
29 ///
30 private static final long serialVersionUID = 4792669775676953990L;
31
32 private JCheckBox jCheckBoxIa32 = null;
33
34 private JCheckBox jCheckBoxX64 = null;
35
36 private JCheckBox jCheckBoxIpf = null;
37
38 private JCheckBox jCheckBoxEbc = null;
39
40 private JCheckBox jCheckBoxArm = null;
41
42 private JCheckBox jCheckBoxPpc = null;
43
44 /**
45 * This method initializes jCheckBoxIa32
46 *
47 * @return javax.swing.JCheckBox
48 */
49 private JCheckBox getJCheckBoxIa32() {
50 if (jCheckBoxIa32 == null) {
51 jCheckBoxIa32 = new JCheckBox();
52 jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
53 jCheckBoxIa32.setText("IA32");
54 jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
55 }
56 return jCheckBoxIa32;
57 }
58
59 /**
60 * This method initializes jCheckBoxX64
61 *
62 * @return javax.swing.JCheckBox
63 */
64 private JCheckBox getJCheckBoxX64() {
65 if (jCheckBoxX64 == null) {
66 jCheckBoxX64 = new JCheckBox();
67 jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
68 jCheckBoxX64.setText("X64");
69 jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
70 }
71 return jCheckBoxX64;
72 }
73
74 /**
75 * This method initializes jCheckBoxIpf
76 *
77 * @return javax.swing.JCheckBox
78 */
79 private JCheckBox getJCheckBoxIpf() {
80 if (jCheckBoxIpf == null) {
81 jCheckBoxIpf = new JCheckBox();
82 jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
83 jCheckBoxIpf.setText("IPF");
84 jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
85 }
86 return jCheckBoxIpf;
87 }
88
89 /**
90 * This method initializes jCheckBoxEbc
91 *
92 * @return javax.swing.JCheckBox
93 */
94 private JCheckBox getJCheckBoxEbc() {
95 if (jCheckBoxEbc == null) {
96 jCheckBoxEbc = new JCheckBox();
97 jCheckBoxEbc.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
98 jCheckBoxEbc.setText("EBC");
99 jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
100 }
101 return jCheckBoxEbc;
102 }
103
104 /**
105 * This method initializes jCheckBoxArm
106 *
107 * @return javax.swing.JCheckBox
108 */
109 private JCheckBox getJCheckBoxArm() {
110 if (jCheckBoxArm == null) {
111 jCheckBoxArm = new JCheckBox();
112 jCheckBoxArm.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
113 jCheckBoxArm.setText("ARM");
114 jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
115 }
116 return jCheckBoxArm;
117 }
118
119 /**
120 * This method initializes jCheckBoxPpc
121 *
122 * @return javax.swing.JCheckBox
123 */
124 private JCheckBox getJCheckBoxPpc() {
125 if (jCheckBoxPpc == null) {
126 jCheckBoxPpc = new JCheckBox();
127 jCheckBoxPpc.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
128 jCheckBoxPpc.setText("PPC");
129 jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
130 }
131 return jCheckBoxPpc;
132 }
133
134 /**
135 * This is the default constructor
136 */
137 public ArchCheckBox() {
138 super();
139 initialize();
140 }
141
142 /**
143 * This method initializes this
144 *
145 * @return void
146 */
147 private void initialize() {
148 this.setSize(320, 20);
149 this.setLayout(null);
150 this.add(getJCheckBoxIa32(), null);
151 this.add(getJCheckBoxX64(), null);
152 this.add(getJCheckBoxIpf(), null);
153 this.add(getJCheckBoxEbc(), null);
154 this.add(getJCheckBoxArm(), null);
155 this.add(getJCheckBoxPpc(), null);
156 this.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
157 }
158
159 public Vector<String> getSelectedItemsVector() {
160 Vector<String> v = new Vector<String>();
161 if (this.jCheckBoxIa32.isSelected() && this.jCheckBoxIa32.isEnabled()) {
162 v.addElement(jCheckBoxIa32.getText());
163 }
164 if (this.jCheckBoxX64.isSelected() && this.jCheckBoxX64.isEnabled()) {
165 v.addElement(jCheckBoxX64.getText());
166 }
167 if (this.jCheckBoxIpf.isSelected() && this.jCheckBoxIpf.isEnabled()) {
168 v.addElement(jCheckBoxIpf.getText());
169 }
170 if (this.jCheckBoxEbc.isSelected() && this.jCheckBoxEbc.isEnabled()) {
171 v.addElement(jCheckBoxEbc.getText());
172 }
173 if (this.jCheckBoxArm.isSelected() && this.jCheckBoxArm.isEnabled()) {
174 v.addElement(jCheckBoxArm.getText());
175 }
176 if (this.jCheckBoxPpc.isSelected() && this.jCheckBoxPpc.isEnabled()) {
177 v.addElement(jCheckBoxPpc.getText());
178 }
179 return v;
180 }
181
182 public String getSelectedItemsString() {
183 String s = "";
184 if (this.jCheckBoxIa32.isSelected() && this.jCheckBoxIa32.isEnabled()) {
185 s = s + jCheckBoxIa32.getText() + " ";
186 }
187 if (this.jCheckBoxX64.isSelected() && this.jCheckBoxX64.isEnabled()) {
188 s = s + jCheckBoxX64.getText() + " ";
189 }
190 if (this.jCheckBoxIpf.isSelected() && this.jCheckBoxIpf.isEnabled()) {
191 s = s + jCheckBoxIpf.getText() + " ";
192 }
193 if (this.jCheckBoxEbc.isSelected() && this.jCheckBoxEbc.isEnabled()) {
194 s = s + jCheckBoxEbc.getText() + " ";
195 }
196 if (this.jCheckBoxArm.isSelected() && this.jCheckBoxArm.isEnabled()) {
197 s = s + jCheckBoxArm.getText() + " ";
198 }
199 if (this.jCheckBoxPpc.isSelected() && this.jCheckBoxPpc.isEnabled()) {
200 s = s + jCheckBoxPpc.getText() + " ";
201 }
202 return s.trim();
203 }
204
205 public void setAllItemsSelected(boolean isSelected) {
206 this.jCheckBoxIa32.setSelected(isSelected);
207 this.jCheckBoxX64.setSelected(isSelected);
208 this.jCheckBoxIpf.setSelected(isSelected);
209 this.jCheckBoxEbc.setSelected(isSelected);
210 this.jCheckBoxArm.setSelected(isSelected);
211 this.jCheckBoxPpc.setSelected(isSelected);
212 }
213
214 public void setSelectedItems(Vector<String> v) {
215 setAllItemsSelected(false);
216 if (v != null) {
217 for (int index = 0; index < v.size(); index++) {
218 if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
219 this.jCheckBoxIa32.setSelected(true);
220 continue;
221 }
222 if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
223 this.jCheckBoxIpf.setSelected(true);
224 continue;
225 }
226 if (v.get(index).equals(this.jCheckBoxX64.getText())) {
227 this.jCheckBoxX64.setSelected(true);
228 continue;
229 }
230 if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
231 this.jCheckBoxEbc.setSelected(true);
232 continue;
233 }
234 if (v.get(index).equals(this.jCheckBoxArm.getText())) {
235 this.jCheckBoxArm.setSelected(true);
236 continue;
237 }
238 if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
239 this.jCheckBoxPpc.setSelected(true);
240 continue;
241 }
242 }
243 }
244 }
245
246 public void setAllItemsEnabled(boolean isEnabled) {
247 this.jCheckBoxIa32.setEnabled(isEnabled);
248 this.jCheckBoxX64.setEnabled(isEnabled);
249 this.jCheckBoxIpf.setEnabled(isEnabled);
250 this.jCheckBoxEbc.setEnabled(isEnabled);
251 this.jCheckBoxArm.setEnabled(isEnabled);
252 this.jCheckBoxPpc.setEnabled(isEnabled);
253 }
254
255 public void setEnabledItems(Vector<String> v) {
256 setAllItemsEnabled(false);
257 if (v != null) {
258 for (int index = 0; index < v.size(); index++) {
259 if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
260 this.jCheckBoxIa32.setEnabled(true);
261 continue;
262 }
263 if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
264 this.jCheckBoxIpf.setEnabled(true);
265 continue;
266 }
267 if (v.get(index).equals(this.jCheckBoxX64.getText())) {
268 this.jCheckBoxX64.setEnabled(true);
269 continue;
270 }
271 if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
272 this.jCheckBoxEbc.setEnabled(true);
273 continue;
274 }
275 if (v.get(index).equals(this.jCheckBoxArm.getText())) {
276 this.jCheckBoxArm.setEnabled(true);
277 continue;
278 }
279 if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
280 this.jCheckBoxPpc.setEnabled(true);
281 continue;
282 }
283 }
284 }
285 }
286
287 public void setDisabledItems(Vector<String> v) {
288 setAllItemsEnabled(true);
289 if (v != null) {
290 for (int index = 0; index < v.size(); index++) {
291 if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
292 this.jCheckBoxIa32.setEnabled(false);
293 continue;
294 }
295 if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
296 this.jCheckBoxIpf.setEnabled(false);
297 continue;
298 }
299 if (v.get(index).equals(this.jCheckBoxX64.getText())) {
300 this.jCheckBoxX64.setEnabled(false);
301 continue;
302 }
303 if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
304 this.jCheckBoxEbc.setEnabled(false);
305 continue;
306 }
307 if (v.get(index).equals(this.jCheckBoxArm.getText())) {
308 this.jCheckBoxArm.setEnabled(false);
309 continue;
310 }
311 if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
312 this.jCheckBoxPpc.setEnabled(false);
313 continue;
314 }
315 }
316 }
317 }
318 }