]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/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
.JPanel
;
21 import javax
.swing
.JCheckBox
;
23 public class ArchCheckBox
extends JPanel
{
28 private static final long serialVersionUID
= 4792669775676953990L;
30 private JCheckBox jCheckBoxIa32
= null;
32 private JCheckBox jCheckBoxX64
= null;
34 private JCheckBox jCheckBoxIpf
= null;
36 private JCheckBox jCheckBoxEbc
= null;
38 private JCheckBox jCheckBoxArm
= null;
40 private JCheckBox jCheckBoxPpc
= null;
43 * This method initializes jCheckBoxIa32
45 * @return javax.swing.JCheckBox
47 private JCheckBox
getJCheckBoxIa32() {
48 if (jCheckBoxIa32
== null) {
49 jCheckBoxIa32
= new JCheckBox();
50 jCheckBoxIa32
.setBounds(new java
.awt
.Rectangle(0, 0, 50, 20));
51 jCheckBoxIa32
.setText("IA32");
57 * This method initializes jCheckBoxX64
59 * @return javax.swing.JCheckBox
61 private JCheckBox
getJCheckBoxX64() {
62 if (jCheckBoxX64
== null) {
63 jCheckBoxX64
= new JCheckBox();
64 jCheckBoxX64
.setBounds(new java
.awt
.Rectangle(50, 0, 50, 20));
65 jCheckBoxX64
.setText("X64");
71 * This method initializes jCheckBoxIpf
73 * @return javax.swing.JCheckBox
75 private JCheckBox
getJCheckBoxIpf() {
76 if (jCheckBoxIpf
== null) {
77 jCheckBoxIpf
= new JCheckBox();
78 jCheckBoxIpf
.setBounds(new java
.awt
.Rectangle(100, 0, 50, 20));
79 jCheckBoxIpf
.setText("IPF");
85 * This method initializes jCheckBoxEbc
87 * @return javax.swing.JCheckBox
89 private JCheckBox
getJCheckBoxEbc() {
90 if (jCheckBoxEbc
== null) {
91 jCheckBoxEbc
= new JCheckBox();
92 jCheckBoxEbc
.setBounds(new java
.awt
.Rectangle(150, 0, 50, 20));
93 jCheckBoxEbc
.setText("EBC");
99 * This method initializes jCheckBoxArm
101 * @return javax.swing.JCheckBox
103 private JCheckBox
getJCheckBoxArm() {
104 if (jCheckBoxArm
== null) {
105 jCheckBoxArm
= new JCheckBox();
106 jCheckBoxArm
.setBounds(new java
.awt
.Rectangle(200, 0, 55, 20));
107 jCheckBoxArm
.setText("ARM");
113 * This method initializes jCheckBoxPrc
115 * @return javax.swing.JCheckBox
117 private JCheckBox
getJCheckBoxPpc() {
118 if (jCheckBoxPpc
== null) {
119 jCheckBoxPpc
= new JCheckBox();
120 jCheckBoxPpc
.setBounds(new java
.awt
.Rectangle(255, 0, 50, 20));
121 jCheckBoxPpc
.setText("PPC");
131 public static void main(String
[] args
) {
132 // TODO Auto-generated method stub
137 * This is the default constructor
139 public ArchCheckBox() {
145 * This method initializes this
149 private void initialize() {
150 this.setSize(320, 20);
151 this.setLayout(null);
152 this.add(getJCheckBoxIa32(), null);
153 this.add(getJCheckBoxX64(), null);
154 this.add(getJCheckBoxIpf(), null);
155 this.add(getJCheckBoxEbc(), null);
156 this.add(getJCheckBoxArm(), null);
157 this.add(getJCheckBoxPpc(), null);
160 public Vector
<String
> getSelectedItemsVector() {
161 Vector
<String
> v
= new Vector
<String
>();
162 if (this.jCheckBoxIa32
.isSelected()) {
163 v
.addElement(jCheckBoxIa32
.getText());
165 if (this.jCheckBoxX64
.isSelected()) {
166 v
.addElement(jCheckBoxX64
.getText());
168 if (this.jCheckBoxIpf
.isSelected()) {
169 v
.addElement(jCheckBoxIpf
.getText());
171 if (this.jCheckBoxEbc
.isSelected()) {
172 v
.addElement(jCheckBoxEbc
.getText());
174 if (this.jCheckBoxArm
.isSelected()) {
175 v
.addElement(jCheckBoxArm
.getText());
177 if (this.jCheckBoxPpc
.isSelected()) {
178 v
.addElement(jCheckBoxPpc
.getText());
183 public String
getSelectedItemsString() {
185 if (this.jCheckBoxIa32
.isSelected()) {
186 s
= s
+ jCheckBoxIa32
.getText() + " ";
188 if (this.jCheckBoxX64
.isSelected()) {
189 s
= s
+ jCheckBoxX64
.getText() + " ";
191 if (this.jCheckBoxIpf
.isSelected()) {
192 s
= s
+ jCheckBoxIpf
.getText() + " ";
194 if (this.jCheckBoxEbc
.isSelected()) {
195 s
= s
+ jCheckBoxEbc
.getText() + " ";
197 if (this.jCheckBoxArm
.isSelected()) {
198 s
= s
+ jCheckBoxArm
.getText() + " ";
200 if (this.jCheckBoxPpc
.isSelected()) {
201 s
= s
+ jCheckBoxPpc
.getText() + " ";
206 public void setAllItmesSelected(boolean isSelected
) {
207 this.jCheckBoxIa32
.setSelected(isSelected
);
208 this.jCheckBoxX64
.setSelected(isSelected
);
209 this.jCheckBoxIpf
.setSelected(isSelected
);
210 this.jCheckBoxEbc
.setSelected(isSelected
);
211 this.jCheckBoxArm
.setSelected(isSelected
);
212 this.jCheckBoxPpc
.setSelected(isSelected
);
215 public void setSelectedItems(Vector
<String
> v
) {
216 setAllItmesSelected(false);
218 for (int index
= 0; index
< v
.size(); index
++) {
219 if (v
.get(index
).equals(this.jCheckBoxIa32
.getText())) {
220 this.jCheckBoxIa32
.setSelected(true);
223 if (v
.get(index
).equals(this.jCheckBoxIpf
.getText())) {
224 this.jCheckBoxIpf
.setSelected(true);
227 if (v
.get(index
).equals(this.jCheckBoxX64
.getText())) {
228 this.jCheckBoxX64
.setSelected(true);
231 if (v
.get(index
).equals(this.jCheckBoxEbc
.getText())) {
232 this.jCheckBoxEbc
.setSelected(true);
235 if (v
.get(index
).equals(this.jCheckBoxArm
.getText())) {
236 this.jCheckBoxArm
.setSelected(true);
239 if (v
.get(index
).equals(this.jCheckBoxPpc
.getText())) {
240 this.jCheckBoxPpc
.setSelected(true);