KickJava   Java API By Example, From Geeks To Geeks.

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


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  * WorkDirStepOperator.java
21  *
22  * Created on 19/04/06 13:25
23  */

24 package org.netbeans.test.subversion.operators;
25
26 import org.netbeans.jellytools.WizardOperator;
27 import org.netbeans.jemmy.operators.*;
28
29 /**
30  * Class implementing all necessary methods for handling "WorkDirStepOperator" NbDialog.
31  *
32  *
33  * @author peter
34  * @version 1.0
35  */

36 public class WorkDirStepOperator extends WizardOperator {
37
38     /**
39      * Creates new WorkDirStepOperator that can handle it.
40      */

41     public WorkDirStepOperator() {
42         super("");
43         stepsWaitSelectedValue("Folders to Checkout");
44     }
45
46     private JLabelOperator _lblSteps;
47     private JListOperator _lstSteps;
48     private JLabelOperator _lblWorkdir;
49     private JLabelOperator _lblSpecifyTheFoldersToCheckoutFromSubversionRepository;
50     private JLabelOperator _lblRepositoryRevision;
51     private JLabelOperator _lblRepositoryFolders;
52     private JTextFieldOperator repositoryFolder;
53     private JButtonOperator _btSearch;
54     private JLabelOperator _lblLocalSubversionWorkingCopy;
55     private JTextFieldOperator repositoryRevision;
56     private JLabelOperator _lblEmptyMeansRepositoryHEAD;
57     private JTextFieldOperator localFolder;
58     private JButtonOperator _btBrowseRepository;
59     private JButtonOperator _btBrowseLocalFolder;
60     private JLabelOperator _lblLocalFolder;
61     private JLabelOperator _lblSpecifyTheLocalFolderToCheckoutFoldersInto;
62     private JLabelOperator _lblWizardDescriptor$FixedHeightLabel;
63     private JButtonOperator _btBack;
64     private JButtonOperator _btNext;
65     private JButtonOperator _btFinish;
66     private JButtonOperator _btCancel;
67     private JButtonOperator _btHelp;
68     private JCheckBoxOperator _cbCheckoutContentOnly;
69
70
71     //******************************
72
// Subcomponents definition part
73
//******************************
74

75     /** Tries to find "Steps" JLabel in this dialog.
76      * @return JLabelOperator
77      */

78     public JLabelOperator lblSteps() {
79         if (_lblSteps==null) {
80             _lblSteps = new JLabelOperator(this, "Steps");
81         }
82         return _lblSteps;
83     }
84
85     /** Tries to find "Revert Local Changes" JCheckBox in this dialog.
86      * @return JCheckBoxOperator
87      */

88     public JCheckBoxOperator cbCheckoutContentOnly() {
89         if (_cbCheckoutContentOnly==null) {
90             _cbCheckoutContentOnly = new JCheckBoxOperator(this, "Checkout only");
91         }
92         return _cbCheckoutContentOnly;
93     }
94     
95     /** Tries to find null JList in this dialog.
96      * @return JListOperator
97      */

98     public JListOperator lstSteps() {
99         if (_lstSteps==null) {
100             _lstSteps = new JListOperator(this);
101         }
102         return _lstSteps;
103     }
104
105     /** Tries to find "Specify the folder(s) to checkout from Subversion repository." JLabel in this dialog.
106      * @return JLabelOperator
107      */

108     public JLabelOperator lblSpecifyTheFoldersToCheckoutFromSubversionRepository() {
109         if (_lblSpecifyTheFoldersToCheckoutFromSubversionRepository==null) {
110             _lblSpecifyTheFoldersToCheckoutFromSubversionRepository = new JLabelOperator(this, "Specify the folder(s) to checkout from Subversion repository.");
111         }
112         return _lblSpecifyTheFoldersToCheckoutFromSubversionRepository;
113     }
114
115     /** Tries to find "Repository Revision:" JLabel in this dialog.
116      * @return JLabelOperator
117      */

118     public JLabelOperator lblRepositoryRevision() {
119         if (_lblRepositoryRevision==null) {
120             _lblRepositoryRevision = new JLabelOperator(this, "Repository Revision:");
121         }
122         return _lblRepositoryRevision;
123     }
124
125     /** Tries to find "Repository Folder(s):" JLabel in this dialog.
126      * @return JLabelOperator
127      */

128     public JLabelOperator lblRepositoryFolders() {
129         if (_lblRepositoryFolders==null) {
130             _lblRepositoryFolders = new JLabelOperator(this, "Repository Folder(s):");
131         }
132         return _lblRepositoryFolders;
133     }
134
135     /** Tries to find null JTextField in this dialog.
136      * @return JTextFieldOperator
137      */

138     public JTextFieldOperator txtRepositoryFolder() {
139         if (repositoryFolder==null) {
140             repositoryFolder = new JTextFieldOperator(this, 1);
141         }
142         return repositoryFolder;
143     }
144     
145     public void setRepositoryFolder(String JavaDoc text) {
146         txtRepositoryFolder().clearText();
147         txtRepositoryFolder().typeText(text);
148     }
149
150     /** Tries to find "Search..." JButton in this dialog.
151      * @return JButtonOperator
152      */

153     public JButtonOperator btSearch() {
154         if (_btSearch==null) {
155             _btSearch = new JButtonOperator(this, "Search...");
156         }
157         return _btSearch;
158     }
159
160     /** Tries to find "(local Subversion working copy) " JLabel in this dialog.
161      * @return JLabelOperator
162      */

163     public JLabelOperator lblLocalSubversionWorkingCopy() {
164         if (_lblLocalSubversionWorkingCopy==null) {
165             _lblLocalSubversionWorkingCopy = new JLabelOperator(this, "(local Subversion working copy)");
166         }
167         return _lblLocalSubversionWorkingCopy;
168     }
169
170     /** Tries to find null JTextField in this dialog.
171      * @return JTextFieldOperator
172      */

173     public JTextFieldOperator txtRepositoryRevision() {
174         if (repositoryRevision==null) {
175             repositoryRevision = new JTextFieldOperator(this);
176         }
177         return repositoryRevision;
178     }
179     
180     public void setRepositoryRevision(String JavaDoc text) {
181         txtRepositoryRevision().clearText();
182         txtRepositoryRevision().typeText(text);
183     }
184
185     /** Tries to find "(empty means repository HEAD)" JLabel in this dialog.
186      * @return JLabelOperator
187      */

188     public JLabelOperator lblEmptyMeansRepositoryHEAD() {
189         if (_lblEmptyMeansRepositoryHEAD==null) {
190             _lblEmptyMeansRepositoryHEAD = new JLabelOperator(this, "(empty means repository HEAD)");
191         }
192         return _lblEmptyMeansRepositoryHEAD;
193     }
194
195     /** Tries to find null JTextField in this dialog.
196      * @return JTextFieldOperator
197      */

198     public JTextFieldOperator txtLocalFolder() {
199         if (localFolder==null) {
200             localFolder = new JTextFieldOperator(this, 2);
201         }
202         return localFolder;
203     }
204     
205     public void setLocalFolder(String JavaDoc text) {
206         txtLocalFolder().clearText();
207         txtLocalFolder().typeText(text);
208     }
209
210     /** Tries to find "Browse..." JButton in this dialog.
211      * @return JButtonOperator
212      */

213     public JButtonOperator btBrowseRepository() {
214         if (_btBrowseRepository==null) {
215             _btBrowseRepository = new JButtonOperator(this, "Browse");
216         }
217         return _btBrowseRepository;
218     }
219
220     /** Tries to find "Browse..." JButton in this dialog.
221      * @return JButtonOperator
222      */

223     public JButtonOperator btBrowseLocalFolder() {
224         if (_btBrowseLocalFolder==null) {
225             _btBrowseLocalFolder = new JButtonOperator(this, "Browse", 1);
226         }
227         return _btBrowseLocalFolder;
228     }
229
230     /** Tries to find "Local Folder:" JLabel in this dialog.
231      * @return JLabelOperator
232      */

233     public JLabelOperator lblLocalFolder() {
234         if (_lblLocalFolder==null) {
235             _lblLocalFolder = new JLabelOperator(this, "Local Folder:");
236         }
237         return _lblLocalFolder;
238     }
239
240     /** Tries to find "Specify the local folder to checkout folders into." JLabel in this dialog.
241      * @return JLabelOperator
242      */

243     public JLabelOperator lblSpecifyTheLocalFolderToCheckoutFoldersInto() {
244         if (_lblSpecifyTheLocalFolderToCheckoutFoldersInto==null) {
245             _lblSpecifyTheLocalFolderToCheckoutFoldersInto = new JLabelOperator(this, "Specify the local folder to checkout folders into.");
246         }
247         return _lblSpecifyTheLocalFolderToCheckoutFoldersInto;
248     }
249
250     /** Tries to find " " WizardDescriptor$FixedHeightLabel in this dialog.
251      * @return JLabelOperator
252      */

253     public JLabelOperator lblWizardDescriptor$FixedHeightLabel() {
254         if (_lblWizardDescriptor$FixedHeightLabel==null) {
255             _lblWizardDescriptor$FixedHeightLabel = new JLabelOperator(this, " ", 7);
256         }
257         return _lblWizardDescriptor$FixedHeightLabel;
258     }
259
260     /** Tries to find "< Back" JButton in this dialog.
261      * @return JButtonOperator
262      */

263     public JButtonOperator btBack() {
264         if (_btBack==null) {
265             _btBack = new JButtonOperator(this, "< Back");
266         }
267         return _btBack;
268     }
269
270     /** Tries to find "Next >" JButton in this dialog.
271      * @return JButtonOperator
272      */

273     public JButtonOperator btNext() {
274         if (_btNext==null) {
275             _btNext = new JButtonOperator(this, "Next >");
276         }
277         return _btNext;
278     }
279
280     /** Tries to find "Finish" JButton in this dialog.
281      * @return JButtonOperator
282      */

283     public JButtonOperator btFinish() {
284         if (_btFinish==null) {
285             _btFinish = new JButtonOperator(this, "Finish");
286         }
287         return _btFinish;
288     }
289
290     /** Tries to find "Cancel" JButton in this dialog.
291      * @return JButtonOperator
292      */

293     public JButtonOperator btCancel() {
294         if (_btCancel==null) {
295             _btCancel = new JButtonOperator(this, "Cancel");
296         }
297         return _btCancel;
298     }
299
300     /** Tries to find "Help" JButton in this dialog.
301      * @return JButtonOperator
302      */

303     public JButtonOperator btHelp() {
304         if (_btHelp==null) {
305             _btHelp = new JButtonOperator(this, "Help");
306         }
307         return _btHelp;
308     }
309
310
311     //****************************************
312
// Low-level functionality definition part
313
//****************************************
314

315     /**
316      * gets text for txtRepositoryFolder
317      *
318      * @return String text
319      */

320     public String JavaDoc getRepositoryFolder() {
321         return txtRepositoryFolder().getText();
322     }
323
324     /** clicks on "Search..." JButton
325      */

326     public SearchRevisionsOperator search() {
327         btSearch().pushNoBlock();
328         return new SearchRevisionsOperator();
329     }
330
331     /**
332      * gets text for txtRepositoryRevision
333      *
334      * @return String text
335      */

336     public String JavaDoc getRevisionNumber() {
337         return txtRepositoryRevision().getText();
338     }
339
340     /**
341      * gets text for txtLocalFolder
342      *
343      * @return String text
344      */

345     public String JavaDoc getLocalFolder() {
346         return txtLocalFolder().getText();
347     }
348
349     /** checks or unchecks given JCheckBox
350      * @param state boolean requested state
351      */

352     public void checkCheckoutContentOnly(boolean state) {
353         if (cbCheckoutContentOnly().isSelected()!=state) {
354             cbCheckoutContentOnly().push();
355         }
356     }
357     
358     /** clicks on "< Back" JButton
359      */

360     public void back() {
361         btBack().push();
362     }
363
364     /** clicks on "Next >" JButton
365      */

366     public void next() {
367         btNext().push();
368     }
369
370     /** clicks on "Finish" JButton
371      */

372     public void finish() {
373         btFinish().push();
374     }
375
376     /** clicks on "Cancel" JButton
377      */

378     public void cancel() {
379         btCancel().push();
380     }
381
382     /** clicks on "Help" JButton
383      */

384     public void help() {
385         btHelp().push();
386     }
387     
388     public RepositoryBrowserOperator browseRepository() {
389         btBrowseRepository().pushNoBlock();
390         return new RepositoryBrowserOperator();
391     }
392     
393     /** clicks on "Browse..." and returns JFileChooserOperator instance.
394      * @return instance of JFileChooserOperator
395      */

396     public JFileChooserOperator browseLocalFolder() {
397         btBrowseLocalFolder().pushNoBlock();
398         return new JFileChooserOperator();
399     }
400
401
402     //*****************************************
403
// High-level functionality definition part
404
//*****************************************
405

406     /**
407      * Performs verification of WorkDirStepOperator by accessing all its components.
408      */

409     public void verify() {
410         lblSteps();
411         lstSteps();
412         lblSpecifyTheFoldersToCheckoutFromSubversionRepository();
413         lblRepositoryRevision();
414         lblRepositoryFolders();
415         txtRepositoryFolder();
416         btSearch();
417         lblLocalSubversionWorkingCopy();
418         txtRepositoryRevision();
419         lblEmptyMeansRepositoryHEAD();
420         txtLocalFolder();
421         btBrowseRepository();
422         btBrowseLocalFolder();
423         lblLocalFolder();
424         cbCheckoutContentOnly();
425         lblSpecifyTheLocalFolderToCheckoutFoldersInto();
426         lblWizardDescriptor$FixedHeightLabel();
427         btBack();
428         btNext();
429         btFinish();
430         btCancel();
431         btHelp();
432     }
433 }
434
435
Popular Tags