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.JTextField;
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 - Web Sources" wizard step.
052: *
053: * @author Martin.Schovanek@sun.com
054: * @version 1.0
055: */
056: public class NewWebFreeFormWebSrcStepOperator extends WizardOperator {
057:
058: /** Creates new NewWebFreeFormWebSrcStepOperator that can handle it.
059: */
060: public NewWebFreeFormWebSrcStepOperator() {
061: super (Helper.freeFormWizardTitle());
062: }
063:
064: private JLabelOperator _lblWebPagesFolder;
065: private JTextFieldOperator _txtWebPagesFolder;
066: private JButtonOperator _btBrowse;
067: private JLabelOperator _lblContextPath;
068: private JTextFieldOperator _txtContextPath;
069: private JLabelOperator _lblJ2EESpecificationLevel;
070: private JComboBoxOperator _cboJ2EESpecificationLevel;
071: public static final String ITEM_J2EE14 = Bundle.getStringTrimmed(
072: "org.netbeans.modules.web.freeform.ui.Bundle",
073: "TXT_J2EESpecLevel_0");
074: public static final String ITEM_J2EE13 = Bundle.getStringTrimmed(
075: "org.netbeans.modules.web.freeform.ui.Bundle",
076: "TXT_J2EESpecLevel_1");
077:
078: //******************************
079: // Subcomponents definition part
080: //******************************
081:
082: /** Tries to find "Web Pages Folder:" JLabel in this dialog.
083: * @return JLabelOperator
084: */
085: public JLabelOperator lblWebPagesFolder() {
086: if (_lblWebPagesFolder == null) {
087: String webPagesFolder = Bundle.getStringTrimmed(
088: "org.netbeans.modules.web.freeform.ui.Bundle",
089: "LBL_WebPagesPanel_WebPagesLocation_Label");
090: _lblWebPagesFolder = new JLabelOperator(this ,
091: webPagesFolder);
092: }
093: return _lblWebPagesFolder;
094: }
095:
096: /** Tries to find null JTextField in this dialog.
097: * @return JTextFieldOperator
098: */
099: public JTextFieldOperator txtWebPagesFolder() {
100: if (_txtWebPagesFolder == null) {
101: if (lblWebPagesFolder().getLabelFor() != null) {
102: _txtWebPagesFolder = new JTextFieldOperator(
103: (JTextField) lblWebPagesFolder().getLabelFor());
104: } else {
105: _txtWebPagesFolder = new JTextFieldOperator(this );
106: }
107: }
108: return _txtWebPagesFolder;
109: }
110:
111: /** Tries to find "Browse..." JButton in this dialog.
112: * @return JButtonOperator
113: */
114: public JButtonOperator btBrowse() {
115: if (_btBrowse == null) {
116: String browse = Bundle.getStringTrimmed(
117: "org.netbeans.modules.web.freeform.ui.Bundle",
118: "BTN_BasicProjectInfoPanel_browseAntScript");
119: _btBrowse = new JButtonOperator(this , browse);
120: }
121: return _btBrowse;
122: }
123:
124: /** Tries to find "Context Path:" JLabel in this dialog.
125: * @return JLabelOperator
126: */
127: public JLabelOperator lblContextPath() {
128: if (_lblContextPath == null) {
129: String contextPath = Bundle.getStringTrimmed(
130: "org.netbeans.modules.web.freeform.ui.Bundle",
131: "LBL_WebPagesPanel_ContextPath_Label");
132: _lblContextPath = new JLabelOperator(this , contextPath);
133: }
134: return _lblContextPath;
135: }
136:
137: /** Tries to find null JTextField in this dialog.
138: * @return JTextFieldOperator
139: */
140: public JTextFieldOperator txtContextPath() {
141: if (_txtContextPath == null) {
142: if (lblContextPath().getLabelFor() != null) {
143: _txtContextPath = new JTextFieldOperator(
144: (JTextField) lblContextPath().getLabelFor());
145: } else {
146: _txtContextPath = new JTextFieldOperator(this , 1);
147: }
148: }
149: return _txtContextPath;
150: }
151:
152: /** Tries to find "J2EE Specification Level:" JLabel in this dialog.
153: * @return JLabelOperator
154: */
155: public JLabelOperator lblJ2EESpecificationLevel() {
156: if (_lblJ2EESpecificationLevel == null) {
157: String j2eeLevel = Bundle.getStringTrimmed(
158: "org.netbeans.modules.web.freeform.ui.Bundle",
159: "LBL_WebPagesPanel_J2EESpecLevel_Label");
160: _lblJ2EESpecificationLevel = new JLabelOperator(this ,
161: j2eeLevel);
162: }
163: return _lblJ2EESpecificationLevel;
164: }
165:
166: /** Tries to find null JComboBox in this dialog.
167: * @return JComboBoxOperator
168: */
169: public JComboBoxOperator cboJ2EESpecificationLevel() {
170: if (_cboJ2EESpecificationLevel == null) {
171: if (lblJ2EESpecificationLevel().getLabelFor() != null) {
172: _cboJ2EESpecificationLevel = new JComboBoxOperator(
173: (JComboBox) lblJ2EESpecificationLevel()
174: .getLabelFor());
175: } else {
176: _cboJ2EESpecificationLevel = new JComboBoxOperator(this );
177: }
178: }
179: return _cboJ2EESpecificationLevel;
180: }
181:
182: //****************************************
183: // Low-level functionality definition part
184: //****************************************
185:
186: /** gets text for txtWebPagesFolder
187: * @return String text
188: */
189: public String getWebPagesFolder() {
190: return txtWebPagesFolder().getText();
191: }
192:
193: /** sets text for txtWebPagesFolder
194: * @param text String text
195: */
196: public void setWebPagesFolder(String text) {
197: txtWebPagesFolder().setText(text);
198: }
199:
200: /** types text for txtWebPagesFolder
201: * @param text String text
202: */
203: public void typeWebPagesFolder(String text) {
204: txtWebPagesFolder().typeText(text);
205: }
206:
207: /** clicks on "Browse..." JButton
208: */
209: public void browse() {
210: btBrowse().push();
211: }
212:
213: /** gets text for txtContextPath
214: * @return String text
215: */
216: public String getContextPath() {
217: return txtContextPath().getText();
218: }
219:
220: /** sets text for txtContextPath
221: * @param text String text
222: */
223: public void setContextPath(String text) {
224: txtContextPath().setText(text);
225: }
226:
227: /** types text for txtContextPath
228: * @param text String text
229: */
230: public void typeContextPath(String text) {
231: txtContextPath().typeText(text);
232: }
233:
234: /** returns selected item for cboJ2EESpecificationLevel
235: * @return String item
236: */
237: public String getSelectedJ2EESpecificationLevel() {
238: return cboJ2EESpecificationLevel().getSelectedItem().toString();
239: }
240:
241: /** selects item for cboJ2EESpecificationLevel
242: * @param item String item
243: */
244: public void selectJ2EESpecificationLevel(String item) {
245: cboJ2EESpecificationLevel().selectItem(item);
246: }
247:
248: //*****************************************
249: // High-level functionality definition part
250: //*****************************************
251:
252: /** Performs verification of NewWebFreeFormWebSrcStepOperator by accessing all its components.
253: */
254: public void verify() {
255: lblWebPagesFolder();
256: txtWebPagesFolder();
257: btBrowse();
258: lblContextPath();
259: txtContextPath();
260: lblJ2EESpecificationLevel();
261: cboJ2EESpecificationLevel();
262: }
263: }
|