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;
042:
043: import org.netbeans.jellytools.nodes.Node;
044: import org.netbeans.jemmy.JemmyException;
045: import org.netbeans.jemmy.Waitable;
046: import org.netbeans.jemmy.Waiter;
047: import org.netbeans.jemmy.operators.JLabelOperator;
048: import org.netbeans.jemmy.operators.JComboBoxOperator;
049: import javax.swing.JDialog;
050:
051: /**
052: * Handles Build and Run Actions panel of New Project wizard
053: * for J2SE Ant Project.<br>
054: *
055: * Usage:
056: * <pre>
057: * BuildAndRunActionsStepOperator brop = new BuildAndRunActionsStepOperator();
058: * brop.selectBuild("clean");
059: * brop.selectClean("clean");
060: * brop.selectRun("clean");
061: * brop.selectGenerateJavadoc("clean");
062: * brop.selectTest("clean");
063: * </pre>
064: *
065: * @author tb115823
066: */
067: public class BuildAndRunActionsStepOperator extends
068: NewProjectWizardOperator {
069:
070: private JLabelOperator _lblBuild;
071: private JLabelOperator _lblClean;
072: private JLabelOperator _lblRun;
073: private JLabelOperator _lblGenerateJavadoc;
074: private JLabelOperator _lblTest;
075: private JLabelOperator _lblOnlineError;
076: private JComboBoxOperator _cboBuild;
077: private JComboBoxOperator _cboClean;
078: private JComboBoxOperator _cboRun;
079: private JComboBoxOperator _cboGenerateJavadoc;
080: private JComboBoxOperator _cboTest;
081:
082: /** Tries to find "Build:" JLabel in this dialog.
083: * @return JLabelOperator
084: */
085: public JLabelOperator lblBuild() {
086: if (_lblBuild == null) {
087: _lblBuild = new JLabelOperator(this , "Build:");//NOI18N
088: }
089: return _lblBuild;
090: }
091:
092: /** Tries to find "Clean:" JLabel in this dialog.
093: * @return JLabelOperator
094: */
095: public JLabelOperator lblClean() {
096: if (_lblClean == null) {
097: _lblClean = new JLabelOperator(this , "Clean:");//NOI18N
098: }
099: return _lblClean;
100: }
101:
102: /** Tries to find "Run:" JLabel in this dialog.
103: * @return JLabelOperator
104: */
105: public JLabelOperator lblRun() {
106: if (_lblRun == null) {
107: _lblRun = new JLabelOperator(this , "Run:");//NOI18N
108: }
109: return _lblRun;
110: }
111:
112: /** Tries to find "Generate Javadoc:" JLabel in this dialog.
113: * @return JLabelOperator
114: */
115: public JLabelOperator lblGenerateJavadoc() {
116: if (_lblGenerateJavadoc == null) {
117: _lblGenerateJavadoc = new JLabelOperator(this ,
118: "Generate Javadoc:");//NOI18N
119: }
120: return _lblGenerateJavadoc;
121: }
122:
123: /** Tries to find "Test:" JLabel in this dialog.
124: * @return JLabelOperator
125: */
126: public JLabelOperator lblTest() {
127: if (_lblTest == null) {
128: _lblTest = new JLabelOperator(this , "Test:");//NOI18N
129: }
130: return _lblTest;
131: }
132:
133: /** Tries to find null JComboBox in this dialog.
134: * @return JComboBoxOperator
135: */
136: public JComboBoxOperator cboBuild() {
137: if (_cboBuild == null) {
138: _cboBuild = new JComboBoxOperator(this );
139: }
140: return _cboBuild;
141: }
142:
143: /** Tries to find null JComboBox in this dialog.
144: * @return JComboBoxOperator
145: */
146: public JComboBoxOperator cboClean() {
147: if (_cboClean == null) {
148: _cboClean = new JComboBoxOperator(this , 1);
149: }
150: return _cboClean;
151: }
152:
153: /** Tries to find null JComboBox in this dialog.
154: * @return JComboBoxOperator
155: */
156: public JComboBoxOperator cboRun() {
157: if (_cboRun == null) {
158: _cboRun = new JComboBoxOperator(this , 2);
159: }
160: return _cboRun;
161: }
162:
163: /** Tries to find null JComboBox in this dialog.
164: * @return JComboBoxOperator
165: */
166: public JComboBoxOperator cboGenerateJavadoc() {
167: if (_cboGenerateJavadoc == null) {
168: _cboGenerateJavadoc = new JComboBoxOperator(this , 3);
169: }
170: return _cboGenerateJavadoc;
171: }
172:
173: /** Tries to find null JComboBox in this dialog.
174: * @return JComboBoxOperator
175: */
176: public JComboBoxOperator cboTest() {
177: if (_cboTest == null) {
178: _cboTest = new JComboBoxOperator(this , 4);
179: }
180: return _cboTest;
181: }
182:
183: /** Tries to find " " JLabel in this dialog.
184: * @return JLabelOperator
185: */
186: public JLabelOperator lblOnlineError() {
187: if (_lblOnlineError == null) {
188: _lblOnlineError = new JLabelOperator(this , " ", 3);
189: }
190: return _lblOnlineError;
191: }
192:
193: /** returns selected item for cboBuild
194: * @return String item
195: */
196: public String getSelectedBuild() {
197: return cboBuild().getSelectedItem().toString();
198: }
199:
200: /** selects item for cboBuild
201: * @param item String item
202: */
203: public void selectBuild(String item) {
204: cboBuild().selectItem(item);
205: }
206:
207: /** returns selected item for cboClean
208: * @return String item
209: */
210: public String getSelectedClean() {
211: return cboClean().getSelectedItem().toString();
212: }
213:
214: /** selects item for cboClean
215: * @param item String item
216: */
217: public void selectClean(String item) {
218: cboClean().selectItem(item);
219: }
220:
221: /** returns selected item for cboRun
222: * @return String item
223: */
224: public String getSelectedRun() {
225: return cboRun().getSelectedItem().toString();
226: }
227:
228: /** selects item for cboRun
229: * @param item String item
230: */
231: public void selectRun(String item) {
232: cboRun().selectItem(item);
233: }
234:
235: /** returns selected item for cboGenerateJavadoc
236: * @return String item
237: */
238: public String getSelectedGenerateJavadoc() {
239: return cboGenerateJavadoc().getSelectedItem().toString();
240: }
241:
242: /** selects item for cboGenerateJavadoc
243: * @param item String item
244: */
245: public void selectGenerateJavadoc(String item) {
246: cboGenerateJavadoc().selectItem(item);
247: }
248:
249: /** returns selected item for cboTest
250: * @return String item
251: */
252: public String getSelectedTest() {
253: return cboTest().getSelectedItem().toString();
254: }
255:
256: /** selects item for cboTest
257: * @param item String item
258: */
259: public void selectTest(String item) {
260: cboTest().selectItem(item);
261: }
262:
263: /** Performs verification of NewJ2SEAntProject by accessing all its components.
264: */
265: public void verify() {
266: lblBuild();
267: lblClean();
268: lblRun();
269: lblGenerateJavadoc();
270: lblTest();
271: cboBuild();
272: cboClean();
273: cboRun();
274: cboGenerateJavadoc();
275: cboTest();
276: lblOnlineError();
277: }
278:
279: }
|