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: package org.netbeans.jellytools.modules.javacvs;
042:
043: import org.netbeans.jellytools.Bundle;
044: import org.netbeans.jellytools.NbDialogOperator;
045: import org.netbeans.jellytools.nodes.Node;
046: import org.netbeans.jemmy.operators.JTreeOperator;
047:
048: /** Class implementing all necessary methods for handling "Browse Tags" dialog.
049: * It is opened from Checkout wizard.
050: * <br>
051: * Usage:<br>
052: * <pre>
053: * ModuleToCheckoutStepOperator moduleOper = new ModuleToCheckoutStepOperator();
054: * BrowseTagsOperator browseTagsOper = moduleOper.browseBranch();
055: * browseTagsOper.selectTag("myTag");
056: * browseTagsOper.ok();
057: *</pre>
058: *
059: * @see CheckoutWizardOperator
060: * @see ModuleToCheckoutStepOperator
061: *
062: * @author Jiri.Skrivanek@sun.com
063: */
064: public class BrowseTagsOperator extends NbDialogOperator {
065:
066: /** Waits for "Browse Tags" dialog. */
067: public BrowseTagsOperator() {
068: super (
069: Bundle
070: .getString(
071: "org.netbeans.modules.versioning.system.cvss.ui.selectors.Bundle",
072: "BK2012"));
073: }
074:
075: private JTreeOperator _tree;
076:
077: //******************************
078: // Subcomponents definition part
079: //******************************
080:
081: /** Tries to find tree in this dialog.
082: * @return JTreeOperator
083: */
084: public JTreeOperator tree() {
085: if (_tree == null) {
086: _tree = new JTreeOperator(this );
087: }
088: return _tree;
089: }
090:
091: //****************************************
092: // Low-level functionality definition part
093: //****************************************
094:
095: /** Selects a branch or tag denoted by path.
096: * @param path path to branch or tag (e.g. "Branches|mybranch")
097: */
098: public void selectPath(String path) {
099: new Node(tree(), path).select();
100: }
101:
102: /** Selects a branch of given name.
103: * @param name name of branch to be selected (e.g. "mybranch")
104: */
105: public void selectBranch(String name) {
106: String branchesLabel = Bundle
107: .getString(
108: "org.netbeans.modules.versioning.system.cvss.ui.selectors.Bundle",
109: "BK2008");
110: selectPath(branchesLabel + "|" + name);
111: }
112:
113: /** Selects a tag of given name.
114: * @param name name of tag to be selected (e.g. "mytag")
115: */
116: public void selectTag(String name) {
117: String tagsLabel = Bundle
118: .getString(
119: "org.netbeans.modules.versioning.system.cvss.ui.selectors.Bundle",
120: "BK2009");
121: selectPath(tagsLabel + "|" + name);
122: }
123:
124: //*****************************************
125: // High-level functionality definition part
126: //*****************************************
127:
128: /**
129: * Performs verification of BrowseTagsOperator by accessing all its components.
130: */
131: public void verify() {
132: tree();
133: }
134: }
|