KickJava   Java API By Example, From Geeks To Geeks.

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


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

33 public class AddNavigationRuleDialogOperator extends NbDialogOperator {
34
35     /** Creates new AddNavigationRule that can handle it.
36      */

37     public AddNavigationRuleDialogOperator() {
38         super("Add Navigation Rule");
39     }
40
41     private JLabelOperator _lblRuleFromView;
42     private JTextFieldOperator _txtRuleFromView;
43     private JButtonOperator _btBrowse;
44     private JLabelOperator _lblRuleDescription;
45     private JTextAreaOperator _txtRuleDescription;
46     private JButtonOperator _btAdd;
47
48
49     //******************************
50
// Subcomponents definition part
51
//******************************
52

53     /** Tries to find "Rule from View:" JLabel in this dialog.
54      * @return JLabelOperator
55      */

56     public JLabelOperator lblRuleFromView() {
57         if (_lblRuleFromView==null) {
58             _lblRuleFromView = new JLabelOperator(this, "Rule from View:");
59         }
60         return _lblRuleFromView;
61     }
62
63     /** Tries to find null JTextField in this dialog.
64      * @return JTextFieldOperator
65      */

66     public JTextFieldOperator txtRuleFromView() {
67         if (_txtRuleFromView==null) {
68             _txtRuleFromView = new JTextFieldOperator(this);
69         }
70         return _txtRuleFromView;
71     }
72
73     /** Tries to find "Browse..." JButton in this dialog.
74      * @return JButtonOperator
75      */

76     public JButtonOperator btBrowse() {
77         if (_btBrowse==null) {
78             _btBrowse = new JButtonOperator(this, "Browse...");
79         }
80         return _btBrowse;
81     }
82
83     /** Tries to find "Rule Description:" JLabel in this dialog.
84      * @return JLabelOperator
85      */

86     public JLabelOperator lblRuleDescription() {
87         if (_lblRuleDescription==null) {
88             _lblRuleDescription = new JLabelOperator(this, "Rule Description:");
89         }
90         return _lblRuleDescription;
91     }
92
93     /** Tries to find null JTextArea in this dialog.
94      * @return JTextAreaOperator
95      */

96     public JTextAreaOperator txtRuleDescription() {
97         if (_txtRuleDescription==null) {
98             _txtRuleDescription = new JTextAreaOperator(this);
99         }
100         return _txtRuleDescription;
101     }
102
103     /** Tries to find "Add" JButton in this dialog.
104      * @return JButtonOperator
105      */

106     public JButtonOperator btAdd() {
107         if (_btAdd==null) {
108             _btAdd = new JButtonOperator(this, "Add");
109         }
110         return _btAdd;
111     }
112
113     //****************************************
114
// Low-level functionality definition part
115
//****************************************
116

117     /** gets text for txtRuleFromView
118      * @return String text
119      */

120     public String JavaDoc getRuleFromView() {
121         return txtRuleFromView().getText();
122     }
123
124     /** sets text for txtRuleFromView
125      * @param text String text
126      */

127     public void setRuleFromView(String JavaDoc text) {
128         txtRuleFromView().setText(text);
129     }
130
131     /** types text for txtRuleFromView
132      * @param text String text
133      */

134     public void typeRuleFromView(String JavaDoc text) {
135         txtRuleFromView().typeText(text);
136     }
137
138     /** clicks on "Browse..." JButton
139      */

140     public void browse() {
141         btBrowse().push();
142     }
143
144     /** gets text for txtRuleDescription
145      * @return String text
146      */

147     public String JavaDoc getRuleDescription() {
148         return txtRuleDescription().getText();
149     }
150
151     /** sets text for txtRuleDescription
152      * @param text String text
153      */

154     public void setRuleDescription(String JavaDoc text) {
155         txtRuleDescription().setText(text);
156     }
157
158     /** types text for txtRuleDescription
159      * @param text String text
160      */

161     public void typeRuleDescription(String JavaDoc text) {
162         txtRuleDescription().typeText(text);
163     }
164
165     /** clicks on "Add" JButton
166      */

167     public void add() {
168         btAdd().push();
169     }
170
171     //*****************************************
172
// High-level functionality definition part
173
//*****************************************
174

175     /** Performs verification of AddNavigationRule by accessing all its components.
176      */

177     public void verify() {
178         lblRuleFromView();
179         txtRuleFromView();
180         btBrowse();
181         lblRuleDescription();
182         txtRuleDescription();
183         btAdd();
184         btCancel();
185         btHelp();
186     }
187 }
188
189
Popular Tags