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 org.netbeans.jellytools.NbDialogOperator;
045: import org.netbeans.jemmy.operators.JButtonOperator;
046: import org.netbeans.jemmy.operators.JLabelOperator;
047: import org.netbeans.jemmy.operators.JTextAreaOperator;
048: import org.netbeans.jemmy.operators.JTextFieldOperator;
049:
050: /** Class implementing all necessary methods for handling "Add Navigation Rule" NbDialog.
051: *
052: * @author luke
053: */
054: public class AddNavigationRuleDialogOperator extends NbDialogOperator {
055:
056: /** Creates new AddNavigationRule that can handle it.
057: */
058: public AddNavigationRuleDialogOperator() {
059: super ("Add Navigation Rule");
060: }
061:
062: private JLabelOperator _lblRuleFromView;
063: private JTextFieldOperator _txtRuleFromView;
064: private JButtonOperator _btBrowse;
065: private JLabelOperator _lblRuleDescription;
066: private JTextAreaOperator _txtRuleDescription;
067: private JButtonOperator _btAdd;
068:
069: //******************************
070: // Subcomponents definition part
071: //******************************
072:
073: /** Tries to find "Rule from View:" JLabel in this dialog.
074: * @return JLabelOperator
075: */
076: public JLabelOperator lblRuleFromView() {
077: if (_lblRuleFromView == null) {
078: _lblRuleFromView = new JLabelOperator(this ,
079: "Rule from View:");
080: }
081: return _lblRuleFromView;
082: }
083:
084: /** Tries to find null JTextField in this dialog.
085: * @return JTextFieldOperator
086: */
087: public JTextFieldOperator txtRuleFromView() {
088: if (_txtRuleFromView == null) {
089: _txtRuleFromView = new JTextFieldOperator(this );
090: }
091: return _txtRuleFromView;
092: }
093:
094: /** Tries to find "Browse..." JButton in this dialog.
095: * @return JButtonOperator
096: */
097: public JButtonOperator btBrowse() {
098: if (_btBrowse == null) {
099: _btBrowse = new JButtonOperator(this , "Browse...");
100: }
101: return _btBrowse;
102: }
103:
104: /** Tries to find "Rule Description:" JLabel in this dialog.
105: * @return JLabelOperator
106: */
107: public JLabelOperator lblRuleDescription() {
108: if (_lblRuleDescription == null) {
109: _lblRuleDescription = new JLabelOperator(this ,
110: "Rule Description:");
111: }
112: return _lblRuleDescription;
113: }
114:
115: /** Tries to find null JTextArea in this dialog.
116: * @return JTextAreaOperator
117: */
118: public JTextAreaOperator txtRuleDescription() {
119: if (_txtRuleDescription == null) {
120: _txtRuleDescription = new JTextAreaOperator(this );
121: }
122: return _txtRuleDescription;
123: }
124:
125: /** Tries to find "Add" JButton in this dialog.
126: * @return JButtonOperator
127: */
128: public JButtonOperator btAdd() {
129: if (_btAdd == null) {
130: _btAdd = new JButtonOperator(this , "Add");
131: }
132: return _btAdd;
133: }
134:
135: //****************************************
136: // Low-level functionality definition part
137: //****************************************
138:
139: /** gets text for txtRuleFromView
140: * @return String text
141: */
142: public String getRuleFromView() {
143: return txtRuleFromView().getText();
144: }
145:
146: /** sets text for txtRuleFromView
147: * @param text String text
148: */
149: public void setRuleFromView(String text) {
150: txtRuleFromView().setText(text);
151: }
152:
153: /** types text for txtRuleFromView
154: * @param text String text
155: */
156: public void typeRuleFromView(String text) {
157: txtRuleFromView().typeText(text);
158: }
159:
160: /** clicks on "Browse..." JButton
161: */
162: public void browse() {
163: btBrowse().push();
164: }
165:
166: /** gets text for txtRuleDescription
167: * @return String text
168: */
169: public String getRuleDescription() {
170: return txtRuleDescription().getText();
171: }
172:
173: /** sets text for txtRuleDescription
174: * @param text String text
175: */
176: public void setRuleDescription(String text) {
177: txtRuleDescription().setText(text);
178: }
179:
180: /** types text for txtRuleDescription
181: * @param text String text
182: */
183: public void typeRuleDescription(String text) {
184: txtRuleDescription().typeText(text);
185: }
186:
187: /** clicks on "Add" JButton
188: */
189: public void add() {
190: btAdd().push();
191: }
192:
193: //*****************************************
194: // High-level functionality definition part
195: //*****************************************
196:
197: /** Performs verification of AddNavigationRule by accessing all its components.
198: */
199: public void verify() {
200: lblRuleFromView();
201: txtRuleFromView();
202: btBrowse();
203: lblRuleDescription();
204: txtRuleDescription();
205: btAdd();
206: btCancel();
207: btHelp();
208: }
209: }
|