KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > subversion > operators > SwitchOperator


1 /*
2  * SwitchOperator.java
3  *
4  * Created on 17/05/06 21:52
5  */

6 package org.netbeans.test.subversion.operators;
7
8 import org.netbeans.jellytools.NbDialogOperator;
9 import org.netbeans.jellytools.nodes.Node;
10 import org.netbeans.jemmy.operators.*;
11 import org.netbeans.test.subversion.operators.actions.SwitchAction;
12
13 /** Class implementing all necessary methods for handling "Switch AnagramGame to..." NbDialog.
14  *
15  * @author peter
16  * @version 1.0
17  */

18 public class SwitchOperator extends NbDialogOperator {
19
20     /**
21      * Creates new SwitchOperator that can handle it.
22      */

23     public SwitchOperator() {
24         super("Switch");
25     }
26     
27     /** Selects nodes and call switch action on them.
28      * @param nodes an array of nodes
29      * @return MergeOperator instance
30      */

31     public static SwitchOperator invoke(Node[] nodes) {
32         new SwitchAction().perform(nodes);
33         return new SwitchOperator();
34     }
35     
36     /** Selects node and call switch action on it.
37      * @param node node to be selected
38      * @return SwitchOperator instance
39      */

40     public static SwitchOperator invoke(Node node) {
41         return invoke(new Node[] {node});
42     }
43
44     private JLabelOperator _lblRepositoryFolder;
45     private JComboBoxOperator _cboRepositoryFolder;
46     private JButtonOperator _btBrowseRepositoryFolder;
47     private JLabelOperator _lblRepositoryRevision;
48     private JLabelOperator _lblEmptyMeansRepositoryHEAD;
49     private JTextFieldOperator _txtRepositoryRevision;
50     private JButtonOperator _btSearch;
51     private JButtonOperator _btSwitch;
52     private JButtonOperator _btCancel;
53     private JButtonOperator _btHelp;
54
55
56     //******************************
57
// Subcomponents definition part
58
//******************************
59

60     /** Tries to find "Repository Folder:" JLabel in this dialog.
61      * @return JLabelOperator
62      */

63     public JLabelOperator lblRepositoryFolder() {
64         if (_lblRepositoryFolder==null) {
65             _lblRepositoryFolder = new JLabelOperator(this, "Repository Folder:");
66         }
67         return _lblRepositoryFolder;
68     }
69
70     /** Tries to find null JComboBox in this dialog.
71      * @return JComboBoxOperator
72      */

73     public JComboBoxOperator cboRepositoryFolder() {
74         if (_cboRepositoryFolder==null) {
75             _cboRepositoryFolder = new JComboBoxOperator(this);
76         }
77         return _cboRepositoryFolder;
78     }
79
80     /** Tries to find "Browse..." JButton in this dialog.
81      * @return JButtonOperator
82      */

83     public JButtonOperator btBrowseRepositoryFolder() {
84         if (_btBrowseRepositoryFolder==null) {
85             _btBrowseRepositoryFolder = new JButtonOperator(this, "Browse");
86         }
87         return _btBrowseRepositoryFolder;
88     }
89
90     /** Tries to find "Repository Revision:" JLabel in this dialog.
91      * @return JLabelOperator
92      */

93     public JLabelOperator lblRepositoryRevision() {
94         if (_lblRepositoryRevision==null) {
95             _lblRepositoryRevision = new JLabelOperator(this, "Repository Revision:");
96         }
97         return _lblRepositoryRevision;
98     }
99
100     /** Tries to find "(empty means repository HEAD)" JLabel in this dialog.
101      * @return JLabelOperator
102      */

103     public JLabelOperator lblEmptyMeansRepositoryHEAD() {
104         if (_lblEmptyMeansRepositoryHEAD==null) {
105             _lblEmptyMeansRepositoryHEAD = new JLabelOperator(this, "(empty means repository HEAD)");
106         }
107         return _lblEmptyMeansRepositoryHEAD;
108     }
109
110     /** Tries to find null JTextField in this dialog.
111      * @return JTextFieldOperator
112      */

113     public JTextFieldOperator txtRepositoryRevision() {
114         if (_txtRepositoryRevision==null) {
115             _txtRepositoryRevision = new JTextFieldOperator(this, 1);
116         }
117         return _txtRepositoryRevision;
118     }
119
120     /** Tries to find "Search..." JButton in this dialog.
121      * @return JButtonOperator
122      */

123     public JButtonOperator btSearch() {
124         if (_btSearch==null) {
125             _btSearch = new JButtonOperator(this, "Search...");
126         }
127         return _btSearch;
128     }
129
130     /** Tries to find "Switch" JButton in this dialog.
131      * @return JButtonOperator
132      */

133     public JButtonOperator btSwitch() {
134         if (_btSwitch==null) {
135             _btSwitch = new JButtonOperator(this, "Switch");
136         }
137         return _btSwitch;
138     }
139
140     /** Tries to find "Cancel" JButton in this dialog.
141      * @return JButtonOperator
142      */

143     public JButtonOperator btCancel() {
144         if (_btCancel==null) {
145             _btCancel = new JButtonOperator(this, "Cancel");
146         }
147         return _btCancel;
148     }
149
150     /** Tries to find "Help" JButton in this dialog.
151      * @return JButtonOperator
152      */

153     public JButtonOperator btHelp() {
154         if (_btHelp==null) {
155             _btHelp = new JButtonOperator(this, "Help");
156         }
157         return _btHelp;
158     }
159
160
161     //****************************************
162
// Low-level functionality definition part
163
//****************************************
164

165     /**
166      * returns selected item for cboRepositoryFolder
167      *
168      * @return String item
169      */

170     public String JavaDoc getSelectedRepositoryFolder() {
171         return cboRepositoryFolder().getSelectedItem().toString();
172     }
173
174     public String JavaDoc getRepositoryFolder() {
175         return cboRepositoryFolder().getEditor().getItem().toString();
176     }
177     
178     /**
179      * selects item for cboRepositoryFolder
180      *
181      * @param item String item
182      */

183     public void selectJComboBox(String JavaDoc item) {
184         cboRepositoryFolder().clearText();
185         cboRepositoryFolder().selectItem(item);
186     }
187
188     /**
189      * types text for cboRepositoryFolder
190      *
191      * @param text String text
192      */

193     public void setRepositoryFolder(String JavaDoc text) {
194         cboRepositoryFolder().clearText();
195         cboRepositoryFolder().typeText(text);
196     }
197
198     /** clicks on "Browse..." JButton
199      */

200     public RepositoryBrowserOperator browseRepositoryFolder() {
201         btBrowseRepositoryFolder().pushNoBlock();
202         return new RepositoryBrowserOperator();
203     }
204
205     /**
206      * gets text for txtRepositoryRevision
207      *
208      * @return String text
209      */

210     public String JavaDoc getRepositoryRevision() {
211         return txtRepositoryRevision().getText();
212     }
213
214     /**
215      * types text for txtRepositoryRevision
216      *
217      * @param text String text
218      */

219     public void setRepositoryRevision(String JavaDoc text) {
220         txtRepositoryRevision().clearText();
221         txtRepositoryRevision().typeText(text);
222     }
223
224     /** clicks on "Search..." JButton
225      */

226     public void search() {
227         btSearch().push();
228     }
229
230     /** clicks on "Switch" JButton
231      */

232     public void switchBt() {
233         btSwitch().push();
234     }
235
236     /** clicks on "Cancel" JButton
237      */

238     public void cancel() {
239         btCancel().push();
240     }
241
242     /** clicks on "Help" JButton
243      */

244     public void help() {
245         btHelp().push();
246     }
247
248
249     //*****************************************
250
// High-level functionality definition part
251
//*****************************************
252

253     /** Performs verification of SwitchAnagramGameTo by accessing all its components.
254      */

255     public void verify() {
256         lblRepositoryFolder();
257         cboRepositoryFolder();
258         btBrowseRepositoryFolder();
259         lblRepositoryRevision();
260         lblEmptyMeansRepositoryHEAD();
261         txtRepositoryRevision();
262         btSearch();
263         btSwitch();
264         btCancel();
265         btHelp();
266     }
267 }
268
269
Popular Tags