]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java
Fixed spacing for Linux and iMac display
[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 import org.tianocore.frameworkwizard.common.DataType;
24
25 public class ArchCheckBox extends JPanel {
26
27 ///
28 ///
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
136 @param args
137
138 **/
139 public static void main(String[] args) {
140 // TODO Auto-generated method stub
141
142 }
143
144 /**
145 * This is the default constructor
146 */
147 public ArchCheckBox() {
148 super();
149 initialize();
150 }
151
152 /**
153 * This method initializes this
154 *
155 * @return void
156 */
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);
167 }
168
169 public Vector<String> getSelectedItemsVector() {
170 Vector<String> v = new Vector<String>();
171 if (this.jCheckBoxIa32.isSelected()) {
172 v.addElement(jCheckBoxIa32.getText());
173 }
174 if (this.jCheckBoxX64.isSelected()) {
175 v.addElement(jCheckBoxX64.getText());
176 }
177 if (this.jCheckBoxIpf.isSelected()) {
178 v.addElement(jCheckBoxIpf.getText());
179 }
180 if (this.jCheckBoxEbc.isSelected()) {
181 v.addElement(jCheckBoxEbc.getText());
182 }
183 if (this.jCheckBoxArm.isSelected()) {
184 v.addElement(jCheckBoxArm.getText());
185 }
186 if (this.jCheckBoxPpc.isSelected()) {
187 v.addElement(jCheckBoxPpc.getText());
188 }
189 return v;
190 }
191
192 public String getSelectedItemsString() {
193 String s = "";
194 if (this.jCheckBoxIa32.isSelected()) {
195 s = s + jCheckBoxIa32.getText() + " ";
196 }
197 if (this.jCheckBoxX64.isSelected()) {
198 s = s + jCheckBoxX64.getText() + " ";
199 }
200 if (this.jCheckBoxIpf.isSelected()) {
201 s = s + jCheckBoxIpf.getText() + " ";
202 }
203 if (this.jCheckBoxEbc.isSelected()) {
204 s = s + jCheckBoxEbc.getText() + " ";
205 }
206 if (this.jCheckBoxArm.isSelected()) {
207 s = s + jCheckBoxArm.getText() + " ";
208 }
209 if (this.jCheckBoxPpc.isSelected()) {
210 s = s + jCheckBoxPpc.getText() + " ";
211 }
212 return s.trim();
213 }
214
215 public void setAllItemsSelected(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);
222 }
223
224 public void setSelectedItems(Vector<String> v) {
225 setAllItemsSelected(false);
226 if (v != null) {
227 for (int index = 0; index < v.size(); index++) {
228 if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
229 this.jCheckBoxIa32.setSelected(true);
230 continue;
231 }
232 if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
233 this.jCheckBoxIpf.setSelected(true);
234 continue;
235 }
236 if (v.get(index).equals(this.jCheckBoxX64.getText())) {
237 this.jCheckBoxX64.setSelected(true);
238 continue;
239 }
240 if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
241 this.jCheckBoxEbc.setSelected(true);
242 continue;
243 }
244 if (v.get(index).equals(this.jCheckBoxArm.getText())) {
245 this.jCheckBoxArm.setSelected(true);
246 continue;
247 }
248 if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
249 this.jCheckBoxPpc.setSelected(true);
250 continue;
251 }
252 }
253 }
254 }
255 }