]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java
1e95cc35ffd0440848f0693f5e01f751f5b508bf
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / far / createui / CreateStepThree.java
1 /** @file
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 **/
13 package org.tianocore.frameworkwizard.far.createui;
14
15 import java.awt.event.MouseEvent;
16 import java.awt.event.MouseListener;
17 import java.util.Iterator;
18 import java.util.LinkedHashSet;
19 import java.util.Set;
20 import java.util.Vector;
21
22 import javax.swing.JPanel;
23 import javax.swing.JTextArea;
24 import javax.swing.JButton;
25 import javax.swing.JLabel;
26
27 import org.tianocore.frameworkwizard.common.ui.IDialog;
28 import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
29 import org.tianocore.frameworkwizard.far.FarStringDefinition;
30
31 import javax.swing.JScrollPane;
32 import javax.swing.JTextField;
33
34 public class CreateStepThree extends IDialog implements MouseListener {
35
36 /**
37 *
38 */
39 private static final long serialVersionUID = 7559888600474043337L;
40
41 private JPanel jContentPane = null;
42
43 private JTextArea jTextArea = null;
44
45 private JButton jButtonNext = null;
46
47 private JButton jButtonCancel = null;
48
49 private JButton jButtonPrevious = null;
50
51 private JLabel jLabel = null;
52
53 private ICheckBoxList jComboBoxFileFilter = null;
54
55 private JScrollPane jScrollPane = null;
56
57 private JLabel jLabel1 = null;
58
59 private JTextField jTextField = null;
60
61 Vector<String> v = new Vector<String>();
62
63 private CreateStepTwo stepTwo = null;
64
65 private CreateStepFour stepFour = null;
66
67 public CreateStepThree(IDialog iDialog, boolean modal, CreateStepTwo stepTwo) {
68 this(iDialog, modal);
69 this.stepTwo = stepTwo;
70 }
71
72 /**
73 * This method initializes jTextArea
74 *
75 * @return javax.swing.JTextArea
76 */
77 private JTextArea getJTextArea() {
78 if (jTextArea == null) {
79 jTextArea = new JTextArea();
80 jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
81 jTextArea.setText("Add additional file filter regular expressions in the text field, separated by space characters.\n");
82 jTextArea.append("Note, for additional information about regular expressions, please reference PERL language regular expressions.");
83 jTextArea.setEditable(false);
84 }
85 return jTextArea;
86 }
87
88 /**
89 * This method initializes jButtonNext
90 *
91 * @return javax.swing.JButton
92 */
93 private JButton getJButtonNext() {
94 if (jButtonNext == null) {
95 jButtonNext = new JButton();
96 jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
97 jButtonNext.setText("Next");
98 jButtonNext.addMouseListener(this);
99 }
100 return jButtonNext;
101 }
102
103 /**
104 * This method initializes jButtonCancel
105 *
106 * @return javax.swing.JButton
107 */
108 private JButton getJButtonCancel() {
109 if (jButtonCancel == null) {
110 jButtonCancel = new JButton();
111 jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
112 jButtonCancel.setText("Cancel");
113 jButtonCancel.addMouseListener(this);
114 }
115 return jButtonCancel;
116 }
117
118 /**
119 * This method initializes jButtonPrevious
120 *
121 * @return javax.swing.JButton
122 */
123 private JButton getJButtonPrevious() {
124 if (jButtonPrevious == null) {
125 jButtonPrevious = new JButton();
126 jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
127 jButtonPrevious.setText("Previous");
128 jButtonPrevious.addMouseListener(this);
129 }
130 return jButtonPrevious;
131 }
132
133 /**
134 * This method initializes jComboBox
135 *
136 * @return javax.swing.JComboBox
137 */
138 private ICheckBoxList getJComboBoxFileFilter() {
139 if (jComboBoxFileFilter == null) {
140 jComboBoxFileFilter = new ICheckBoxList();
141 v.addElement(".svn");
142 v.addElement("CVS");
143 jComboBoxFileFilter.setAllItems(v);
144 jComboBoxFileFilter.initCheckedItem(true, v);
145 }
146 return jComboBoxFileFilter;
147 }
148
149 /**
150 * This method initializes jScrollPane
151 *
152 * @return javax.swing.JScrollPane
153 */
154 private JScrollPane getJScrollPane() {
155 if (jScrollPane == null) {
156 jScrollPane = new JScrollPane();
157 jScrollPane.setBounds(new java.awt.Rectangle(30, 85, 640, 130));
158 jScrollPane.setViewportView(getJComboBoxFileFilter());
159 }
160 return jScrollPane;
161 }
162
163 /**
164 * This method initializes jTextField
165 *
166 * @return javax.swing.JTextField
167 */
168 private JTextField getJTextField() {
169 if (jTextField == null) {
170 jTextField = new JTextField();
171 jTextField.setBounds(new java.awt.Rectangle(30, 250, 640, 20));
172 }
173 return jTextField;
174 }
175
176 /**
177 * @param args
178 */
179 public static void main(String[] args) {
180 // TODO Auto-generated method stub
181 }
182
183 /**
184 * This is the default constructor
185 */
186 public CreateStepThree(IDialog iDialog, boolean modal) {
187 super(iDialog, modal);
188 initialize();
189 }
190
191 /**
192 * This method initializes this
193 *
194 * @return void
195 */
196 private void initialize() {
197 this.setSize(700, 400);
198 this.setContentPane(getJContentPane());
199 this.setTitle(FarStringDefinition.CREATE_STEP_THREE_TITLE);
200 this.centerWindow();
201 }
202
203 /**
204 * This method initializes jContentPane
205 *
206 * @return javax.swing.JPanel
207 */
208 private JPanel getJContentPane() {
209 if (jContentPane == null) {
210 jLabel1 = new JLabel();
211 jLabel1.setBounds(new java.awt.Rectangle(30, 220, 260, 20));
212 jLabel1.setText("Input File Filter Pattern (regular expressions)");
213 jLabel = new JLabel();
214 jLabel.setBounds(new java.awt.Rectangle(30, 64, 160, 20));
215 jLabel.setText("File Filter Pattern: ");
216 jContentPane = new JPanel();
217 jContentPane.setLayout(null);
218 jContentPane.add(getJTextArea(), null);
219 jContentPane.add(getJButtonNext(), null);
220 jContentPane.add(getJButtonCancel(), null);
221 jContentPane.add(getJButtonPrevious(), null);
222 jContentPane.add(jLabel, null);
223 jContentPane.add(getJScrollPane(), null);
224 jContentPane.add(jLabel1, null);
225 jContentPane.add(getJTextField(), null);
226 }
227 return jContentPane;
228 }
229
230 public void mouseClicked(MouseEvent e) {
231 if (e.getSource() == jButtonCancel) {
232 this.setVisible(false);
233 } else if (e.getSource() == jButtonNext) {
234 //
235 // Add some logic process here
236 //
237
238 if (stepFour == null) {
239 stepFour = new CreateStepFour(this, true, this);
240 stepFour.setVisible(true);
241 } else {
242 stepFour.setVisible(true);
243 }
244 this.setVisible(false);
245 } else if (e.getSource() == jButtonPrevious) {
246 this.setVisible(false);
247 stepTwo.setVisible(true);
248 }
249 }
250
251 public void mousePressed(MouseEvent e) {
252 // TODO Auto-generated method stub
253
254 }
255
256 public void mouseReleased(MouseEvent e) {
257 // TODO Auto-generated method stub
258
259 }
260
261 public void mouseEntered(MouseEvent e) {
262 // TODO Auto-generated method stub
263
264 }
265
266 public void mouseExited(MouseEvent e) {
267 // TODO Auto-generated method stub
268
269 }
270
271 public Set<String> getFileFilter() {
272 Set<String> result = new LinkedHashSet<String>();
273 Vector<Integer> selected = jComboBoxFileFilter.getAllCheckedItemsIndex();
274
275 Iterator<Integer> iter = selected.iterator();
276
277 while (iter.hasNext()) {
278 result.add(v.get(iter.next().intValue()));
279 }
280
281 String[] userdefined = jTextField.getText().split(" ");
282
283 for (int i = 0; i < userdefined.length; i++) {
284 if (!userdefined[i].trim().equalsIgnoreCase("")) {
285 result.add(userdefined[i]);
286 }
287 }
288
289 return result;
290 }
291
292 public CreateStepTwo getPreviousStep() {
293 return stepTwo;
294 }
295 }