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:
042: package org.netbeans.jellytools.modules.web;
043:
044: import javax.swing.JComboBox;
045: import javax.swing.JTable;
046: import org.netbeans.jellytools.Bundle;
047: import org.netbeans.jellytools.WizardOperator;
048: import org.netbeans.jemmy.operators.*;
049:
050: /** Class implementing all necessary methods for handling "New Web Application
051: * with Existing Ant Script - Source Package Folder" wizard step.
052: *
053: * @author Martin.Schovanek@sun.com
054: * @version 1.0
055: */
056: public class NewWebFreeFormSrcFoldersStepOperator extends
057: WizardOperator {
058:
059: /** Creates new NewWebFreeFormSrcFoldersStepOperator that can handle it.
060: */
061: public NewWebFreeFormSrcFoldersStepOperator() {
062: super (Helper.freeFormWizardTitle());
063: }
064:
065: private JLabelOperator _lblSourcePackageFolders;
066: private JLabelOperator _lblSourceLevel;
067: private JComboBoxOperator _cboSourceLevel;
068: public static final String ITEM_JDK13 = Bundle.getStringTrimmed(
069: "org.netbeans.modules.java.freeform.ui.Bundle",
070: "LBL_SourceFoldersPanel_JDK13");
071: public static final String ITEM_JDK14 = Bundle.getStringTrimmed(
072: "org.netbeans.modules.java.freeform.ui.Bundle",
073: "LBL_SourceFoldersPanel_JDK14");
074: public static final String ITEM_JDK15 = Bundle.getStringTrimmed(
075: "org.netbeans.modules.java.freeform.ui.Bundle",
076: "LBL_SourceFoldersPanel_JDK15");
077: private JButtonOperator _btAddFolderSrc;
078: private JButtonOperator _btRemoveSrc;
079: private JTableOperator _tabSourcePackageFolders;
080: private JLabelOperator _lblTestPackageFolders;
081: private JButtonOperator _btAddFolderTest;
082: private JButtonOperator _btRemoveTest;
083: private JButtonOperator _btMoveUpSrc;
084: private JButtonOperator _btMoveDownSrc;
085: private JButtonOperator _btMoveDownTest;
086: private JButtonOperator _btMoveUpTest;
087:
088: //******************************
089: // Subcomponents definition part
090: //******************************
091:
092: /** Tries to find "Source Package Folders:" JLabel in this dialog.
093: * @return JLabelOperator
094: */
095: public JLabelOperator lblSourcePackageFolders() {
096: if (_lblSourcePackageFolders == null) {
097: String sourcePkg = Bundle.getStringTrimmed(
098: "org.netbeans.modules.java.freeform.ui.Bundle",
099: "LBL_SourceFoldersPanel_jLabel2");
100: _lblSourcePackageFolders = new JLabelOperator(this ,
101: sourcePkg);
102: }
103: return _lblSourcePackageFolders;
104: }
105:
106: /** Tries to find "Source Level:" JLabel in this dialog.
107: * @return JLabelOperator
108: */
109: public JLabelOperator lblSourceLevel() {
110: if (_lblSourceLevel == null) {
111: String sourceLevel = Bundle.getStringTrimmed(
112: "org.netbeans.modules.java.freeform.ui.Bundle",
113: "LBL_SourceFoldersPanel_jLabel3");
114: _lblSourceLevel = new JLabelOperator(this , "Source Level:");
115: }
116: return _lblSourceLevel;
117: }
118:
119: /** Tries to find null JComboBox in this dialog.
120: * @return JComboBoxOperator
121: */
122: public JComboBoxOperator cboSourceLevel() {
123: if (_cboSourceLevel == null) {
124: if (lblSourceLevel().getLabelFor() != null) {
125: _cboSourceLevel = new JComboBoxOperator(
126: (JComboBox) lblSourceLevel().getLabelFor());
127: } else {
128: _cboSourceLevel = new JComboBoxOperator(this );
129: }
130: }
131: return _cboSourceLevel;
132: }
133:
134: /** Tries to find "Add Folder..." JButton in this dialog.
135: * @return JButtonOperator
136: */
137: public JButtonOperator btAddFolderSrc() {
138: if (_btAddFolderSrc == null) {
139: String addFolder = Bundle.getStringTrimmed(
140: "org.netbeans.modules.java.freeform.ui.Bundle",
141: "BTN_SourceFoldersPanel_addFolder");
142: _btAddFolderSrc = new JButtonOperator(this , addFolder);
143: }
144: return _btAddFolderSrc;
145: }
146:
147: /** Tries to find "Remove" JButton in this dialog.
148: * @return JButtonOperator
149: */
150: public JButtonOperator btRemoveSrc() {
151: if (_btRemoveSrc == null) {
152: String remove = Bundle.getStringTrimmed(
153: "org.netbeans.modules.java.freeform.ui.Bundle",
154: "BTN_SourceFoldersPanel_removeFolder");
155: _btRemoveSrc = new JButtonOperator(this , remove);
156: }
157: return _btRemoveSrc;
158: }
159:
160: /** Tries to find null JTable in this dialog.
161: * @return JTableOperator
162: */
163: public JTableOperator tabSourcePackageFolders() {
164: if (_tabSourcePackageFolders == null) {
165: if (lblSourcePackageFolders().getLabelFor() != null) {
166: _tabSourcePackageFolders = new JTableOperator(
167: (JTable) lblSourcePackageFolders()
168: .getLabelFor());
169: } else {
170: _tabSourcePackageFolders = new JTableOperator(this );
171: }
172: }
173: return _tabSourcePackageFolders;
174: }
175:
176: /** Tries to find "Test Package Folders:" JLabel in this dialog.
177: * @return JLabelOperator
178: */
179: public JLabelOperator lblTestPackageFolders() {
180: if (_lblTestPackageFolders == null) {
181: String testPkg = Bundle.getStringTrimmed(
182: "org.netbeans.modules.java.freeform.ui.Bundle",
183: "LBL_TestSourceFoldersPanel");
184: _lblTestPackageFolders = new JLabelOperator(this , testPkg);
185: }
186: return _lblTestPackageFolders;
187: }
188:
189: /** Tries to find "Add Folder..." JButton in this dialog.
190: * @return JButtonOperator
191: */
192: public JButtonOperator btAddFolderTest() {
193: if (_btAddFolderTest == null) {
194: String addFolder = Bundle.getStringTrimmed(
195: "org.netbeans.modules.java.freeform.ui.Bundle",
196: "BTN_SourceFoldersPanel_addTestFolder");
197: _btAddFolderTest = new JButtonOperator(this , addFolder, 1);
198: }
199: return _btAddFolderTest;
200: }
201:
202: /** Tries to find "Remove" JButton in this dialog.
203: * @return JButtonOperator
204: */
205: public JButtonOperator btRemoveTest() {
206: if (_btRemoveTest == null) {
207: String remove = Bundle.getStringTrimmed(
208: "org.netbeans.modules.java.freeform.ui.Bundle",
209: "BTN_SourceFoldersPanel_removeTestFolder");
210: _btRemoveTest = new JButtonOperator(this , remove, 1);
211: }
212: return _btRemoveTest;
213: }
214:
215: /** Tries to find "Move Up" JButton in this dialog.
216: * @return JButtonOperator
217: */
218: public JButtonOperator btMoveUpSrc() {
219: if (_btMoveUpSrc == null) {
220: String moveUp = Bundle.getStringTrimmed(
221: "org.netbeans.modules.java.freeform.ui.Bundle",
222: "BTN_SourceFoldersPanel_upFolder");
223: _btMoveUpSrc = new JButtonOperator(this , moveUp);
224: }
225: return _btMoveUpSrc;
226: }
227:
228: /** Tries to find "Move Down" JButton in this dialog.
229: * @return JButtonOperator
230: */
231: public JButtonOperator btMoveDownSrc() {
232: if (_btMoveDownSrc == null) {
233: String moveDown = Bundle.getStringTrimmed(
234: "org.netbeans.modules.java.freeform.ui.Bundle",
235: "BTN_SourceFoldersPanel_downFolder");
236: _btMoveDownSrc = new JButtonOperator(this , moveDown);
237: }
238: return _btMoveDownSrc;
239: }
240:
241: /** Tries to find "Move Down" JButton in this dialog.
242: * @return JButtonOperator
243: */
244: public JButtonOperator btMoveDownTest() {
245: if (_btMoveDownTest == null) {
246: String moveDown = Bundle.getStringTrimmed(
247: "org.netbeans.modules.java.freeform.ui.Bundle",
248: "BTN_SourceFoldersPanel_downTestFolder");
249: _btMoveDownTest = new JButtonOperator(this , moveDown, 1);
250: }
251: return _btMoveDownTest;
252: }
253:
254: /** Tries to find "Move Up" JButton in this dialog.
255: * @return JButtonOperator
256: */
257: public JButtonOperator btMoveUpTest() {
258: if (_btMoveUpTest == null) {
259: String moveUp = Bundle.getStringTrimmed(
260: "org.netbeans.modules.java.freeform.ui.Bundle",
261: "BTN_SourceFoldersPanel_upTestFolder");
262: _btMoveUpTest = new JButtonOperator(this , moveUp, 1);
263: }
264: return _btMoveUpTest;
265: }
266:
267: //****************************************
268: // Low-level functionality definition part
269: //****************************************
270:
271: /** returns selected item for cboSourceLevel
272: * @return String item
273: */
274: public String getSelectedSourceLevel() {
275: return cboSourceLevel().getSelectedItem().toString();
276: }
277:
278: /** selects item for cboSourceLevel
279: * @param item String item
280: */
281: public void selectSourceLevel(String item) {
282: cboSourceLevel().selectItem(item);
283: }
284:
285: /** clicks on "Add Folder..." JButton
286: */
287: public void addFolderSrc() {
288: btAddFolderSrc().push();
289: }
290:
291: /** clicks on "Remove" JButton
292: */
293: public void removeSrc() {
294: btRemoveSrc().push();
295: }
296:
297: /** clicks on "Add Folder..." JButton
298: */
299: public void addFolderTest() {
300: btAddFolderTest().push();
301: }
302:
303: /** clicks on "Remove" JButton
304: */
305: public void removeTest() {
306: btRemoveTest().push();
307: }
308:
309: /** clicks on "Move Up" JButton
310: */
311: public void moveUpSrc() {
312: btMoveUpSrc().push();
313: }
314:
315: /** clicks on "Move Down" JButton
316: */
317: public void moveDownSrc() {
318: btMoveDownSrc().push();
319: }
320:
321: /** clicks on "Move Down" JButton
322: */
323: public void moveDownTest() {
324: btMoveDownTest().push();
325: }
326:
327: /** clicks on "Move Up" JButton
328: */
329: public void moveUpTest() {
330: btMoveUpTest().push();
331: }
332:
333: //*****************************************
334: // High-level functionality definition part
335: //*****************************************
336:
337: /** Performs verification of NewWebFreeFormSrcFoldersStepOperator by
338: * accessing all its components.
339: */
340: public void verify() {
341: lblSourcePackageFolders();
342: lblSourceLevel();
343: cboSourceLevel();
344: btAddFolderSrc();
345: btRemoveSrc();
346: tabSourcePackageFolders();
347: lblTestPackageFolders();
348: btAddFolderTest();
349: btRemoveTest();
350: btMoveUpSrc();
351: btMoveDownSrc();
352: btMoveDownTest();
353: btMoveUpTest();
354: }
355: }
|