]>
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 import org
.tianocore
.frameworkwizard
.common
.DataType
;
25 public class ArchCheckBox
extends JPanel
{
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, 50, 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(50, 0, 50, 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(100, 0, 50, 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(150, 0, 50, 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(200, 0, 55, 20));
113 jCheckBoxArm
.setText("ARM");
114 jCheckBoxArm
.setToolTipText(DataType
.SUP_ARCH_LIST_HELP_TEXT
);
120 * This method initializes jCheckBoxPrc
122 * @return javax.swing.JCheckBox
124 private JCheckBox
getJCheckBoxPpc() {
125 if (jCheckBoxPpc
== null) {
126 jCheckBoxPpc
= new JCheckBox();
127 jCheckBoxPpc
.setBounds(new java
.awt
.Rectangle(255, 0, 50, 20));
128 jCheckBoxPpc
.setText("PPC");
129 jCheckBoxPpc
.setToolTipText(DataType
.SUP_ARCH_LIST_HELP_TEXT
);
139 public static void main(String
[] args
) {
140 // TODO Auto-generated method stub
145 * This is the default constructor
147 public ArchCheckBox() {
153 * This method initializes this
157 private void initialize() {
158 this.setSize(320, 20);
159 this.setLayout(null);
160 this.add(getJCheckBoxIa32(), null);
161 this.add(getJCheckBoxX64(), null);
162 this.add(getJCheckBoxIpf(), null);
163 this.add(getJCheckBoxEbc(), null);
164 this.add(getJCheckBoxArm(), null);
165 this.add(getJCheckBoxPpc(), null);
166 this.setToolTipText(DataType
.SUP_ARCH_LIST_HELP_TEXT
);
169 public Vector
<String
> getSelectedItemsVector() {
170 Vector
<String
> v
= new Vector
<String
>();
171 if (this.jCheckBoxIa32
.isSelected()) {
172 v
.addElement(jCheckBoxIa32
.getText());
174 if (this.jCheckBoxX64
.isSelected()) {
175 v
.addElement(jCheckBoxX64
.getText());
177 if (this.jCheckBoxIpf
.isSelected()) {
178 v
.addElement(jCheckBoxIpf
.getText());
180 if (this.jCheckBoxEbc
.isSelected()) {
181 v
.addElement(jCheckBoxEbc
.getText());
183 if (this.jCheckBoxArm
.isSelected()) {
184 v
.addElement(jCheckBoxArm
.getText());
186 if (this.jCheckBoxPpc
.isSelected()) {
187 v
.addElement(jCheckBoxPpc
.getText());
192 public String
getSelectedItemsString() {
194 if (this.jCheckBoxIa32
.isSelected()) {
195 s
= s
+ jCheckBoxIa32
.getText() + " ";
197 if (this.jCheckBoxX64
.isSelected()) {
198 s
= s
+ jCheckBoxX64
.getText() + " ";
200 if (this.jCheckBoxIpf
.isSelected()) {
201 s
= s
+ jCheckBoxIpf
.getText() + " ";
203 if (this.jCheckBoxEbc
.isSelected()) {
204 s
= s
+ jCheckBoxEbc
.getText() + " ";
206 if (this.jCheckBoxArm
.isSelected()) {
207 s
= s
+ jCheckBoxArm
.getText() + " ";
209 if (this.jCheckBoxPpc
.isSelected()) {
210 s
= s
+ jCheckBoxPpc
.getText() + " ";
215 public void setAllItmesSelected(boolean isSelected
) {
216 this.jCheckBoxIa32
.setSelected(isSelected
);
217 this.jCheckBoxX64
.setSelected(isSelected
);
218 this.jCheckBoxIpf
.setSelected(isSelected
);
219 this.jCheckBoxEbc
.setSelected(isSelected
);
220 this.jCheckBoxArm
.setSelected(isSelected
);
221 this.jCheckBoxPpc
.setSelected(isSelected
);
224 public void setSelectedItems(Vector
<String
> v
) {
225 setAllItmesSelected(false);
227 for (int index
= 0; index
< v
.size(); index
++) {
228 if (v
.get(index
).equals(this.jCheckBoxIa32
.getText())) {
229 this.jCheckBoxIa32
.setSelected(true);
232 if (v
.get(index
).equals(this.jCheckBoxIpf
.getText())) {
233 this.jCheckBoxIpf
.setSelected(true);
236 if (v
.get(index
).equals(this.jCheckBoxX64
.getText())) {
237 this.jCheckBoxX64
.setSelected(true);
240 if (v
.get(index
).equals(this.jCheckBoxEbc
.getText())) {
241 this.jCheckBoxEbc
.setSelected(true);
244 if (v
.get(index
).equals(this.jCheckBoxArm
.getText())) {
245 this.jCheckBoxArm
.setSelected(true);
248 if (v
.get(index
).equals(this.jCheckBoxPpc
.getText())) {
249 this.jCheckBoxPpc
.setSelected(true);