KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * RevertModificationsOperator.java
3  *
4  * Created on 18/05/06 17:09
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.RevertAction;
12
13 /** Class implementing all necessary methods for handling "Revert Modifications" NbDialog.
14  *
15  * @author peter
16  * @version 1.0
17  */

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

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

31     public static RevertModificationsOperator invoke(Node[] nodes) {
32         new RevertAction().perform(nodes);
33         return new RevertModificationsOperator();
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 RevertModificationsOperator invoke(Node node) {
41         return invoke(new Node[] {node});
42     }
43
44     private JLabelOperator _lblStartWithRevision;
45     private JLabelOperator _lblEndWithRevision;
46     private JTextFieldOperator _txtStartRevision;
47     private JTextFieldOperator _txtEndRevision;
48     private JTextFieldOperator _txtRevision;
49     private JLabelOperator _lblEmptyMeansRepositoryHEAD;
50     private JButtonOperator _btSearch;
51     private JButtonOperator _btSearch2;
52     private JButtonOperator _btSearch3;
53     private JLabelOperator _lblRevertModificationsFrom;
54     private JRadioButtonOperator _rbPreviousCommits;
55     private JRadioButtonOperator _rbLocalChanges;
56     private JRadioButtonOperator _rbSingleCommit;
57     private JButtonOperator _btRevert;
58     private JButtonOperator _btCancel;
59     private JButtonOperator _btHelp;
60
61
62     //******************************
63
// Subcomponents definition part
64
//******************************
65

66     /** Tries to find "Start with Revision:" JLabel in this dialog.
67      * @return JLabelOperator
68      */

69     public JLabelOperator lblStartWithRevision() {
70         if (_lblStartWithRevision==null) {
71             _lblStartWithRevision = new JLabelOperator(this, "Starting");
72         }
73         return _lblStartWithRevision;
74     }
75
76     /** Tries to find "End with Revision:" JLabel in this dialog.
77      * @return JLabelOperator
78      */

79     public JLabelOperator lblEndWithRevision() {
80         if (_lblEndWithRevision==null) {
81             _lblEndWithRevision = new JLabelOperator(this, "Ending");
82         }
83         return _lblEndWithRevision;
84     }
85
86     /** Tries to find null JTextField in this dialog.
87      * @return JTextFieldOperator
88      */

89     public JTextFieldOperator txtStartRevision() {
90         if (_txtStartRevision==null) {
91             _txtStartRevision = new JTextFieldOperator(this, 1);
92         }
93         return _txtStartRevision;
94     }
95
96     /** Tries to find null JTextField in this dialog.
97      * @return JTextFieldOperator
98      */

99     public JTextFieldOperator txtEndRevision() {
100         if (_txtEndRevision==null) {
101             _txtEndRevision = new JTextFieldOperator(this);
102         }
103         return _txtEndRevision;
104     }
105
106     /** Tries to find null JTextField in this dialog.
107      * @return JTextFieldOperator
108      */

109     public JTextFieldOperator txtRevision() {
110         if (_txtRevision==null) {
111             _txtRevision = new JTextFieldOperator(this, 2);
112         }
113         return _txtRevision;
114     }
115     
116     /** Tries to find "(empty means repository HEAD)" JLabel in this dialog.
117      * @return JLabelOperator
118      */

119     public JLabelOperator lblEmptyMeansRepositoryHEAD() {
120         if (_lblEmptyMeansRepositoryHEAD==null) {
121             _lblEmptyMeansRepositoryHEAD = new JLabelOperator(this, "(empty means repository HEAD)");
122         }
123         return _lblEmptyMeansRepositoryHEAD;
124     }
125
126     /** Tries to find "Search..." JButton in this dialog.
127      * @return JButtonOperator
128      */

129     public JButtonOperator btSearch() {
130         if (_btSearch==null) {
131             _btSearch = new JButtonOperator(this, "Search...");
132         }
133         return _btSearch;
134     }
135
136     /** Tries to find "Search..." JButton in this dialog.
137      * @return JButtonOperator
138      */

139     public JButtonOperator btSearch2() {
140         if (_btSearch2==null) {
141             _btSearch2 = new JButtonOperator(this, "Search...", 1);
142         }
143         return _btSearch2;
144     }
145
146     /** Tries to find "Search..." JButton in this dialog.
147      * @return JButtonOperator
148      */

149     public JButtonOperator btSearch3() {
150         if (_btSearch3==null) {
151             _btSearch3 = new JButtonOperator(this, "Search...", 2);
152         }
153         return _btSearch3;
154     }
155     
156     /** Tries to find "Previous Commit(s)" JRadioButton in this dialog.
157      * @return JRadioButtonOperator
158      */

159     public JRadioButtonOperator rbPreviousCommits() {
160         if (_rbPreviousCommits==null) {
161             _rbPreviousCommits = new JRadioButtonOperator(this, "Revert Modifications from Previous Commits");
162         }
163         return _rbPreviousCommits;
164     }
165     
166     /** Tries to find "Single Commit" JRadioButton in this dialog.
167      * @return JRadioButtonOperator
168      */

169     public JRadioButtonOperator rbSingleCommit() {
170         if (_rbSingleCommit==null) {
171             _rbSingleCommit = new JRadioButtonOperator(this, "Revert Modifications from Single Commit");
172         }
173         return _rbSingleCommit;
174     }
175
176     /** Tries to find "Local Changes" JRadioButton in this dialog.
177      * @return JRadioButtonOperator
178      */

179     public JRadioButtonOperator rbLocalChanges() {
180         if (_rbLocalChanges==null) {
181             _rbLocalChanges = new JRadioButtonOperator(this, "Revert Local Changes");
182         }
183         return _rbLocalChanges;
184     }
185
186     /** Tries to find "Revert" JButton in this dialog.
187      * @return JButtonOperator
188      */

189     public JButtonOperator btRevert() {
190         if (_btRevert==null) {
191             _btRevert = new JButtonOperator(this, "Revert");
192         }
193         return _btRevert;
194     }
195
196     /** Tries to find "Cancel" JButton in this dialog.
197      * @return JButtonOperator
198      */

199     public JButtonOperator btCancel() {
200         if (_btCancel==null) {
201             _btCancel = new JButtonOperator(this, "Cancel");
202         }
203         return _btCancel;
204     }
205
206     /** Tries to find "Help" JButton in this dialog.
207      * @return JButtonOperator
208      */

209     public JButtonOperator btHelp() {
210         if (_btHelp==null) {
211             _btHelp = new JButtonOperator(this, "Help");
212         }
213         return _btHelp;
214     }
215
216
217     //****************************************
218
// Low-level functionality definition part
219
//****************************************
220

221     /**
222      * gets text for txtStartRevision
223      *
224      * @return String text
225      */

226     public String JavaDoc getTxtStartRevision() {
227         return txtStartRevision().getText();
228     }
229
230     /**
231      * sets text for txtStartRevision
232      *
233      * @param text String text
234      */

235     public void setStartRevision(String JavaDoc text) {
236         txtStartRevision().clearText();
237         txtStartRevision().typeText(text);
238     }
239
240     /**
241      * gets text for txtEndRevision
242      *
243      * @return String text
244      */

245     public String JavaDoc getEndRevision() {
246         return txtEndRevision().getText();
247     }
248
249     /**
250      * gets text for txtRevision
251      *
252      * @return String text
253      */

254     public String JavaDoc getRevision() {
255         return txtRevision().getText();
256     }
257     
258     /**
259      * sets text for txtRevision
260      *
261      * @param text String text
262      */

263     public void setRevision(String JavaDoc text) {
264         txtRevision().clearText();
265         txtRevision().typeText(text);
266     }
267     
268     /**
269      * sets text for txtEndRevision
270      *
271      * @param text String text
272      */

273     public void setEndRevision(String JavaDoc text) {
274         txtEndRevision().clearText();
275         txtEndRevision().typeText(text);
276     }
277
278     /** clicks on "Search..." JButton
279      */

280     public void search() {
281         btSearch().push();
282     }
283
284     /** clicks on "Search..." JButton
285      */

286     public void search2() {
287         btSearch2().push();
288     }
289
290     /** clicks on "Previous Commit(s)" JRadioButton
291      */

292     public void previousCommits() {
293         rbPreviousCommits().push();
294     }
295
296     /** clicks on "Local Changes" JRadioButton
297      */

298     public void localChanges() {
299         rbLocalChanges().push();
300     }
301
302     /** clicks on "Revert" JButton
303      */

304     public void revert() {
305         btRevert().push();
306     }
307
308     /** clicks on "Cancel" JButton
309      */

310     public void cancel() {
311         btCancel().push();
312     }
313
314     /** clicks on "Help" JButton
315      */

316     public void help() {
317         btHelp().push();
318     }
319
320
321     //*****************************************
322
// High-level functionality definition part
323
//*****************************************
324

325     /**
326      * Performs verification of RevertModificationsOperator by accessing all its components.
327      */

328     public void verify() {
329         lblStartWithRevision();
330         lblEndWithRevision();
331         txtStartRevision();
332         txtEndRevision();
333         lblEmptyMeansRepositoryHEAD();
334         btSearch();
335         btSearch2();
336         rbPreviousCommits();
337         rbLocalChanges();
338         btRevert();
339         btCancel();
340         btHelp();
341     }
342 }
343
344
Popular Tags