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.operators.JButtonOperator;
044: import org.netbeans.jemmy.operators.JLabelOperator;
045: import org.netbeans.jemmy.operators.JTextFieldOperator;
046: import javax.swing.JTextField;
047:
048: /**
049: * Handle "Existing Sources and Libraries" panel of the New Web Project with
050: * Existing Sources wizard.<br>
051: * <ol>
052: * <li>Label and TextField Web Pages Folder: <code>txtWebPagesFolder().setText()</code>
053: * <li>Label and TextField Liraries Folder: <code>txtLirariesFolder().setText()</code>
054: * <li>Button for browsing Project Location: <code>btBrowseLocation().pushNoBlock()</code>
055: * <li>Label and TextField Project Folder: <code>txtProjectFolder().getText()</code>
056: * <li>ComboBox SourceStructure: <code>cbSourceStructure().selectItem("item")</code>
057: * <li>ComboBox Server: <code>cbSourceStructure().selectItem("item")</code>
058: * <li>ComboBox J2EE Version: <code>cbJ2EEVersion().selectItem("item")</code>
059: * <li>Label and TextField Context Path: <code>txtContextPath().getText()</code>
060: * <li>CheckBox Set as Main Project: <code>cbSetAsMainProject().setSelected(true)</code>
061: * </ol>
062: * <p><b>Support for source and test packages folders lists is not implemented yet</b></p>
063: * @author ms113234
064: */
065: public class NewWebProjectSourcesStepOperator extends
066: NewProjectWizardOperator {
067:
068: /** Components operators. */
069: //Web Application
070: private JLabelOperator _lblWebPagesFolder;
071: private JTextFieldOperator _txtWebPagesFolder;
072: private JButtonOperator _btBrowseWebPages;
073: private JLabelOperator _lblLirariesFolder;
074: private JTextFieldOperator _txtLirariesFolder;
075: private JButtonOperator _btBrowseLibraries;
076: private JButtonOperator _btAddSourceFolder;
077: private JButtonOperator _btRemoveSourceFolder;
078: private JButtonOperator _btAddTestFolder;
079: private JButtonOperator _btRemoveTestFolder;
080:
081: /** Returns operator for label Web Pages Folder:
082: * @return JLabelOperator
083: */
084: public JLabelOperator lblWebPagesFolder() {
085: if (_lblWebPagesFolder == null) {
086: _lblWebPagesFolder = new JLabelOperator(
087: this ,
088: Bundle
089: .getStringTrimmed(
090: "org.netbeans.modules.web.project.ui.wizards.Bundle",
091: "LBL_IW_WebPagesLocation_Label"));
092: }
093: return _lblWebPagesFolder;
094: }
095:
096: /** Returns operator of web pages folder textfield
097: * @return JTextOperator
098: */
099: public JTextFieldOperator txtWebPagesFolder() {
100: if (_txtWebPagesFolder == null) {
101: if (lblWebPagesFolder().getLabelFor() != null) {
102: _txtWebPagesFolder = new JTextFieldOperator(
103: (JTextField) lblWebPagesFolder().getLabelFor());
104: }
105: }
106: return _txtWebPagesFolder;
107: }
108:
109: /** Returns operator for browse web pages folder button
110: * @return JButtonOperator
111: */
112: public JButtonOperator btBrowseWebPages() {
113: if (_btBrowseWebPages == null) {
114: _btBrowseWebPages = new JButtonOperator(
115: this ,
116: Bundle
117: .getStringTrimmed(
118: "org.netbeans.modules.web.project.ui.wizards.Bundle",
119: "LBL_NWP1_BrowseLocation_Button"),
120: 0);
121: }
122: return _btBrowseWebPages;
123: }
124:
125: /** Returns operator for label Libraries Folder:
126: * @return JLabelOperator
127: */
128: public JLabelOperator lblLibrariesFolder() {
129: if (_lblLirariesFolder == null) {
130: _lblLirariesFolder = new JLabelOperator(
131: this ,
132: Bundle
133: .getStringTrimmed(
134: "org.netbeans.modules.web.project.ui.wizards.Bundle",
135: "LBL_IW_LibrariesLocation_Label"));
136: }
137: return _lblLirariesFolder;
138: }
139:
140: /** Returns operator of libraries folder textfield
141: * @return JTextOperator
142: */
143: public JTextFieldOperator txtLibrariesFolder() {
144: if (_txtLirariesFolder == null) {
145: if (lblWebPagesFolder().getLabelFor() != null) {
146: _txtLirariesFolder = new JTextFieldOperator(
147: (JTextField) lblLibrariesFolder().getLabelFor());
148: }
149: }
150: return _txtLirariesFolder;
151: }
152:
153: /** Returns operator for browse libraries folder button
154: * @return JButtonOperator
155: */
156: public JButtonOperator btBrowseLibraries() {
157: if (_btBrowseLibraries == null) {
158: _btBrowseLibraries = new JButtonOperator(
159: this ,
160: Bundle
161: .getStringTrimmed(
162: "org.netbeans.modules.web.project.ui.wizards.Bundle",
163: "LBL_NWP1_BrowseLocation_Button"),
164: 1);
165: }
166: return _btBrowseLibraries;
167: }
168:
169: /** Returns operator for add source folder button
170: * @return JButtonOperator
171: */
172: public JButtonOperator btAddSourceFolder() {
173: if (_btAddSourceFolder == null) {
174: _btAddSourceFolder = new JButtonOperator(
175: this ,
176: Bundle
177: .getStringTrimmed(
178: "org.netbeans.modules.web.project.ui.wizards.Bundle",
179: "CTL_AddFolder"), 0);
180: }
181: return _btAddSourceFolder;
182: }
183:
184: /** Returns operator for remove source folder button
185: * @return JButtonOperator
186: */
187: public JButtonOperator btRemoveSourceFolder() {
188: if (_btRemoveSourceFolder == null) {
189: _btRemoveSourceFolder = new JButtonOperator(
190: this ,
191: Bundle
192: .getStringTrimmed(
193: "org.netbeans.modules.web.project.ui.wizards.Bundle",
194: "CTL_RemoveFolder"), 0);
195: }
196: return _btRemoveSourceFolder;
197: }
198:
199: /** Returns operator for add test folder button
200: * @return JButtonOperator
201: */
202: public JButtonOperator btAddTestFolder() {
203: if (_btAddTestFolder == null) {
204: _btAddTestFolder = new JButtonOperator(
205: this ,
206: Bundle
207: .getStringTrimmed(
208: "org.netbeans.modules.web.project.ui.wizards.Bundle",
209: "CTL_AddFolder"), 1);
210: }
211: return _btAddTestFolder;
212: }
213:
214: /** Returns operator for remove test folder button
215: * @return JButtonOperator
216: */
217: public JButtonOperator btRemoveTestFolder() {
218: if (_btRemoveTestFolder == null) {
219: _btRemoveTestFolder = new JButtonOperator(
220: this ,
221: Bundle
222: .getStringTrimmed(
223: "org.netbeans.modules.web.project.ui.wizards.Bundle",
224: "CTL_RemoveFolder"), 1);
225: }
226: return _btRemoveTestFolder;
227: }
228:
229: /** Performs verification by accessing all sub-components */
230: public void verify() {
231: lblWebPagesFolder();
232: txtWebPagesFolder();
233: lblLibrariesFolder();
234: txtLibrariesFolder();
235: btBrowseWebPages();
236: btBrowseLibraries();
237: btAddSourceFolder();
238: btRemoveSourceFolder();
239: btAddTestFolder();
240: btRemoveTestFolder();
241: }
242: }
|