KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > jsf > NewJSFBeanStepOperator


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.test.jsf;
21
22 import javax.swing.JComboBox JavaDoc;
23 import javax.swing.JTextField JavaDoc;
24 import org.netbeans.jellytools.WizardOperator;
25 import org.netbeans.jemmy.operators.JComboBoxOperator;
26 import org.netbeans.jemmy.operators.JLabelOperator;
27 import org.netbeans.jemmy.operators.JTextAreaOperator;
28 import org.netbeans.jemmy.operators.JTextFieldOperator;
29
30
31 /** Class implementing all necessary methods for handling "New JSF Managed Bean" NbDialog.
32  *
33  * @author luke
34  */

35 public class NewJSFBeanStepOperator extends WizardOperator {
36
37     /** Creates new NewJSFManagedBean that can handle it.
38      */

39     public NewJSFBeanStepOperator() {
40         super("New JSF Managed Bean");
41         checkPanel("Name and Location");
42     }
43
44     private JLabelOperator _lblNameAndLocation;
45     private JLabelOperator _lblClassName;
46     private JTextFieldOperator _txtClassName;
47     private JLabelOperator _lblProject;
48     private JTextFieldOperator _txtProject;
49     private JLabelOperator _lblLocation;
50     private JComboBoxOperator _cboLocation;
51     private JLabelOperator _lblPackage;
52     private JComboBoxOperator _cboPackage;
53     private JLabelOperator _lblCreatedFile;
54     private JTextFieldOperator _txtCreatedFile;
55     private JLabelOperator _lblConfigurationFile;
56     private JComboBoxOperator _cboConfigurationFile;
57     private JLabelOperator _lblScope;
58     private JComboBoxOperator _cboScope;
59     private JLabelOperator _lblBeanDescription;
60     private JTextAreaOperator _txtBeanDescription;
61    
62
63
64     //******************************
65
// Subcomponents definition part
66
//******************************
67

68     /** Tries to find "Name and Location" JLabel in this dialog.
69      * @return JLabelOperator
70      */

71     public JLabelOperator lblNameAndLocation() {
72         if (_lblNameAndLocation==null) {
73             _lblNameAndLocation = new JLabelOperator(this, "Name and Location");
74         }
75         return _lblNameAndLocation;
76     }
77
78     /** Tries to find "Class Name:" JLabel in this dialog.
79      * @return JLabelOperator
80      */

81     public JLabelOperator lblClassName() {
82         if (_lblClassName==null) {
83             _lblClassName = new JLabelOperator(this, "Class Name:");
84         }
85         return _lblClassName;
86     }
87
88     /** Tries to find null JTextField in this dialog.
89      * @return JTextFieldOperator
90      */

91     public JTextFieldOperator txtClassName() {
92         if (_txtClassName==null) {
93             _txtClassName = new JTextFieldOperator((JTextField JavaDoc)lblClassName().getLabelFor());
94         }
95         return _txtClassName;
96     }
97
98     /** Tries to find "Project:" JLabel in this dialog.
99      * @return JLabelOperator
100      */

101     public JLabelOperator lblProject() {
102         if (_lblProject==null) {
103             _lblProject = new JLabelOperator(this, "Project:");
104         }
105         return _lblProject;
106     }
107
108     /** Tries to find null JTextField in this dialog.
109      * @return JTextFieldOperator
110      */

111     public JTextFieldOperator txtProject() {
112         if (_txtProject==null) {
113             _txtProject = new JTextFieldOperator((JTextField JavaDoc)lblProject().getLabelFor());
114         }
115         return _txtProject;
116     }
117
118     /** Tries to find "Location:" JLabel in this dialog.
119      * @return JLabelOperator
120      */

121     public JLabelOperator lblLocation() {
122         if (_lblLocation==null) {
123             _lblLocation = new JLabelOperator(this, "Location:");
124         }
125         return _lblLocation;
126     }
127
128     /** Tries to find null JComboBox in this dialog.
129      * @return JComboBoxOperator
130      */

131     public JComboBoxOperator cboLocation() {
132         if (_cboLocation==null) {
133             _cboLocation = new JComboBoxOperator((JComboBox JavaDoc)lblLocation().getLabelFor());
134         }
135         return _cboLocation;
136     }
137
138     /** Tries to find "Package:" JLabel in this dialog.
139      * @return JLabelOperator
140      */

141     public JLabelOperator lblPackage() {
142         if (_lblPackage==null) {
143             _lblPackage = new JLabelOperator(this, "Package:");
144         }
145         return _lblPackage;
146     }
147
148     /** Tries to find null JComboBox in this dialog.
149      * @return JComboBoxOperator
150      */

151     public JComboBoxOperator cboPackage() {
152         if (_cboPackage==null) {
153             _cboPackage = new JComboBoxOperator((JComboBox JavaDoc)lblPackage().getLabelFor());
154         }
155         return _cboPackage;
156     }
157
158     /** Tries to find "Created File:" JLabel in this dialog.
159      * @return JLabelOperator
160      */

161     public JLabelOperator lblCreatedFile() {
162         if (_lblCreatedFile==null) {
163             _lblCreatedFile = new JLabelOperator(this, "Created File:");
164         }
165         return _lblCreatedFile;
166     }
167
168     /** Tries to find null JTextField in this dialog.
169      * @return JTextFieldOperator
170      */

171     public JTextFieldOperator txtCreatedFile() {
172         if (_txtCreatedFile==null) {
173             _txtCreatedFile = new JTextFieldOperator((JTextField JavaDoc)lblCreatedFile().getLabelFor());
174         }
175         return _txtCreatedFile;
176     }
177
178     /** Tries to find "Configuration File:" JLabel in this dialog.
179      * @return JLabelOperator
180      */

181     public JLabelOperator lblConfigurationFile() {
182         if (_lblConfigurationFile==null) {
183             _lblConfigurationFile = new JLabelOperator(this, "Configuration File:");
184         }
185         return _lblConfigurationFile;
186     }
187
188     /** Tries to find null JComboBox in this dialog.
189      * @return JComboBoxOperator
190      */

191     public JComboBoxOperator cboConfigurationFile() {
192         if (_cboConfigurationFile==null) {
193             _cboConfigurationFile = new JComboBoxOperator((JComboBox JavaDoc)lblConfigurationFile().getLabelFor());
194         }
195         return _cboConfigurationFile;
196     }
197
198     /** Tries to find "Scope:" JLabel in this dialog.
199      * @return JLabelOperator
200      */

201     public JLabelOperator lblScope() {
202         if (_lblScope==null) {
203             _lblScope = new JLabelOperator(this, "Scope:");
204         }
205         return _lblScope;
206     }
207
208     /** Tries to find null JComboBox in this dialog.
209      * @return JComboBoxOperator
210      */

211     public JComboBoxOperator cboScope() {
212         if (_cboScope==null) {
213             _cboScope = new JComboBoxOperator((JComboBox JavaDoc)lblScope().getLabelFor());
214         }
215         return _cboScope;
216     }
217
218     /** Tries to find "Bean Description:" JLabel in this dialog.
219      * @return JLabelOperator
220      */

221     public JLabelOperator lblBeanDescription() {
222         if (_lblBeanDescription==null) {
223             _lblBeanDescription = new JLabelOperator(this, "Bean Description:");
224         }
225         return _lblBeanDescription;
226     }
227
228     /** Tries to find null JTextArea in this dialog.
229      * @return JTextAreaOperator
230      */

231     public JTextAreaOperator txtBeanDescription() {
232         if (_txtBeanDescription==null) {
233             _txtBeanDescription = new JTextAreaOperator(this);
234         }
235         return _txtBeanDescription;
236     }
237    
238
239
240     //****************************************
241
// Low-level functionality definition part
242
//****************************************
243

244     /** gets text for txtClassName
245      * @return String text
246      */

247     public String JavaDoc getClassName() {
248         return txtClassName().getText();
249     }
250
251     /** sets text for txtClassName
252      * @param text String text
253      */

254     public void setClassName(String JavaDoc text) {
255         txtClassName().setText(text);
256     }
257
258     /** types text for txtClassName
259      * @param text String text
260      */

261     public void typeClassName(String JavaDoc text) {
262         txtClassName().typeText(text);
263     }
264
265     /** gets text for txtProject
266      * @return String text
267      */

268     public String JavaDoc getProject() {
269         return txtProject().getText();
270     }
271
272     /** sets text for txtProject
273      * @param text String text
274      */

275     public void setProject(String JavaDoc text) {
276         txtProject().setText(text);
277     }
278
279     /** types text for txtProject
280      * @param text String text
281      */

282     public void typeProject(String JavaDoc text) {
283         txtProject().typeText(text);
284     }
285
286     /** returns selected item for cboLocation
287      * @return String item
288      */

289     public String JavaDoc getSelectedLocation() {
290         return cboLocation().getSelectedItem().toString();
291     }
292
293     /** selects item for cboLocation
294      * @param item String item
295      */

296     public void selectLocation(String JavaDoc item) {
297         cboLocation().selectItem(item);
298     }
299
300     /** returns selected item for cboPackage
301      * @return String item
302      */

303     public String JavaDoc getSelectedPackage() {
304         return cboPackage().getSelectedItem().toString();
305     }
306
307     /** selects item for cboPackage
308      * @param item String item
309      */

310     public void selectPackage(String JavaDoc item) {
311         cboPackage().selectItem(item);
312     }
313
314     /** types text for cboPackage
315      * @param text String text
316      */

317     public void typePackage(String JavaDoc text) {
318         cboPackage().typeText(text);
319     }
320
321     /** gets text for txtCreatedFile
322      * @return String text
323      */

324     public String JavaDoc getCreatedFile() {
325         return txtCreatedFile().getText();
326     }
327
328     /** sets text for txtCreatedFile
329      * @param text String text
330      */

331     public void setCreatedFile(String JavaDoc text) {
332         txtCreatedFile().setText(text);
333     }
334
335     /** types text for txtCreatedFile
336      * @param text String text
337      */

338     public void typeCreatedFile(String JavaDoc text) {
339         txtCreatedFile().typeText(text);
340     }
341
342     /** returns selected item for cboConfigurationFile
343      * @return String item
344      */

345     public String JavaDoc getSelectedConfigurationFile() {
346         return cboConfigurationFile().getSelectedItem().toString();
347     }
348
349     /** selects item for cboConfigurationFile
350      * @param item String item
351      */

352     public void selectConfigurationFile(String JavaDoc item) {
353         cboConfigurationFile().selectItem(item);
354     }
355
356     /** returns selected item for cboScope
357      * @return String item
358      */

359     public String JavaDoc getSelectedScope() {
360         return cboScope().getSelectedItem().toString();
361     }
362
363     /** selects item for cboScope
364      * @param item String item
365      */

366     public void selectScope(String JavaDoc item) {
367         cboScope().selectItem(item);
368     }
369
370     /** gets text for txtBeanDescription
371      * @return String text
372      */

373     public String JavaDoc getBeanDescription() {
374         return txtBeanDescription().getText();
375     }
376
377     /** sets text for txtBeanDescription
378      * @param text String text
379      */

380     public void setBeanDescription(String JavaDoc text) {
381         txtBeanDescription().setText(text);
382     }
383
384     /** types text for txtBeanDescription
385      * @param text String text
386      */

387     public void typeBeanDescription(String JavaDoc text) {
388         txtBeanDescription().typeText(text);
389     }
390
391     //*****************************************
392
// High-level functionality definition part
393
//*****************************************
394

395     /** Performs verification of NewJSFManagedBean by accessing all its components.
396      */

397     public void verify() {
398         lblNameAndLocation();
399         lblClassName();
400         txtClassName();
401         lblProject();
402         txtProject();
403         lblLocation();
404         cboLocation();
405         lblPackage();
406         cboPackage();
407         lblCreatedFile();
408         txtCreatedFile();
409         lblConfigurationFile();
410         cboConfigurationFile();
411         lblScope();
412         cboScope();
413         lblBeanDescription();
414         txtBeanDescription();
415         btBack();
416         btNext();
417         btFinish();
418         btCancel();
419         btHelp();
420     }
421
422 }
423
424
Popular Tags