KickJava   Java API By Example, From Geeks To Geeks.

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


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.NbDialogOperator;
25 import org.netbeans.jemmy.operators.JButtonOperator;
26 import org.netbeans.jemmy.operators.JCheckBoxOperator;
27 import org.netbeans.jemmy.operators.JComboBoxOperator;
28 import org.netbeans.jemmy.operators.JLabelOperator;
29 import org.netbeans.jemmy.operators.JTextAreaOperator;
30 import org.netbeans.jemmy.operators.JTextFieldOperator;
31
32
33 /** Class implementing all necessary methods for handling "Add Navigation Case" NbDialog.
34  *
35  * @author luke
36  */

37 public class AddNavigationCaseDialogOperator extends NbDialogOperator {
38
39     /** Creates new AddNavigationCase that can handle it.
40      */

41     public AddNavigationCaseDialogOperator() {
42         super("Add Navigation Case");
43     }
44
45     private JLabelOperator _lblFromView;
46     private JComboBoxOperator _cboFromView;
47     private JButtonOperator _btBrowse;
48     private JLabelOperator _lblFromAction;
49     private JTextFieldOperator _txtFromAction;
50     private JLabelOperator _lblFromOutcome;
51     private JTextFieldOperator _txtFromOutcome;
52     private JLabelOperator _lblToView;
53     private JButtonOperator _btBrowse2;
54     private JCheckBoxOperator _cbRedirect;
55     private JLabelOperator _lblRuleDescription;
56     private JTextAreaOperator _txtRuleDescription;
57     private JComboBoxOperator _cboToView;
58     private JButtonOperator _btAdd;
59
60
61     //******************************
62
// Subcomponents definition part
63
//******************************
64

65     /** Tries to find "From View:" JLabel in this dialog.
66      * @return JLabelOperator
67      */

68     public JLabelOperator lblFromView() {
69         if (_lblFromView==null) {
70             _lblFromView = new JLabelOperator(this, "From View:");
71         }
72         return _lblFromView;
73     }
74
75     /** Tries to find null JComboBox in this dialog.
76      * @return JComboBoxOperator
77      */

78     public JComboBoxOperator cboFromView() {
79         if (_cboFromView==null) {
80             _cboFromView = new JComboBoxOperator((JComboBox JavaDoc)lblFromView().getLabelFor());
81         }
82         return _cboFromView;
83     }
84
85     /** Tries to find "Browse..." JButton in this dialog.
86      * @return JButtonOperator
87      */

88     public JButtonOperator btBrowse() {
89         if (_btBrowse==null) {
90             _btBrowse = new JButtonOperator(this, "Browse...");
91         }
92         return _btBrowse;
93     }
94
95     /** Tries to find "From Action:" JLabel in this dialog.
96      * @return JLabelOperator
97      */

98     public JLabelOperator lblFromAction() {
99         if (_lblFromAction==null) {
100             _lblFromAction = new JLabelOperator(this, "From Action:");
101         }
102         return _lblFromAction;
103     }
104
105     /** Tries to find null JTextField in this dialog.
106      * @return JTextFieldOperator
107      */

108     public JTextFieldOperator txtFromAction() {
109         if (_txtFromAction==null) {
110             _txtFromAction = new JTextFieldOperator((JTextField JavaDoc)lblFromAction().getLabelFor());
111         }
112         return _txtFromAction;
113     }
114
115     /** Tries to find "From Outcome:" JLabel in this dialog.
116      * @return JLabelOperator
117      */

118     public JLabelOperator lblFromOutcome() {
119         if (_lblFromOutcome==null) {
120             _lblFromOutcome = new JLabelOperator(this, "From Outcome:");
121         }
122         return _lblFromOutcome;
123     }
124     
125     
126     /** Tries to find null JTextField in this dialog.
127      * @return JTextFieldOperator
128      */

129     public JTextFieldOperator txtFromOutcome() {
130         if (_txtFromOutcome==null) {
131             _txtFromOutcome = new JTextFieldOperator((JTextField JavaDoc)lblFromOutcome().getLabelFor());
132         }
133         return _txtFromOutcome;
134     }
135
136     /** Tries to find "To View:" JLabel in this dialog.
137      * @return JLabelOperator
138      */

139     public JLabelOperator lblToView() {
140         if (_lblToView==null) {
141             _lblToView = new JLabelOperator(this, "To View:");
142         }
143         return _lblToView;
144     }
145
146     /** Tries to find "Browse..." JButton in this dialog.
147      * @return JButtonOperator
148      */

149     public JButtonOperator btBrowse2() {
150         if (_btBrowse2==null) {
151             _btBrowse2 = new JButtonOperator(this, "Browse...", 1);
152         }
153         return _btBrowse2;
154     }
155
156     /** Tries to find "Redirect" JCheckBox in this dialog.
157      * @return JCheckBoxOperator
158      */

159     public JCheckBoxOperator cbRedirect() {
160         if (_cbRedirect==null) {
161             _cbRedirect = new JCheckBoxOperator(this, "Redirect");
162         }
163         return _cbRedirect;
164     }
165
166     /** Tries to find "Rule Description:" JLabel in this dialog.
167      * @return JLabelOperator
168      */

169     public JLabelOperator lblRuleDescription() {
170         if (_lblRuleDescription==null) {
171             _lblRuleDescription = new JLabelOperator(this, "Rule Description:");
172         }
173         return _lblRuleDescription;
174     }
175
176     /** Tries to find null JTextArea in this dialog.
177      * @return JTextAreaOperator
178      */

179     public JTextAreaOperator txtRuleDescription() {
180         if (_txtRuleDescription==null) {
181             _txtRuleDescription = new JTextAreaOperator(this);
182         }
183         return _txtRuleDescription;
184     }
185
186     /** Tries to find null JComboBox in this dialog.
187      * @return JComboBoxOperator
188      */

189     public JComboBoxOperator cboToView() {
190         if (_cboToView==null) {
191             _cboToView = new JComboBoxOperator((JComboBox JavaDoc)lblToView().getLabelFor());
192         }
193         return _cboToView;
194     }
195
196     /** Tries to find "Add" JButton in this dialog.
197      * @return JButtonOperator
198      */

199     public JButtonOperator btAdd() {
200         if (_btAdd==null) {
201             _btAdd = new JButtonOperator(this, "Add");
202         }
203         return _btAdd;
204     }
205     
206     public void add(){
207         btAdd().push();
208     }
209
210     //****************************************
211
// Low-level functionality definition part
212
//****************************************
213

214     /** returns selected item for cboFromView
215      * @return String item
216      */

217     public String JavaDoc getSelectedFromView() {
218         return cboFromView().getSelectedItem().toString();
219     }
220
221     /** selects item for cboFromView
222      * @param item String item
223      */

224     public void selectFromView(String JavaDoc item) {
225         cboFromView().selectItem(item);
226     }
227
228     /** types text for cboFromView
229      * @param text String text
230      */

231     public void typeFromView(String JavaDoc text) {
232         cboFromView().typeText(text);
233     }
234
235     /** clicks on "Browse..." JButton
236      */

237     public void browse() {
238         btBrowse().push();
239     }
240
241     /** gets text for txtFromAction
242      * @return String text
243      */

244     public String JavaDoc getFromAction() {
245         return txtFromAction().getText();
246     }
247
248     /** sets text for txtFromAction
249      * @param text String text
250      */

251     public void setFromAction(String JavaDoc text) {
252         txtFromAction().setText(text);
253     }
254
255     /** types text for txtFromAction
256      * @param text String text
257      */

258     public void typeFromAction(String JavaDoc text) {
259         txtFromAction().typeText(text);
260     }
261
262     /** gets text for txtFromOutcome
263      * @return String text
264      */

265     public String JavaDoc getFromOutcome() {
266         return txtFromOutcome().getText();
267     }
268
269     /** sets text for txtFromOutcome
270      * @param text String text
271      */

272     public void setFromOutcome(String JavaDoc text) {
273         txtFromOutcome().setText(text);
274     }
275
276     /** types text for txtFromOutcome
277      * @param text String text
278      */

279     public void typeFromOutcome(String JavaDoc text) {
280         txtFromOutcome().typeText(text);
281     }
282
283     /** clicks on "Browse..." JButton
284      */

285     public void browse2() {
286         btBrowse2().push();
287     }
288
289     /** checks or unchecks given JCheckBox
290      * @param state boolean requested state
291      */

292     public void checkRedirect(boolean state) {
293         if (cbRedirect().isSelected()!=state) {
294             cbRedirect().push();
295         }
296     }
297
298     /** gets text for txtRuleDescription
299      * @return String text
300      */

301     public String JavaDoc getRuleDescription() {
302         return txtRuleDescription().getText();
303     }
304
305     /** sets text for txtRuleDescription
306      * @param text String text
307      */

308     public void setRuleDescription(String JavaDoc text) {
309         txtRuleDescription().setText(text);
310     }
311
312     /** types text for txtRuleDescription
313      * @param text String text
314      */

315     public void typeRuleDescription(String JavaDoc text) {
316         txtRuleDescription().typeText(text);
317     }
318
319     /** returns selected item for cboToView
320      * @return String item
321      */

322     public String JavaDoc getSelectedToView() {
323         return cboToView().getSelectedItem().toString();
324     }
325
326     /** selects item for cboToView
327      * @param item String item
328      */

329     public void selectToView(String JavaDoc item) {
330         cboToView().selectItem(item);
331     }
332
333     /** types text for cboToView
334      * @param text String text
335      */

336     public void typeToView(String JavaDoc text) {
337         cboToView().typeText(text);
338     }
339
340
341     //*****************************************
342
// High-level functionality definition part
343
//*****************************************
344

345     /** Performs verification of AddNavigationCase by accessing all its components.
346      */

347     public void verify() {
348         lblFromView();
349         cboFromView();
350         btBrowse();
351         lblFromAction();
352         txtFromAction();
353         lblFromOutcome();
354         txtFromOutcome();
355         lblToView();
356         btBrowse2();
357         cbRedirect();
358         lblRuleDescription();
359         txtRuleDescription();
360         cboToView();
361         btAdd();
362         btCancel();
363         btHelp();
364     }
365 }
366
367
Popular Tags