001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: /*
042: * WorkDirStepOperator.java
043: *
044: * Created on 19/04/06 13:25
045: */
046: package org.netbeans.test.subversion.operators;
047:
048: import org.netbeans.jellytools.WizardOperator;
049: import org.netbeans.jemmy.operators.*;
050:
051: /**
052: * Class implementing all necessary methods for handling "WorkDirStepOperator" NbDialog.
053: *
054: *
055: * @author peter
056: * @version 1.0
057: */
058: public class WorkDirStepOperator extends WizardOperator {
059:
060: /**
061: * Creates new WorkDirStepOperator that can handle it.
062: */
063: public WorkDirStepOperator() {
064: super ("");
065: stepsWaitSelectedValue("Folders to Checkout");
066: }
067:
068: private JLabelOperator _lblSteps;
069: private JListOperator _lstSteps;
070: private JLabelOperator _lblWorkdir;
071: private JLabelOperator _lblSpecifyTheFoldersToCheckoutFromSubversionRepository;
072: private JLabelOperator _lblRepositoryRevision;
073: private JLabelOperator _lblRepositoryFolders;
074: private JTextFieldOperator repositoryFolder;
075: private JButtonOperator _btSearch;
076: private JLabelOperator _lblLocalSubversionWorkingCopy;
077: private JTextFieldOperator repositoryRevision;
078: private JLabelOperator _lblEmptyMeansRepositoryHEAD;
079: private JTextFieldOperator localFolder;
080: private JButtonOperator _btBrowseRepository;
081: private JButtonOperator _btBrowseLocalFolder;
082: private JLabelOperator _lblLocalFolder;
083: private JLabelOperator _lblSpecifyTheLocalFolderToCheckoutFoldersInto;
084: private JLabelOperator _lblWizardDescriptor$FixedHeightLabel;
085: private JButtonOperator _btBack;
086: private JButtonOperator _btNext;
087: private JButtonOperator _btFinish;
088: private JButtonOperator _btCancel;
089: private JButtonOperator _btHelp;
090: private JCheckBoxOperator _cbCheckoutContentOnly;
091:
092: //******************************
093: // Subcomponents definition part
094: //******************************
095:
096: /** Tries to find "Steps" JLabel in this dialog.
097: * @return JLabelOperator
098: */
099: public JLabelOperator lblSteps() {
100: if (_lblSteps == null) {
101: _lblSteps = new JLabelOperator(this , "Steps");
102: }
103: return _lblSteps;
104: }
105:
106: /** Tries to find "Revert Local Changes" JCheckBox in this dialog.
107: * @return JCheckBoxOperator
108: */
109: public JCheckBoxOperator cbCheckoutContentOnly() {
110: if (_cbCheckoutContentOnly == null) {
111: _cbCheckoutContentOnly = new JCheckBoxOperator(this ,
112: "Checkout only");
113: }
114: return _cbCheckoutContentOnly;
115: }
116:
117: /** Tries to find null JList in this dialog.
118: * @return JListOperator
119: */
120: public JListOperator lstSteps() {
121: if (_lstSteps == null) {
122: _lstSteps = new JListOperator(this );
123: }
124: return _lstSteps;
125: }
126:
127: /** Tries to find "Specify the folder(s) to checkout from Subversion repository." JLabel in this dialog.
128: * @return JLabelOperator
129: */
130: public JLabelOperator lblSpecifyTheFoldersToCheckoutFromSubversionRepository() {
131: if (_lblSpecifyTheFoldersToCheckoutFromSubversionRepository == null) {
132: _lblSpecifyTheFoldersToCheckoutFromSubversionRepository = new JLabelOperator(
133: this ,
134: "Specify the folder(s) to checkout from Subversion repository.");
135: }
136: return _lblSpecifyTheFoldersToCheckoutFromSubversionRepository;
137: }
138:
139: /** Tries to find "Repository Revision:" JLabel in this dialog.
140: * @return JLabelOperator
141: */
142: public JLabelOperator lblRepositoryRevision() {
143: if (_lblRepositoryRevision == null) {
144: _lblRepositoryRevision = new JLabelOperator(this ,
145: "Repository Revision:");
146: }
147: return _lblRepositoryRevision;
148: }
149:
150: /** Tries to find "Repository Folder(s):" JLabel in this dialog.
151: * @return JLabelOperator
152: */
153: public JLabelOperator lblRepositoryFolders() {
154: if (_lblRepositoryFolders == null) {
155: _lblRepositoryFolders = new JLabelOperator(this ,
156: "Repository Folder(s):");
157: }
158: return _lblRepositoryFolders;
159: }
160:
161: /** Tries to find null JTextField in this dialog.
162: * @return JTextFieldOperator
163: */
164: public JTextFieldOperator txtRepositoryFolder() {
165: if (repositoryFolder == null) {
166: repositoryFolder = new JTextFieldOperator(this , 1);
167: }
168: return repositoryFolder;
169: }
170:
171: public void setRepositoryFolder(String text) {
172: txtRepositoryFolder().clearText();
173: txtRepositoryFolder().typeText(text);
174: }
175:
176: /** Tries to find "Search..." JButton in this dialog.
177: * @return JButtonOperator
178: */
179: public JButtonOperator btSearch() {
180: if (_btSearch == null) {
181: _btSearch = new JButtonOperator(this , "Search...");
182: }
183: return _btSearch;
184: }
185:
186: /** Tries to find "(local Subversion working copy) " JLabel in this dialog.
187: * @return JLabelOperator
188: */
189: public JLabelOperator lblLocalSubversionWorkingCopy() {
190: if (_lblLocalSubversionWorkingCopy == null) {
191: _lblLocalSubversionWorkingCopy = new JLabelOperator(this ,
192: "(local Subversion working copy)");
193: }
194: return _lblLocalSubversionWorkingCopy;
195: }
196:
197: /** Tries to find null JTextField in this dialog.
198: * @return JTextFieldOperator
199: */
200: public JTextFieldOperator txtRepositoryRevision() {
201: if (repositoryRevision == null) {
202: repositoryRevision = new JTextFieldOperator(this );
203: }
204: return repositoryRevision;
205: }
206:
207: public void setRepositoryRevision(String text) {
208: txtRepositoryRevision().clearText();
209: txtRepositoryRevision().typeText(text);
210: }
211:
212: /** Tries to find "(empty means repository HEAD)" JLabel in this dialog.
213: * @return JLabelOperator
214: */
215: public JLabelOperator lblEmptyMeansRepositoryHEAD() {
216: if (_lblEmptyMeansRepositoryHEAD == null) {
217: _lblEmptyMeansRepositoryHEAD = new JLabelOperator(this ,
218: "(empty means repository HEAD)");
219: }
220: return _lblEmptyMeansRepositoryHEAD;
221: }
222:
223: /** Tries to find null JTextField in this dialog.
224: * @return JTextFieldOperator
225: */
226: public JTextFieldOperator txtLocalFolder() {
227: if (localFolder == null) {
228: localFolder = new JTextFieldOperator(this , 2);
229: }
230: return localFolder;
231: }
232:
233: public void setLocalFolder(String text) {
234: txtLocalFolder().clearText();
235: txtLocalFolder().typeText(text);
236: }
237:
238: /** Tries to find "Browse..." JButton in this dialog.
239: * @return JButtonOperator
240: */
241: public JButtonOperator btBrowseRepository() {
242: if (_btBrowseRepository == null) {
243: _btBrowseRepository = new JButtonOperator(this , "Browse");
244: }
245: return _btBrowseRepository;
246: }
247:
248: /** Tries to find "Browse..." JButton in this dialog.
249: * @return JButtonOperator
250: */
251: public JButtonOperator btBrowseLocalFolder() {
252: if (_btBrowseLocalFolder == null) {
253: _btBrowseLocalFolder = new JButtonOperator(this , "Browse",
254: 1);
255: }
256: return _btBrowseLocalFolder;
257: }
258:
259: /** Tries to find "Local Folder:" JLabel in this dialog.
260: * @return JLabelOperator
261: */
262: public JLabelOperator lblLocalFolder() {
263: if (_lblLocalFolder == null) {
264: _lblLocalFolder = new JLabelOperator(this , "Local Folder:");
265: }
266: return _lblLocalFolder;
267: }
268:
269: /** Tries to find "Specify the local folder to checkout folders into." JLabel in this dialog.
270: * @return JLabelOperator
271: */
272: public JLabelOperator lblSpecifyTheLocalFolderToCheckoutFoldersInto() {
273: if (_lblSpecifyTheLocalFolderToCheckoutFoldersInto == null) {
274: _lblSpecifyTheLocalFolderToCheckoutFoldersInto = new JLabelOperator(
275: this ,
276: "Specify the local folder to checkout folders into.");
277: }
278: return _lblSpecifyTheLocalFolderToCheckoutFoldersInto;
279: }
280:
281: /** Tries to find " " WizardDescriptor$FixedHeightLabel in this dialog.
282: * @return JLabelOperator
283: */
284: public JLabelOperator lblWizardDescriptor$FixedHeightLabel() {
285: if (_lblWizardDescriptor$FixedHeightLabel == null) {
286: _lblWizardDescriptor$FixedHeightLabel = new JLabelOperator(
287: this , " ", 7);
288: }
289: return _lblWizardDescriptor$FixedHeightLabel;
290: }
291:
292: /** Tries to find "< Back" JButton in this dialog.
293: * @return JButtonOperator
294: */
295: public JButtonOperator btBack() {
296: if (_btBack == null) {
297: _btBack = new JButtonOperator(this , "< Back");
298: }
299: return _btBack;
300: }
301:
302: /** Tries to find "Next >" JButton in this dialog.
303: * @return JButtonOperator
304: */
305: public JButtonOperator btNext() {
306: if (_btNext == null) {
307: _btNext = new JButtonOperator(this , "Next >");
308: }
309: return _btNext;
310: }
311:
312: /** Tries to find "Finish" JButton in this dialog.
313: * @return JButtonOperator
314: */
315: public JButtonOperator btFinish() {
316: if (_btFinish == null) {
317: _btFinish = new JButtonOperator(this , "Finish");
318: }
319: return _btFinish;
320: }
321:
322: /** Tries to find "Cancel" JButton in this dialog.
323: * @return JButtonOperator
324: */
325: public JButtonOperator btCancel() {
326: if (_btCancel == null) {
327: _btCancel = new JButtonOperator(this , "Cancel");
328: }
329: return _btCancel;
330: }
331:
332: /** Tries to find "Help" JButton in this dialog.
333: * @return JButtonOperator
334: */
335: public JButtonOperator btHelp() {
336: if (_btHelp == null) {
337: _btHelp = new JButtonOperator(this , "Help");
338: }
339: return _btHelp;
340: }
341:
342: //****************************************
343: // Low-level functionality definition part
344: //****************************************
345:
346: /**
347: * gets text for txtRepositoryFolder
348: *
349: * @return String text
350: */
351: public String getRepositoryFolder() {
352: return txtRepositoryFolder().getText();
353: }
354:
355: /** clicks on "Search..." JButton
356: */
357: public SearchRevisionsOperator search() {
358: btSearch().pushNoBlock();
359: return new SearchRevisionsOperator();
360: }
361:
362: /**
363: * gets text for txtRepositoryRevision
364: *
365: * @return String text
366: */
367: public String getRevisionNumber() {
368: return txtRepositoryRevision().getText();
369: }
370:
371: /**
372: * gets text for txtLocalFolder
373: *
374: * @return String text
375: */
376: public String getLocalFolder() {
377: return txtLocalFolder().getText();
378: }
379:
380: /** checks or unchecks given JCheckBox
381: * @param state boolean requested state
382: */
383: public void checkCheckoutContentOnly(boolean state) {
384: if (cbCheckoutContentOnly().isSelected() != state) {
385: cbCheckoutContentOnly().push();
386: }
387: }
388:
389: /** clicks on "< Back" JButton
390: */
391: public void back() {
392: btBack().push();
393: }
394:
395: /** clicks on "Next >" JButton
396: */
397: public void next() {
398: btNext().push();
399: }
400:
401: /** clicks on "Finish" JButton
402: */
403: public void finish() {
404: btFinish().push();
405: }
406:
407: /** clicks on "Cancel" JButton
408: */
409: public void cancel() {
410: btCancel().push();
411: }
412:
413: /** clicks on "Help" JButton
414: */
415: public void help() {
416: btHelp().push();
417: }
418:
419: public RepositoryBrowserOperator browseRepository() {
420: btBrowseRepository().pushNoBlock();
421: return new RepositoryBrowserOperator();
422: }
423:
424: /** clicks on "Browse..." and returns JFileChooserOperator instance.
425: * @return instance of JFileChooserOperator
426: */
427: public JFileChooserOperator browseLocalFolder() {
428: btBrowseLocalFolder().pushNoBlock();
429: return new JFileChooserOperator();
430: }
431:
432: //*****************************************
433: // High-level functionality definition part
434: //*****************************************
435:
436: /**
437: * Performs verification of WorkDirStepOperator by accessing all its components.
438: */
439: public void verify() {
440: lblSteps();
441: lstSteps();
442: lblSpecifyTheFoldersToCheckoutFromSubversionRepository();
443: lblRepositoryRevision();
444: lblRepositoryFolders();
445: txtRepositoryFolder();
446: btSearch();
447: lblLocalSubversionWorkingCopy();
448: txtRepositoryRevision();
449: lblEmptyMeansRepositoryHEAD();
450: txtLocalFolder();
451: btBrowseRepository();
452: btBrowseLocalFolder();
453: lblLocalFolder();
454: cbCheckoutContentOnly();
455: lblSpecifyTheLocalFolderToCheckoutFoldersInto();
456: lblWizardDescriptor$FixedHeightLabel();
457: btBack();
458: btNext();
459: btFinish();
460: btCancel();
461: btHelp();
462: }
463: }
|