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
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.
13 package org
.tianocore
.frameworkwizard
.far
.createui
;
15 import java
.awt
.event
.MouseEvent
;
16 import java
.awt
.event
.MouseListener
;
17 import java
.util
.Iterator
;
18 import java
.util
.LinkedHashSet
;
20 import java
.util
.Vector
;
22 import javax
.swing
.JPanel
;
23 import javax
.swing
.JTextArea
;
24 import javax
.swing
.JButton
;
25 import javax
.swing
.JLabel
;
27 import org
.tianocore
.frameworkwizard
.common
.ui
.IDialog
;
28 import org
.tianocore
.frameworkwizard
.common
.ui
.iCheckBoxList
.ICheckBoxList
;
29 import org
.tianocore
.frameworkwizard
.far
.FarStringDefinition
;
31 import javax
.swing
.JScrollPane
;
32 import javax
.swing
.JTextField
;
34 public class CreateStepThree
extends IDialog
implements MouseListener
{
39 private static final long serialVersionUID
= 7559888600474043337L;
41 private JPanel jContentPane
= null;
43 private JTextArea jTextArea
= null;
45 private JButton jButtonNext
= null;
47 private JButton jButtonCancel
= null;
49 private JButton jButtonPrevious
= null;
51 private JLabel jLabel
= null;
53 private ICheckBoxList jComboBoxFileFilter
= null;
55 private JScrollPane jScrollPane
= null;
57 private JLabel jLabel1
= null;
59 private JTextField jTextField
= null;
61 Vector
<String
> v
= new Vector
<String
>();
63 private CreateStepTwo stepTwo
= null;
65 private CreateStepFour stepFour
= null;
67 public CreateStepThree(IDialog iDialog
, boolean modal
, CreateStepTwo stepTwo
) {
69 this.stepTwo
= stepTwo
;
73 * This method initializes jTextArea
75 * @return javax.swing.JTextArea
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);
89 * This method initializes jButtonNext
91 * @return javax.swing.JButton
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);
104 * This method initializes jButtonCancel
106 * @return javax.swing.JButton
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);
115 return jButtonCancel
;
119 * This method initializes jButtonPrevious
121 * @return javax.swing.JButton
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);
130 return jButtonPrevious
;
134 * This method initializes jComboBox
136 * @return javax.swing.JComboBox
138 private ICheckBoxList
getJComboBoxFileFilter() {
139 if (jComboBoxFileFilter
== null) {
140 jComboBoxFileFilter
= new ICheckBoxList();
141 v
.addElement(".svn");
143 jComboBoxFileFilter
.setAllItems(v
);
144 jComboBoxFileFilter
.initCheckedItem(true, v
);
146 return jComboBoxFileFilter
;
150 * This method initializes jScrollPane
152 * @return javax.swing.JScrollPane
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());
164 * This method initializes jTextField
166 * @return javax.swing.JTextField
168 private JTextField
getJTextField() {
169 if (jTextField
== null) {
170 jTextField
= new JTextField();
171 jTextField
.setBounds(new java
.awt
.Rectangle(30, 250, 640, 20));
179 public static void main(String
[] args
) {
180 // TODO Auto-generated method stub
184 * This is the default constructor
186 public CreateStepThree(IDialog iDialog
, boolean modal
) {
187 super(iDialog
, modal
);
192 * This method initializes this
196 private void initialize() {
197 this.setSize(700, 400);
198 this.setContentPane(getJContentPane());
199 this.setTitle(FarStringDefinition
.CREATE_STEP_THREE_TITLE
);
204 * This method initializes jContentPane
206 * @return javax.swing.JPanel
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);
230 public void mouseClicked(MouseEvent e
) {
231 if (e
.getSource() == jButtonCancel
) {
232 this.setVisible(false);
233 } else if (e
.getSource() == jButtonNext
) {
235 // Add some logic process here
238 if (stepFour
== null) {
239 stepFour
= new CreateStepFour(this, true, this);
242 this.setVisible(false);
243 stepFour
.setVisible(true);
244 } else if (e
.getSource() == jButtonPrevious
) {
245 this.setVisible(false);
246 stepTwo
.setVisible(true);
250 public void mousePressed(MouseEvent e
) {
251 // TODO Auto-generated method stub
255 public void mouseReleased(MouseEvent e
) {
256 // TODO Auto-generated method stub
260 public void mouseEntered(MouseEvent e
) {
261 // TODO Auto-generated method stub
265 public void mouseExited(MouseEvent e
) {
266 // TODO Auto-generated method stub
270 public Set
<String
> getFileFilter() {
271 Set
<String
> result
= new LinkedHashSet
<String
>();
272 Vector
<Integer
> selected
= jComboBoxFileFilter
.getAllCheckedItemsIndex();
274 Iterator
<Integer
> iter
= selected
.iterator();
276 while (iter
.hasNext()) {
277 result
.add(v
.get(iter
.next().intValue()));
280 String
[] userdefined
= jTextField
.getText().split(" ");
282 for (int i
= 0; i
< userdefined
.length
; i
++) {
283 if (!userdefined
[i
].trim().equalsIgnoreCase("")) {
284 result
.add(userdefined
[i
]);
291 public CreateStepTwo
getPreviousStep() {