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: package org.netbeans.jellytools;
042:
043: import org.netbeans.jemmy.operators.JButtonOperator;
044: import org.netbeans.jemmy.operators.JLabelOperator;
045: import org.netbeans.jemmy.operators.JTextFieldOperator;
046: import org.netbeans.jemmy.operators.JCheckBoxOperator;
047: import javax.swing.JTextField;
048:
049: /**
050: * Handle "Name And Location" panel of the New Project wizard.
051: * Components on the panel differs according to type of project selected.<br><br>
052: * <u>Java Application</u><br>
053: * <ol>
054: * <li>Label and TextField Project Name: <code>txtProjectName().setText()</code>
055: * <li>Label and TextField Project Location: <code>txtProjectLocation().setText()</code>
056: * <li>Label and TextField Project Folder: <code>txtProjectFolder().getText()</code>
057: * <li>Button for browsing Project Location: <code>btBrowseProjectLocation().pushNoBlock()</code>
058: * <li>CheckBox Set as Main Project: <code>cbSetAsMainProject().setSelected(true)</code>
059: * <li>CheckBox Create Main Class: <code>cbCreateMainClass().setSelected(true)</code>
060: * </ol>
061: * <u>Java Class Library</u><br>
062: * <ol>
063: * <li>Label and TextField Project Name: <code>txtProjectName().setText()</code>
064: * <li>Label and TextField Project Location: <code>txtProjectLocation().setText()</code>
065: * <li>Label and TextField Project Folder: <code>txtProjectFolder().getText()</code>
066: * <li>Button for browsing Project Location: <code>btBrowseProjectLocation().pushNoBlock()</code>
067: * </ol>
068: * <u>Java Project With Existing Ant script</u><br>
069: * <ol>
070: * <li>Label and TextField Location: <code>txtLocation().setText()</code>
071: * <li>Label and TextField Build Script: <code>txtBuildScript().setText()</code>
072: * <li>Label and TextField Project Name: <code>txtProjectName().setText()</code>
073: * <li>Label and TextField Project Folder: <code>txtProjectFolder().setText()</code>
074: * <li>Button Browse... for browsing Location <code>btBrowseLocation().pushNoBlock()</code>
075: * <li>Button Browse... for browsing Build Script <code>btBrowseBuildScript().pushNoBlock()</code>
076: * <li>Button Browse... for browsing Project Folder <code>btBrowseProjectFolder().pushNoBlock()</code>
077: * <li>CheckBox Set as Main Project <code>cbSetAsMainProject().setSelected(true)</code>
078: * </ol>
079: * <u>Java project With Existing Sources</u><br>
080: * <ol>
081: * <li>Label and TextField Project Name: <code>txtProjectName().setText()</code>
082: * <li>Label and TextField Project Folder: <code>txtProjectFolder().setText()</code>
083: * <li>Button for browsing Project location: <code>btBrowseProjectLocation().pushNoBlock()</code>
084: * </ol>
085: *
086: */
087: public class NewProjectNameLocationStepOperator extends
088: NewProjectWizardOperator {
089:
090: /** Components operators. */
091: //Java Class Library
092: private JLabelOperator _lblProjectName;
093: private JTextFieldOperator _txtProjectName;
094: private JLabelOperator _lblProjectLocation;
095: private JTextFieldOperator _txtProjectLocation;
096: private JLabelOperator _lblProjectFolder;
097: private JTextFieldOperator _txtProjectFolder;
098: private JButtonOperator _btBrowseLocation;
099: //Java Application
100: private JCheckBoxOperator _cbSetAsMainProject;
101: private JCheckBoxOperator _cbCreateMainClass;
102: private JTextFieldOperator _txtCreateMainClass;
103: //Java Project With Existing Ant script
104: private JLabelOperator _lblLocation;
105: private JTextFieldOperator _txtLocation;
106: private JLabelOperator _lblBuildScript;
107: private JTextFieldOperator _txtBuildScript;
108: private JButtonOperator _btBrowseBuildScript;
109: private JButtonOperator _btBrowseProjectFolder;
110:
111: /** Returns operator for label Project Location
112: * @return JLabelOperator
113: */
114: public JLabelOperator lblProjectLocation() {
115: if (_lblProjectLocation == null) {
116: _lblProjectLocation = new JLabelOperator(
117: this ,
118: Bundle
119: .getStringTrimmed(
120: "org.netbeans.modules.java.j2seproject.ui.wizards.Bundle",
121: "LBL_NWP1_ProjectLocation_Label"));
122: }
123: return _lblProjectLocation;
124: }
125:
126: /** Returns operator of project location text field
127: * @return JTextOperator
128: */
129: public JTextFieldOperator txtProjectLocation() {
130: if (_txtProjectLocation == null) {
131: if (lblProjectLocation().getLabelFor() != null) {
132: _txtProjectLocation = new JTextFieldOperator(
133: (JTextField) lblProjectLocation().getLabelFor());
134: }
135: }
136: return _txtProjectLocation;
137: }
138:
139: /** Returns operator for label Project Name
140: * @return JLabelOperator
141: */
142: public JLabelOperator lblProjectName() {
143: if (_lblProjectName == null) {
144: _lblProjectName = new JLabelOperator(
145: this ,
146: Bundle
147: .getStringTrimmed(
148: "org.netbeans.modules.java.j2seproject.ui.wizards.Bundle",
149: "LBL_NWP1_ProjectName_Label"));
150: }
151: return _lblProjectName;
152: }
153:
154: /** Returns operator of project name textfield
155: * @return JTextOperator
156: */
157: public JTextFieldOperator txtProjectName() {
158: if (_txtProjectName == null) {
159: if (lblProjectName().getLabelFor() != null) {
160: _txtProjectName = new JTextFieldOperator(
161: (JTextField) lblProjectName().getLabelFor());
162: }
163: }
164: return _txtProjectName;
165: }
166:
167: /** Returns operator for label Project Folder
168: * @return JLabelOperator
169: */
170: public JLabelOperator lblProjectFolder() {
171: if (_lblProjectFolder == null) {
172: _lblProjectFolder = new JLabelOperator(
173: this ,
174: Bundle
175: .getStringTrimmed(
176: "org.netbeans.modules.java.j2seproject.ui.wizards.Bundle",
177: "LBL_NWP1_CreatedProjectFolder_Lablel"));
178: }
179: return _lblProjectFolder;
180: }
181:
182: /** Returns operator of project folder textfield
183: * @return JTextOperator
184: */
185: public JTextFieldOperator txtProjectFolder() {
186: if (_txtProjectFolder == null) {
187: if (lblProjectFolder().getLabelFor() != null) {
188: _txtProjectFolder = new JTextFieldOperator(
189: (JTextField) lblProjectFolder().getLabelFor());
190: }
191: }
192: return _txtProjectFolder;
193: }
194:
195: /** Returns operator for browse project location button
196: * @return JButtonOperator
197: */
198: public JButtonOperator btBrowseProjectLocation() {
199: if (_btBrowseLocation == null) {
200: _btBrowseLocation = new JButtonOperator(
201: this ,
202: Bundle
203: .getStringTrimmed(
204: "org.netbeans.modules.java.j2seproject.ui.wizards.Bundle",
205: "LBL_NWP1_BrowseLocation_Button"));
206: }
207: return _btBrowseLocation;
208: }
209:
210: /** Returns operator for browse location button in Java Project with existing
211: * Ant script wizard.
212: * @return JButtonOperator
213: */
214: public JButtonOperator btBrowseLocation() {
215: if (_btBrowseLocation == null) {
216: _btBrowseLocation = new JButtonOperator(
217: this ,
218: Bundle
219: .getStringTrimmed(
220: "org.netbeans.modules.ant.freeform.ui.Bundle",
221: "BTN_BasicProjectInfoPanel_browseProjectLocation"),
222: 2);
223: }
224: return _btBrowseLocation;
225: }
226:
227: /** Returns operator for checkbox 'Set as Main Project'
228: * @return JCheckBoxOperator
229: */
230: public JCheckBoxOperator cbSetAsMainProject() {
231: if (_cbSetAsMainProject == null) {
232: _cbSetAsMainProject = new JCheckBoxOperator(
233: this ,
234: Bundle
235: .getStringTrimmed(
236: "org.netbeans.modules.java.j2seproject.ui.wizards.Bundle",
237: "LBL_setAsMainCheckBox"));
238: }
239: return _cbSetAsMainProject;
240: }
241:
242: /** Returns operator for checkbox 'Create Main Class'
243: * @return JCheckBoxOperator
244: */
245: public JCheckBoxOperator cbCreateMainClass() {
246: if (_cbCreateMainClass == null) {
247: _cbCreateMainClass = new JCheckBoxOperator(
248: this ,
249: Bundle
250: .getStringTrimmed(
251: "org.netbeans.modules.java.j2seproject.ui.wizards.Bundle",
252: "LBL_createMainCheckBox"));
253: }
254: return _cbCreateMainClass;
255: }
256:
257: /** Returns operator for text field 'Create Main Class'
258: * @return JTextFieldOperator
259: */
260: public JTextFieldOperator txtCreateMainClass() {
261: if (_txtCreateMainClass == null) {
262: _txtCreateMainClass = new JTextFieldOperator(this , 3);
263: }
264: return _txtCreateMainClass;
265: }
266:
267: /** Returns operator for label 'Location:' in Java Project with existing
268: * Ant script wizard.
269: * @return JLabelOperator
270: */
271: public JLabelOperator lblLocation() {
272: if (_lblLocation == null) {
273: _lblLocation = new JLabelOperator(
274: this ,
275: Bundle
276: .getStringTrimmed(
277: "org.netbeans.modules.ant.freeform.ui.Bundle",
278: "LBL_BasicProjectInfoPanel_jLabel6"));
279: }
280: return _lblLocation;
281: }
282:
283: /** Returns operator of Location: text field in Java Project with existing
284: * Ant script wizard.
285: * @return JTextOperator
286: */
287: public JTextFieldOperator txtLocation() {
288: if (_txtLocation == null) {
289: if (lblLocation().getLabelFor() != null) {
290: _txtLocation = new JTextFieldOperator(
291: (JTextField) lblLocation().getLabelFor());
292: }
293: }
294: return _txtLocation;
295: }
296:
297: /** Returns operator for label 'Build Script:' in Java Project with existing
298: * Ant script wizard.
299: * @return JLabelOperator
300: */
301: public JLabelOperator lblBuildScript() {
302: if (_lblBuildScript == null) {
303: _lblBuildScript = new JLabelOperator(
304: this ,
305: Bundle
306: .getStringTrimmed(
307: "org.netbeans.modules.ant.freeform.ui.Bundle",
308: "LBL_BasicProjectInfoPanel_jLabel2"));
309: }
310: return _lblBuildScript;
311: }
312:
313: /** Returns operator of 'Build Script:' text field in Java Project with existing
314: * Ant script wizard.
315: * @return JTextOperator
316: */
317: public JTextFieldOperator txtBuildScript() {
318: if (_txtBuildScript == null) {
319: if (lblBuildScript().getLabelFor() != null) {
320: _txtBuildScript = new JTextFieldOperator(
321: (JTextField) lblBuildScript().getLabelFor());
322: }
323: }
324: return _txtBuildScript;
325: }
326:
327: /** Returns operator for browse Build Script button in Java Project with existing
328: * Ant script wizard.
329: * @return JButtonOperator
330: */
331: public JButtonOperator btBrowseBuildScript() {
332: if (_btBrowseBuildScript == null) {
333: _btBrowseBuildScript = new JButtonOperator(
334: this ,
335: Bundle
336: .getStringTrimmed(
337: "org.netbeans.modules.ant.freeform.ui.Bundle",
338: "BTN_BasicProjectInfoPanel_browseAntScript"),
339: 0);
340: }
341: return _btBrowseBuildScript;
342: }
343:
344: /** Returns operator for browse Project Folder button in Java Project with existing
345: * Ant script wizard.
346: * @return JButtonOperator
347: */
348: public JButtonOperator btBrowseProjectFolder() {
349: if (_btBrowseProjectFolder == null) {
350: _btBrowseProjectFolder = new JButtonOperator(
351: this ,
352: Bundle
353: .getStringTrimmed(
354: "org.netbeans.modules.ant.freeform.ui.Bundle",
355: "BTN_BasicProjectInfoPanel_browseProjectFolder"),
356: 1);
357: }
358: return _btBrowseProjectFolder;
359: }
360:
361: /** Performs verification by accessing all sub-components */
362: @Override
363: public void verify() {
364: /*
365: lblProjectName();
366: txtProjectName();
367: lblProjectLocation();
368: txtProjectLocation();
369: lblProjectFolder();
370: txtProjectFolder();
371: btBrowseLocation();
372: cbSetAsMainProject();
373: cbCreateMainClass();
374: txtCreateMainClass();
375: lblLocation();
376: lblBuildScript();
377: txtLocation();
378: txtBuildScript();
379: btBrowseBuildScript();
380: btBrowseProjectFolder();
381: */
382: }
383: }
|