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.test.jsf;
043:
044: import javax.swing.JComboBox;
045: import javax.swing.JTextField;
046: import org.netbeans.jellytools.WizardOperator;
047: import org.netbeans.jemmy.operators.JComboBoxOperator;
048: import org.netbeans.jemmy.operators.JLabelOperator;
049: import org.netbeans.jemmy.operators.JTextAreaOperator;
050: import org.netbeans.jemmy.operators.JTextFieldOperator;
051:
052: /** Class implementing all necessary methods for handling "New JSF Managed Bean" NbDialog.
053: *
054: * @author luke
055: */
056: public class NewJSFBeanStepOperator extends WizardOperator {
057:
058: /** Creates new NewJSFManagedBean that can handle it.
059: */
060: public NewJSFBeanStepOperator() {
061: super ("New JSF Managed Bean");
062: checkPanel("Name and Location");
063: }
064:
065: private JLabelOperator _lblNameAndLocation;
066: private JLabelOperator _lblClassName;
067: private JTextFieldOperator _txtClassName;
068: private JLabelOperator _lblProject;
069: private JTextFieldOperator _txtProject;
070: private JLabelOperator _lblLocation;
071: private JComboBoxOperator _cboLocation;
072: private JLabelOperator _lblPackage;
073: private JComboBoxOperator _cboPackage;
074: private JLabelOperator _lblCreatedFile;
075: private JTextFieldOperator _txtCreatedFile;
076: private JLabelOperator _lblConfigurationFile;
077: private JComboBoxOperator _cboConfigurationFile;
078: private JLabelOperator _lblScope;
079: private JComboBoxOperator _cboScope;
080: private JLabelOperator _lblBeanDescription;
081: private JTextAreaOperator _txtBeanDescription;
082:
083: //******************************
084: // Subcomponents definition part
085: //******************************
086:
087: /** Tries to find "Name and Location" JLabel in this dialog.
088: * @return JLabelOperator
089: */
090: public JLabelOperator lblNameAndLocation() {
091: if (_lblNameAndLocation == null) {
092: _lblNameAndLocation = new JLabelOperator(this ,
093: "Name and Location");
094: }
095: return _lblNameAndLocation;
096: }
097:
098: /** Tries to find "Class Name:" JLabel in this dialog.
099: * @return JLabelOperator
100: */
101: public JLabelOperator lblClassName() {
102: if (_lblClassName == null) {
103: _lblClassName = new JLabelOperator(this , "Class Name:");
104: }
105: return _lblClassName;
106: }
107:
108: /** Tries to find null JTextField in this dialog.
109: * @return JTextFieldOperator
110: */
111: public JTextFieldOperator txtClassName() {
112: if (_txtClassName == null) {
113: _txtClassName = new JTextFieldOperator(
114: (JTextField) lblClassName().getLabelFor());
115: }
116: return _txtClassName;
117: }
118:
119: /** Tries to find "Project:" JLabel in this dialog.
120: * @return JLabelOperator
121: */
122: public JLabelOperator lblProject() {
123: if (_lblProject == null) {
124: _lblProject = new JLabelOperator(this , "Project:");
125: }
126: return _lblProject;
127: }
128:
129: /** Tries to find null JTextField in this dialog.
130: * @return JTextFieldOperator
131: */
132: public JTextFieldOperator txtProject() {
133: if (_txtProject == null) {
134: _txtProject = new JTextFieldOperator(
135: (JTextField) lblProject().getLabelFor());
136: }
137: return _txtProject;
138: }
139:
140: /** Tries to find "Location:" JLabel in this dialog.
141: * @return JLabelOperator
142: */
143: public JLabelOperator lblLocation() {
144: if (_lblLocation == null) {
145: _lblLocation = new JLabelOperator(this , "Location:");
146: }
147: return _lblLocation;
148: }
149:
150: /** Tries to find null JComboBox in this dialog.
151: * @return JComboBoxOperator
152: */
153: public JComboBoxOperator cboLocation() {
154: if (_cboLocation == null) {
155: _cboLocation = new JComboBoxOperator(
156: (JComboBox) lblLocation().getLabelFor());
157: }
158: return _cboLocation;
159: }
160:
161: /** Tries to find "Package:" JLabel in this dialog.
162: * @return JLabelOperator
163: */
164: public JLabelOperator lblPackage() {
165: if (_lblPackage == null) {
166: _lblPackage = new JLabelOperator(this , "Package:");
167: }
168: return _lblPackage;
169: }
170:
171: /** Tries to find null JComboBox in this dialog.
172: * @return JComboBoxOperator
173: */
174: public JComboBoxOperator cboPackage() {
175: if (_cboPackage == null) {
176: _cboPackage = new JComboBoxOperator(
177: (JComboBox) lblPackage().getLabelFor());
178: }
179: return _cboPackage;
180: }
181:
182: /** Tries to find "Created File:" JLabel in this dialog.
183: * @return JLabelOperator
184: */
185: public JLabelOperator lblCreatedFile() {
186: if (_lblCreatedFile == null) {
187: _lblCreatedFile = new JLabelOperator(this , "Created File:");
188: }
189: return _lblCreatedFile;
190: }
191:
192: /** Tries to find null JTextField in this dialog.
193: * @return JTextFieldOperator
194: */
195: public JTextFieldOperator txtCreatedFile() {
196: if (_txtCreatedFile == null) {
197: _txtCreatedFile = new JTextFieldOperator(
198: (JTextField) lblCreatedFile().getLabelFor());
199: }
200: return _txtCreatedFile;
201: }
202:
203: /** Tries to find "Configuration File:" JLabel in this dialog.
204: * @return JLabelOperator
205: */
206: public JLabelOperator lblConfigurationFile() {
207: if (_lblConfigurationFile == null) {
208: _lblConfigurationFile = new JLabelOperator(this ,
209: "Configuration File:");
210: }
211: return _lblConfigurationFile;
212: }
213:
214: /** Tries to find null JComboBox in this dialog.
215: * @return JComboBoxOperator
216: */
217: public JComboBoxOperator cboConfigurationFile() {
218: if (_cboConfigurationFile == null) {
219: _cboConfigurationFile = new JComboBoxOperator(
220: (JComboBox) lblConfigurationFile().getLabelFor());
221: }
222: return _cboConfigurationFile;
223: }
224:
225: /** Tries to find "Scope:" JLabel in this dialog.
226: * @return JLabelOperator
227: */
228: public JLabelOperator lblScope() {
229: if (_lblScope == null) {
230: _lblScope = new JLabelOperator(this , "Scope:");
231: }
232: return _lblScope;
233: }
234:
235: /** Tries to find null JComboBox in this dialog.
236: * @return JComboBoxOperator
237: */
238: public JComboBoxOperator cboScope() {
239: if (_cboScope == null) {
240: _cboScope = new JComboBoxOperator((JComboBox) lblScope()
241: .getLabelFor());
242: }
243: return _cboScope;
244: }
245:
246: /** Tries to find "Bean Description:" JLabel in this dialog.
247: * @return JLabelOperator
248: */
249: public JLabelOperator lblBeanDescription() {
250: if (_lblBeanDescription == null) {
251: _lblBeanDescription = new JLabelOperator(this ,
252: "Bean Description:");
253: }
254: return _lblBeanDescription;
255: }
256:
257: /** Tries to find null JTextArea in this dialog.
258: * @return JTextAreaOperator
259: */
260: public JTextAreaOperator txtBeanDescription() {
261: if (_txtBeanDescription == null) {
262: _txtBeanDescription = new JTextAreaOperator(this );
263: }
264: return _txtBeanDescription;
265: }
266:
267: //****************************************
268: // Low-level functionality definition part
269: //****************************************
270:
271: /** gets text for txtClassName
272: * @return String text
273: */
274: public String getClassName() {
275: return txtClassName().getText();
276: }
277:
278: /** sets text for txtClassName
279: * @param text String text
280: */
281: public void setClassName(String text) {
282: txtClassName().setText(text);
283: }
284:
285: /** types text for txtClassName
286: * @param text String text
287: */
288: public void typeClassName(String text) {
289: txtClassName().typeText(text);
290: }
291:
292: /** gets text for txtProject
293: * @return String text
294: */
295: public String getProject() {
296: return txtProject().getText();
297: }
298:
299: /** sets text for txtProject
300: * @param text String text
301: */
302: public void setProject(String text) {
303: txtProject().setText(text);
304: }
305:
306: /** types text for txtProject
307: * @param text String text
308: */
309: public void typeProject(String text) {
310: txtProject().typeText(text);
311: }
312:
313: /** returns selected item for cboLocation
314: * @return String item
315: */
316: public String getSelectedLocation() {
317: return cboLocation().getSelectedItem().toString();
318: }
319:
320: /** selects item for cboLocation
321: * @param item String item
322: */
323: public void selectLocation(String item) {
324: cboLocation().selectItem(item);
325: }
326:
327: /** returns selected item for cboPackage
328: * @return String item
329: */
330: public String getSelectedPackage() {
331: return cboPackage().getSelectedItem().toString();
332: }
333:
334: /** selects item for cboPackage
335: * @param item String item
336: */
337: public void selectPackage(String item) {
338: cboPackage().selectItem(item);
339: }
340:
341: /** types text for cboPackage
342: * @param text String text
343: */
344: public void typePackage(String text) {
345: cboPackage().typeText(text);
346: }
347:
348: /** gets text for txtCreatedFile
349: * @return String text
350: */
351: public String getCreatedFile() {
352: return txtCreatedFile().getText();
353: }
354:
355: /** sets text for txtCreatedFile
356: * @param text String text
357: */
358: public void setCreatedFile(String text) {
359: txtCreatedFile().setText(text);
360: }
361:
362: /** types text for txtCreatedFile
363: * @param text String text
364: */
365: public void typeCreatedFile(String text) {
366: txtCreatedFile().typeText(text);
367: }
368:
369: /** returns selected item for cboConfigurationFile
370: * @return String item
371: */
372: public String getSelectedConfigurationFile() {
373: return cboConfigurationFile().getSelectedItem().toString();
374: }
375:
376: /** selects item for cboConfigurationFile
377: * @param item String item
378: */
379: public void selectConfigurationFile(String item) {
380: cboConfigurationFile().selectItem(item);
381: }
382:
383: /** returns selected item for cboScope
384: * @return String item
385: */
386: public String getSelectedScope() {
387: return cboScope().getSelectedItem().toString();
388: }
389:
390: /** selects item for cboScope
391: * @param item String item
392: */
393: public void selectScope(String item) {
394: cboScope().selectItem(item);
395: }
396:
397: /** gets text for txtBeanDescription
398: * @return String text
399: */
400: public String getBeanDescription() {
401: return txtBeanDescription().getText();
402: }
403:
404: /** sets text for txtBeanDescription
405: * @param text String text
406: */
407: public void setBeanDescription(String text) {
408: txtBeanDescription().setText(text);
409: }
410:
411: /** types text for txtBeanDescription
412: * @param text String text
413: */
414: public void typeBeanDescription(String text) {
415: txtBeanDescription().typeText(text);
416: }
417:
418: //*****************************************
419: // High-level functionality definition part
420: //*****************************************
421:
422: /** Performs verification of NewJSFManagedBean by accessing all its components.
423: */
424: public void verify() {
425: lblNameAndLocation();
426: lblClassName();
427: txtClassName();
428: lblProject();
429: txtProject();
430: lblLocation();
431: cboLocation();
432: lblPackage();
433: cboPackage();
434: lblCreatedFile();
435: txtCreatedFile();
436: lblConfigurationFile();
437: cboConfigurationFile();
438: lblScope();
439: cboScope();
440: lblBeanDescription();
441: txtBeanDescription();
442: btBack();
443: btNext();
444: btFinish();
445: btCancel();
446: btHelp();
447: }
448:
449: }
|