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-2007 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: /*
043: * AddJavaProjectDialogOperator.java
044: *
045: * Created on March 29, 2005, 7:16 PM
046: */
047:
048: package org.netbeans.test.umllib;
049:
050: import javax.swing.tree.TreePath;
051: import org.netbeans.jemmy.operators.JTextFieldOperator;
052: import org.netbeans.jellytools.NbDialogOperator;
053: import org.netbeans.jellytools.nodes.Node;
054: import org.netbeans.jemmy.operators.JDialogOperator;
055: import org.netbeans.jemmy.operators.JTreeOperator;
056: import org.netbeans.jemmy.operators.JButtonOperator;
057: import org.netbeans.test.umllib.util.LabelsAndTitles;
058: import org.netbeans.jemmy.Timeout;
059:
060: /**
061: *
062: * @author VijayaBabu Mummaneni
063: */
064: public class ReverseEngProgressDialogOperator extends NbDialogOperator {
065: private JTreeOperator _javaProjects = null;
066: private JButtonOperator _btSaveMessage = null;
067: private JButtonOperator _btDone = null;
068:
069: /** Creates a new instance of AddJavaProjectDialogOperator */
070: public ReverseEngProgressDialogOperator() {
071: super (LabelsAndTitles.RE_PROGRESS_DIALOG_TITLE);
072: }
073:
074: /** Tries to find null TreeView$ExplorerTree in this dialog.
075: * @return JTreeOperator
076: */
077: public JTreeOperator javaProjects() {
078: if (_javaProjects == null) {
079: _javaProjects = new JTreeOperator(this );
080: }
081: return _javaProjects;
082: }
083:
084: /** returns selected path in java projects
085: * @return TreePath
086: */
087: public TreePath getSelectedProject() {
088: return javaProjects().getSelectionPath();
089: }
090:
091: /**
092: * Selects given project category
093: * @param project
094: */
095: public void selectProject(String project) {
096: new Node(javaProjects(), project).select();
097: }
098:
099: /** Returns operator of "Done" button.
100: * @return JButtonOperator instance of "Done" button
101: */
102: public JButtonOperator btDone() {
103: if (_btDone == null) {
104: _btDone = new JButtonOperator(this , "Done");
105: }
106: return _btDone;
107: }
108:
109: /** Pushes "Done" button. */
110: public void clickDone() {
111: btDone().push();
112: }
113:
114: public void clickDoneNoBlock() {
115: btDone().pushNoBlock();
116: }
117:
118: /** Returns operator of "SaveMessage..." button.
119: * @return JButtonOperator instance of "Done" button
120: */
121: public JButtonOperator btSaveMessage() {
122: if (_btSaveMessage == null) {
123: _btSaveMessage = new JButtonOperator(this ,
124: "Save Message...");
125: }
126: return _btSaveMessage;
127: }
128:
129: /**
130: * Pushes "SaveMessage..." button.
131: * @param resultsFileName
132: */
133: public void clickSaveMessageToFile(String resultsFileName) {
134: btSaveMessage().pushNoBlock();
135: NbDialogOperator saveDailog = new NbDialogOperator(
136: LabelsAndTitles.RE_RESULTS_SAVE_DIALOG_TITLE);
137: new Timeout("", 5000).sleep();
138: JTextFieldOperator tfOper = new JTextFieldOperator(saveDailog,
139: 0);
140: // clear text field
141: tfOper.setText("");
142: tfOper.typeText(resultsFileName);
143: JButtonOperator btOper = new JButtonOperator(saveDailog, "Save");
144: btOper.push();
145:
146: }
147:
148: public void clickSaveMessageNoBlock() {
149: btSaveMessage().pushNoBlock();
150: }
151:
152: }
|