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-2007 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: /*
043: * AddKeybinding.java
044: *
045: * Created on 10/17/02 12:54 PM
046: */
047: package org.netbeans.modules.visualweb.gravy.properties.editors;
048:
049: import org.netbeans.jemmy.operators.*;
050:
051: /** Class implementing all necessary methods for handling "Add Keybinding" NbDialog.
052: */
053: public class AddKeybinding extends JDialogOperator {
054:
055: /** Creates new AddKeybinding that can handle it.
056: */
057: public AddKeybinding() {
058: super (java.util.ResourceBundle.getBundle(
059: "org.netbeans.editor.Bundle").getString("MSP_AddTitle"));
060: }
061:
062: private JLabelOperator _lblShortcutSequence;
063: private JTextFieldOperator _txtShortcutSequence;
064: private JTextAreaOperator _txtJTextArea;
065: private JButtonOperator _btOK;
066: private JButtonOperator _btClear;
067: private JButtonOperator _btCancel;
068: private JButtonOperator _btHelp;
069:
070: //******************************
071: // Subcomponents definition part
072: //******************************
073:
074: /** Tries to find "Shortcut Sequence:" JLabel in this dialog.
075: * @return JLabelOperator
076: */
077: public JLabelOperator lblShortcutSequence() {
078: if (_lblShortcutSequence == null) {
079: _lblShortcutSequence = new JLabelOperator(
080: this ,
081: java.util.ResourceBundle
082: .getBundle(
083: "org.netbeans.modules.editor.options.Bundle")
084: .getString("LBL_KSIP_Sequence"));
085: }
086: return _lblShortcutSequence;
087: }
088:
089: /** Tries to find null JTextField in this dialog.
090: * @return JTextFieldOperator
091: */
092: public JTextFieldOperator txtShortcutSequence() {
093: if (_txtShortcutSequence == null) {
094: _txtShortcutSequence = new JTextFieldOperator(this );
095: }
096: return _txtShortcutSequence;
097: }
098:
099: /** Tries to find null JTextArea in this dialog.
100: * @return JTextAreaOperator
101: */
102: public JTextAreaOperator txtJTextArea() {
103: if (_txtJTextArea == null) {
104: _txtJTextArea = new JTextAreaOperator(this );
105: }
106: return _txtJTextArea;
107: }
108:
109: /** Tries to find "OK" JButton in this dialog.
110: * @return JButtonOperator
111: */
112: public JButtonOperator btOK() {
113: if (_btOK == null) {
114: _btOK = new JButtonOperator(
115: this ,
116: java.util.ResourceBundle
117: .getBundle(
118: "org.netbeans.modules.editor.options.Bundle")
119: .getString("KBEP_OK_LABEL"));
120: }
121: return _btOK;
122: }
123:
124: /** Tries to find "Clear" JButton in this dialog.
125: * @return JButtonOperator
126: */
127: public JButtonOperator btClear() {
128: if (_btClear == null) {
129: _btClear = new JButtonOperator(
130: this ,
131: java.util.ResourceBundle
132: .getBundle(
133: "org.netbeans.modules.editor.options.Bundle")
134: .getString("KBEP_CLEAR_LABEL"));
135: }
136: return _btClear;
137: }
138:
139: /** Tries to find "Cancel" JButton in this dialog.
140: * @return JButtonOperator
141: */
142: public JButtonOperator btCancel() {
143: if (_btCancel == null) {
144: _btCancel = new JButtonOperator(
145: this ,
146: java.util.ResourceBundle
147: .getBundle(
148: "org.openide.explorer.propertysheet.Bundle")
149: .getString("CTL_Cancel"));
150: }
151: return _btCancel;
152: }
153:
154: /** Tries to find "Help" JButton in this dialog.
155: * @return JButtonOperator
156: */
157: public JButtonOperator btHelp() {
158: if (_btHelp == null) {
159: _btHelp = new JButtonOperator(
160: this ,
161: java.util.ResourceBundle
162: .getBundle(
163: "org.openide.explorer.propertysheet.Bundle")
164: .getString("CTL_Help"));
165: }
166: return _btHelp;
167: }
168:
169: //****************************************
170: // Low-level functionality definition part
171: //****************************************
172:
173: /** gets text for txtShortcutSequence
174: * @return String text
175: */
176: public String getShortcutSequence() {
177: return txtShortcutSequence().getText();
178: }
179:
180: /** sets text for txtShortcutSequence
181: * @param text String text
182: */
183: public void setShortcutSequence(String text) {
184: txtShortcutSequence().setText(text);
185: }
186:
187: /** types text for txtShortcutSequence
188: * @param text String text
189: */
190: public void typeShortcutSequence(String text) {
191: txtShortcutSequence().typeText(text);
192: }
193:
194: /** gets text for txtJTextArea
195: * @return String text
196: */
197: public String getJTextArea() {
198: return txtJTextArea().getText();
199: }
200:
201: /** sets text for txtJTextArea
202: * @param text String text
203: */
204: public void setJTextArea(String text) {
205: txtJTextArea().setText(text);
206: }
207:
208: /** types text for txtJTextArea
209: * @param text String text
210: */
211: public void typeJTextArea(String text) {
212: txtJTextArea().typeText(text);
213: }
214:
215: /** clicks on "OK" JButton
216: */
217: public void oK() {
218: btOK().push();
219: }
220:
221: /** clicks on "Clear" JButton
222: */
223: public void clear() {
224: btClear().push();
225: }
226:
227: /** clicks on "Cancel" JButton
228: */
229: public void cancel() {
230: btCancel().push();
231: }
232:
233: /** clicks on "Help" JButton
234: */
235: public void help() {
236: btHelp().push();
237: }
238:
239: //*****************************************
240: // High-level functionality definition part
241: //*****************************************
242:
243: /** Performs verification of AddKeybinding by accessing all its components.
244: */
245: public void verify() {
246: lblShortcutSequence();
247: txtShortcutSequence();
248: txtJTextArea();
249: btOK();
250: btClear();
251: btCancel();
252: btHelp();
253: }
254:
255: /** Performs simple test of AddKeybinding
256: * @param args the command line arguments
257: */
258: public static void main(String args[]) {
259: new AddKeybinding().verify();
260: System.out.println("AddKeybinding verification finished.");
261: }
262: }
|