]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java
3 The file is used to provid 6 kinds of arch in one jpanel
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
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.
16 package org
.tianocore
.frameworkwizard
.common
.ui
;
18 import java
.util
.Vector
;
20 import javax
.swing
.JCheckBox
;
21 import javax
.swing
.JPanel
;
23 import org
.tianocore
.frameworkwizard
.common
.DataType
;
25 public class ArchCheckBox
extends JPanel
{
28 /// Define class members
30 private static final long serialVersionUID
= 4792669775676953990L;
32 private JCheckBox jCheckBoxIa32
= null;
34 private JCheckBox jCheckBoxX64
= null;
36 private JCheckBox jCheckBoxIpf
= null;
38 private JCheckBox jCheckBoxEbc
= null;
40 private JCheckBox jCheckBoxArm
= null;
42 private JCheckBox jCheckBoxPpc
= null;
45 * This method initializes jCheckBoxIa32
47 * @return javax.swing.JCheckBox
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
);
60 * This method initializes jCheckBoxX64
62 * @return javax.swing.JCheckBox
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
);
75 * This method initializes jCheckBoxIpf
77 * @return javax.swing.JCheckBox
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
);
90 * This method initializes jCheckBoxEbc
92 * @return javax.swing.JCheckBox
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
);
105 * This method initializes jCheckBoxArm
107 * @return javax.swing.JCheckBox
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
);
120 * This method initializes jCheckBoxPpc
122 * @return javax.swing.JCheckBox
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
);
135 * This is the default constructor
137 public ArchCheckBox() {
143 * This method initializes this
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
);
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());
164 if (this.jCheckBoxX64
.isSelected() && this.jCheckBoxX64
.isEnabled()) {
165 v
.addElement(jCheckBoxX64
.getText());
167 if (this.jCheckBoxIpf
.isSelected() && this.jCheckBoxIpf
.isEnabled()) {
168 v
.addElement(jCheckBoxIpf
.getText());
170 if (this.jCheckBoxEbc
.isSelected() && this.jCheckBoxEbc
.isEnabled()) {
171 v
.addElement(jCheckBoxEbc
.getText());
173 if (this.jCheckBoxArm
.isSelected() && this.jCheckBoxArm
.isEnabled()) {
174 v
.addElement(jCheckBoxArm
.getText());
176 if (this.jCheckBoxPpc
.isSelected() && this.jCheckBoxPpc
.isEnabled()) {
177 v
.addElement(jCheckBoxPpc
.getText());
182 public String
getSelectedItemsString() {
184 if (this.jCheckBoxIa32
.isSelected() && this.jCheckBoxIa32
.isEnabled()) {
185 s
= s
+ jCheckBoxIa32
.getText() + " ";
187 if (this.jCheckBoxX64
.isSelected() && this.jCheckBoxX64
.isEnabled()) {
188 s
= s
+ jCheckBoxX64
.getText() + " ";
190 if (this.jCheckBoxIpf
.isSelected() && this.jCheckBoxIpf
.isEnabled()) {
191 s
= s
+ jCheckBoxIpf
.getText() + " ";
193 if (this.jCheckBoxEbc
.isSelected() && this.jCheckBoxEbc
.isEnabled()) {
194 s
= s
+ jCheckBoxEbc
.getText() + " ";
196 if (this.jCheckBoxArm
.isSelected() && this.jCheckBoxArm
.isEnabled()) {
197 s
= s
+ jCheckBoxArm
.getText() + " ";
199 if (this.jCheckBoxPpc
.isSelected() && this.jCheckBoxPpc
.isEnabled()) {
200 s
= s
+ jCheckBoxPpc
.getText() + " ";
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
);
214 public void setSelectedItems(Vector
<String
> v
) {
215 setAllItemsSelected(false);
217 for (int index
= 0; index
< v
.size(); index
++) {
218 if (v
.get(index
).equals(this.jCheckBoxIa32
.getText())) {
219 this.jCheckBoxIa32
.setSelected(true);
222 if (v
.get(index
).equals(this.jCheckBoxIpf
.getText())) {
223 this.jCheckBoxIpf
.setSelected(true);
226 if (v
.get(index
).equals(this.jCheckBoxX64
.getText())) {
227 this.jCheckBoxX64
.setSelected(true);
230 if (v
.get(index
).equals(this.jCheckBoxEbc
.getText())) {
231 this.jCheckBoxEbc
.setSelected(true);
234 if (v
.get(index
).equals(this.jCheckBoxArm
.getText())) {
235 this.jCheckBoxArm
.setSelected(true);
238 if (v
.get(index
).equals(this.jCheckBoxPpc
.getText())) {
239 this.jCheckBoxPpc
.setSelected(true);
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
);
255 public void setEnabledItems(Vector
<String
> v
) {
256 setAllItemsEnabled(false);
258 for (int index
= 0; index
< v
.size(); index
++) {
259 if (v
.get(index
).equals(this.jCheckBoxIa32
.getText())) {
260 this.jCheckBoxIa32
.setEnabled(true);
263 if (v
.get(index
).equals(this.jCheckBoxIpf
.getText())) {
264 this.jCheckBoxIpf
.setEnabled(true);
267 if (v
.get(index
).equals(this.jCheckBoxX64
.getText())) {
268 this.jCheckBoxX64
.setEnabled(true);
271 if (v
.get(index
).equals(this.jCheckBoxEbc
.getText())) {
272 this.jCheckBoxEbc
.setEnabled(true);
275 if (v
.get(index
).equals(this.jCheckBoxArm
.getText())) {
276 this.jCheckBoxArm
.setEnabled(true);
279 if (v
.get(index
).equals(this.jCheckBoxPpc
.getText())) {
280 this.jCheckBoxPpc
.setEnabled(true);
287 public void setDisabledItems(Vector
<String
> v
) {
288 setAllItemsEnabled(true);
290 for (int index
= 0; index
< v
.size(); index
++) {
291 if (v
.get(index
).equals(this.jCheckBoxIa32
.getText())) {
292 this.jCheckBoxIa32
.setEnabled(false);
295 if (v
.get(index
).equals(this.jCheckBoxIpf
.getText())) {
296 this.jCheckBoxIpf
.setEnabled(false);
299 if (v
.get(index
).equals(this.jCheckBoxX64
.getText())) {
300 this.jCheckBoxX64
.setEnabled(false);
303 if (v
.get(index
).equals(this.jCheckBoxEbc
.getText())) {
304 this.jCheckBoxEbc
.setEnabled(false);
307 if (v
.get(index
).equals(this.jCheckBoxArm
.getText())) {
308 this.jCheckBoxArm
.setEnabled(false);
311 if (v
.get(index
).equals(this.jCheckBoxPpc
.getText())) {
312 this.jCheckBoxPpc
.setEnabled(false);