]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java
e564ab5effb568b2d97d9e7749e9ad3c3d38c971
[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.JPanel;
21 import javax.swing.JCheckBox;
22
23 public class ArchCheckBox extends JPanel {
24
25 ///
26 ///
27 ///
28 private static final long serialVersionUID = 4792669775676953990L;
29
30 private JCheckBox jCheckBoxIa32 = null;
31
32 private JCheckBox jCheckBoxX64 = null;
33
34 private JCheckBox jCheckBoxIpf = null;
35
36 private JCheckBox jCheckBoxEbc = null;
37
38 private JCheckBox jCheckBoxArm = null;
39
40 private JCheckBox jCheckBoxPpc = null;
41
42 /**
43 * This method initializes jCheckBoxIa32
44 *
45 * @return javax.swing.JCheckBox
46 */
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");
52 }
53 return jCheckBoxIa32;
54 }
55
56 /**
57 * This method initializes jCheckBoxX64
58 *
59 * @return javax.swing.JCheckBox
60 */
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");
66 }
67 return jCheckBoxX64;
68 }
69
70 /**
71 * This method initializes jCheckBoxIpf
72 *
73 * @return javax.swing.JCheckBox
74 */
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");
80 }
81 return jCheckBoxIpf;
82 }
83
84 /**
85 * This method initializes jCheckBoxEbc
86 *
87 * @return javax.swing.JCheckBox
88 */
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");
94 }
95 return jCheckBoxEbc;
96 }
97
98 /**
99 * This method initializes jCheckBoxArm
100 *
101 * @return javax.swing.JCheckBox
102 */
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");
108 }
109 return jCheckBoxArm;
110 }
111
112 /**
113 * This method initializes jCheckBoxPrc
114 *
115 * @return javax.swing.JCheckBox
116 */
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");
122 }
123 return jCheckBoxPpc;
124 }
125
126 /**
127
128 @param args
129
130 **/
131 public static void main(String[] args) {
132 // TODO Auto-generated method stub
133
134 }
135
136 /**
137 * This is the default constructor
138 */
139 public ArchCheckBox() {
140 super();
141 initialize();
142 }
143
144 /**
145 * This method initializes this
146 *
147 * @return void
148 */
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);
158 }
159
160 public Vector<String> getSelectedItemsVector() {
161 Vector<String> v = new Vector<String>();
162 if (this.jCheckBoxIa32.isSelected()) {
163 v.addElement(jCheckBoxIa32.getText());
164 }
165 if (this.jCheckBoxX64.isSelected()) {
166 v.addElement(jCheckBoxX64.getText());
167 }
168 if (this.jCheckBoxIpf.isSelected()) {
169 v.addElement(jCheckBoxIpf.getText());
170 }
171 if (this.jCheckBoxEbc.isSelected()) {
172 v.addElement(jCheckBoxEbc.getText());
173 }
174 if (this.jCheckBoxArm.isSelected()) {
175 v.addElement(jCheckBoxArm.getText());
176 }
177 if (this.jCheckBoxPpc.isSelected()) {
178 v.addElement(jCheckBoxPpc.getText());
179 }
180 return v;
181 }
182
183 public String getSelectedItemsString() {
184 String s = "";
185 if (this.jCheckBoxIa32.isSelected()) {
186 s = s + jCheckBoxIa32.getText() + " ";
187 }
188 if (this.jCheckBoxX64.isSelected()) {
189 s = s + jCheckBoxX64.getText() + " ";
190 }
191 if (this.jCheckBoxIpf.isSelected()) {
192 s = s + jCheckBoxIpf.getText() + " ";
193 }
194 if (this.jCheckBoxEbc.isSelected()) {
195 s = s + jCheckBoxEbc.getText() + " ";
196 }
197 if (this.jCheckBoxArm.isSelected()) {
198 s = s + jCheckBoxArm.getText() + " ";
199 }
200 if (this.jCheckBoxPpc.isSelected()) {
201 s = s + jCheckBoxPpc.getText() + " ";
202 }
203 return s.trim();
204 }
205
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);
213 }
214
215 public void setSelectedItems(Vector<String> v) {
216 setAllItmesSelected(false);
217 if (v != null) {
218 for (int index = 0; index < v.size(); index++) {
219 if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
220 this.jCheckBoxIa32.setSelected(true);
221 continue;
222 }
223 if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
224 this.jCheckBoxIpf.setSelected(true);
225 continue;
226 }
227 if (v.get(index).equals(this.jCheckBoxX64.getText())) {
228 this.jCheckBoxX64.setSelected(true);
229 continue;
230 }
231 if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
232 this.jCheckBoxEbc.setSelected(true);
233 continue;
234 }
235 if (v.get(index).equals(this.jCheckBoxArm.getText())) {
236 this.jCheckBoxArm.setSelected(true);
237 continue;
238 }
239 if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
240 this.jCheckBoxPpc.setSelected(true);
241 continue;
242 }
243 }
244 }
245 }
246 }