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.jemmy.JemmyException;
044: import org.netbeans.jemmy.Waitable;
045: import org.netbeans.jemmy.Waiter;
046: import org.netbeans.jemmy.operators.JButtonOperator;
047: import org.netbeans.jemmy.operators.JLabelOperator;
048: import org.netbeans.jemmy.operators.JListOperator;
049: import org.netbeans.jemmy.operators.JComboBoxOperator;
050: import org.netbeans.jemmy.operators.JTextFieldOperator;
051: import javax.swing.JDialog;
052: import javax.swing.JTextField;
053:
054: /**
055: * Handle "Classpath" panel of the New Project wizard
056: * for J2SE Ant Project.<br>
057: * Usage:
058: * <pre>
059: * </pre>
060: *
061: * @author tb115823
062: */
063: public class ClasspathStepOperator extends NewProjectWizardOperator {
064:
065: private JLabelOperator _lblSourcePackageFolder;
066: private JLabelOperator _lblClasspath;
067: private JButtonOperator _btAddJARFolder;
068: private JButtonOperator _btRemove;
069: private JLabelOperator _lblOutputFolderOrJAR;
070: private JTextFieldOperator _txtOutputFolder;
071: private JButtonOperator _btBrowse;
072: private JListOperator _lstClasspath;
073: private JComboBoxOperator _cboSourcePackageFolder;
074: private JButtonOperator _btMoveUp;
075: private JButtonOperator _btMoveDown;
076: private JLabelOperator _lblOnlineError;
077:
078: /** Tries to find "Source Package Folder:" JLabel in this dialog.
079: * @return JLabelOperator
080: */
081: public JLabelOperator lblSourcePackageFolder() {
082: if (_lblSourcePackageFolder == null) {
083: _lblSourcePackageFolder = new JLabelOperator(this ,
084: "Source Package Folder:");//TODO I18N
085: }
086: return _lblSourcePackageFolder;
087: }
088:
089: /** Tries to find "Classpath:" JLabel in this dialog.
090: * @return JLabelOperator
091: */
092: public JLabelOperator lblClasspath() {
093: if (_lblClasspath == null) {
094: _lblClasspath = new JLabelOperator(this , "Classpath:");//TODO I18N
095: }
096: return _lblClasspath;
097: }
098:
099: /** Tries to find "Add JAR/Folder..." JButton in this dialog.
100: * @return JButtonOperator
101: */
102: public JButtonOperator btAddJARFolder() {
103: if (_btAddJARFolder == null) {
104: _btAddJARFolder = new JButtonOperator(this ,
105: "Add JAR/Folder...");//TODO I18N
106: }
107: return _btAddJARFolder;
108: }
109:
110: /** Tries to find "Remove" JButton in this dialog.
111: * @return JButtonOperator
112: */
113: public JButtonOperator btRemove() {
114: if (_btRemove == null) {
115: _btRemove = new JButtonOperator(this , "Remove");//TODO I18N
116: }
117: return _btRemove;
118: }
119:
120: /** Tries to find "Output Folder or JAR:" JLabel in this dialog.
121: * @return JLabelOperator
122: */
123: public JLabelOperator lblOutputFolderOrJAR() {
124: if (_lblOutputFolderOrJAR == null) {
125: _lblOutputFolderOrJAR = new JLabelOperator(this ,
126: "Output Folder or JAR:");//TODO I18N
127: }
128: return _lblOutputFolderOrJAR;
129: }
130:
131: /** Tries to find null JTextField in this dialog.
132: * @return JTextFieldOperator
133: */
134: public JTextFieldOperator txtOutputFolder() {
135: if (_txtOutputFolder == null) {
136: _txtOutputFolder = new JTextFieldOperator(
137: (JTextField) lblOutputFolderOrJAR().getLabelFor());
138: }
139: return _txtOutputFolder;
140: }
141:
142: /** Tries to find "Browse..." JButton in this dialog.
143: * @return JButtonOperator
144: */
145: public JButtonOperator btBrowse() {
146: if (_btBrowse == null) {
147: _btBrowse = new JButtonOperator(this , "Browse...");//TODO I18N
148: }
149: return _btBrowse;
150: }
151:
152: /** Tries to find null JList in this dialog.
153: * @return JListOperator
154: */
155: public JListOperator lstClasspath() {
156: if (_lstClasspath == null) {
157: _lstClasspath = new JListOperator(this , 1);
158: }
159: return _lstClasspath;
160: }
161:
162: /** Tries to find null JComboBox in this dialog.
163: * @return JComboBoxOperator
164: */
165: public JComboBoxOperator cboSourcePackageFolder() {
166: if (_cboSourcePackageFolder == null) {
167: _cboSourcePackageFolder = new JComboBoxOperator(this );
168: }
169: return _cboSourcePackageFolder;
170: }
171:
172: /** Tries to find "Move Up" JButton in this dialog.
173: * @return JButtonOperator
174: */
175: public JButtonOperator btMoveUp() {
176: if (_btMoveUp == null) {
177: _btMoveUp = new JButtonOperator(this , "Move Up");//TODO I18N
178: }
179: return _btMoveUp;
180: }
181:
182: /** Tries to find "Move Down" JButton in this dialog.
183: * @return JButtonOperator
184: */
185: public JButtonOperator btMoveDown() {
186: if (_btMoveDown == null) {
187: _btMoveDown = new JButtonOperator(this , "Move Down");//TODO I18N
188: }
189: return _btMoveDown;
190: }
191:
192: /** Tries to find " " JLabel in this dialog.
193: * @return JLabelOperator
194: */
195: public JLabelOperator lblOnlineError() {
196: if (_lblOnlineError == null) {
197: _lblOnlineError = new JLabelOperator(this , 3);
198: }
199: return _lblOnlineError;
200: }
201:
202: /** clicks on "Add JAR/Folder..." JButton
203: */
204: public void addJARFolder() {
205: btAddJARFolder().push();
206: }
207:
208: /** clicks on "Remove" JButton
209: */
210: public void remove() {
211: btRemove().push();
212: }
213:
214: /** gets text for txtOutputFolder
215: * @return String text
216: */
217: public String getOutputFolder() {
218: return txtOutputFolder().getText();
219: }
220:
221: /** sets text for txtOutputFolder
222: * @param text String text
223: */
224: public void setOutputFolder(String text) {
225: txtOutputFolder().setText(text);
226: }
227:
228: /** clicks on "Browse..." JButton
229: */
230: public void browse() {
231: btBrowse().push();
232: }
233:
234: /** returns selected item for cboSourcePackageFolder
235: * @return String item
236: */
237: public String getSelectedSourcePackageFolder() {
238: return cboSourcePackageFolder().getSelectedItem().toString();
239: }
240:
241: /** selects item for cboSourcePackageFolder
242: * @param item String item
243: */
244: public void selectSourcePackageFolder(String item) {
245: cboSourcePackageFolder().selectItem(item);
246: }
247:
248: /** clicks on "Move Up" JButton
249: */
250: public void moveUp() {
251: btMoveUp().push();
252: }
253:
254: /** clicks on "Move Down" JButton
255: */
256: public void moveDown() {
257: btMoveDown().push();
258: }
259:
260: /** selects classpath from the list Classpath:
261: */
262: public void selectClasspath(String classpath) {
263: lstClasspath().selectItem(classpath);
264: }
265:
266: /** Performs verification of ClasspathStepOperator by accessing all its components.
267: */
268: public void verify() {
269: lblSourcePackageFolder();
270: lblClasspath();
271: btAddJARFolder();
272: btRemove();
273: lblOutputFolderOrJAR();
274: txtOutputFolder();
275: btBrowse();
276: lstClasspath();
277: cboSourcePackageFolder();
278: btMoveUp();
279: btMoveDown();
280: lblOnlineError();
281: }
282:
283: }
|