KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > jellytools > modules > editor > AddKeybinding


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * AddKeybinding.java
22  *
23  * Created on 10/17/02 12:54 PM
24  */

25 package org.netbeans.jellytools.modules.editor;
26
27 import org.netbeans.jemmy.operators.*;
28
29 /** Class implementing all necessary methods for handling "Add Keybinding" NbDialog.
30  *
31  * @author eh103527
32  * @version 1.0
33  */

34 public class AddKeybinding extends JDialogOperator {
35
36     /** Creates new AddKeybinding that can handle it.
37      */

38     public AddKeybinding() {
39         super(java.util.ResourceBundle.getBundle("org.netbeans.editor.Bundle").getString("MSP_AddTitle"));
40     }
41
42     private JLabelOperator _lblShortcutSequence;
43     private JTextFieldOperator _txtShortcutSequence;
44     private JTextAreaOperator _txtJTextArea;
45     private JButtonOperator _btOK;
46     private JButtonOperator _btClear;
47     private JButtonOperator _btCancel;
48     private JButtonOperator _btHelp;
49     
50     
51     //******************************
52
// Subcomponents definition part
53
//******************************
54

55     /** Tries to find "Shortcut Sequence:" JLabel in this dialog.
56      * @return JLabelOperator
57      */

58     public JLabelOperator lblShortcutSequence() {
59         if (_lblShortcutSequence==null) {
60             _lblShortcutSequence = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("LBL_KSIP_Sequence"));
61         }
62         return _lblShortcutSequence;
63     }
64     
65     /** Tries to find null JTextField in this dialog.
66      * @return JTextFieldOperator
67      */

68     public JTextFieldOperator txtShortcutSequence() {
69         if (_txtShortcutSequence==null) {
70             _txtShortcutSequence = new JTextFieldOperator(this);
71         }
72         return _txtShortcutSequence;
73     }
74     
75     /** Tries to find null JTextArea in this dialog.
76      * @return JTextAreaOperator
77      */

78     public JTextAreaOperator txtJTextArea() {
79         if (_txtJTextArea==null) {
80             _txtJTextArea = new JTextAreaOperator(this);
81         }
82         return _txtJTextArea;
83     }
84     
85     /** Tries to find "OK" JButton in this dialog.
86      * @return JButtonOperator
87      */

88     public JButtonOperator btOK() {
89         if (_btOK==null) {
90             _btOK = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_OK_LABEL"));
91         }
92         return _btOK;
93     }
94     
95     /** Tries to find "Clear" JButton in this dialog.
96      * @return JButtonOperator
97      */

98     public JButtonOperator btClear() {
99         if (_btClear==null) {
100             _btClear = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_CLEAR_LABEL"));
101         }
102         return _btClear;
103     }
104     
105     /** Tries to find "Cancel" JButton in this dialog.
106      * @return JButtonOperator
107      */

108     public JButtonOperator btCancel() {
109         if (_btCancel==null) {
110             _btCancel = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Cancel"));
111         }
112         return _btCancel;
113     }
114     
115     /** Tries to find "Help" JButton in this dialog.
116      * @return JButtonOperator
117      */

118     public JButtonOperator btHelp() {
119         if (_btHelp==null) {
120             _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help"));
121         }
122         return _btHelp;
123     }
124     
125     
126     //****************************************
127
// Low-level functionality definition part
128
//****************************************
129

130     /** gets text for txtShortcutSequence
131      * @return String text
132      */

133     public String JavaDoc getShortcutSequence() {
134         return txtShortcutSequence().getText();
135     }
136     
137     /** sets text for txtShortcutSequence
138      * @param text String text
139      */

140     public void setShortcutSequence(String JavaDoc text) {
141         txtShortcutSequence().setText(text);
142     }
143     
144     /** types text for txtShortcutSequence
145      * @param text String text
146      */

147     public void typeShortcutSequence(String JavaDoc text) {
148         txtShortcutSequence().typeText(text);
149     }
150     
151     /** gets text for txtJTextArea
152      * @return String text
153      */

154     public String JavaDoc getJTextArea() {
155         return txtJTextArea().getText();
156     }
157     
158     /** sets text for txtJTextArea
159      * @param text String text
160      */

161     public void setJTextArea(String JavaDoc text) {
162         txtJTextArea().setText(text);
163     }
164     
165     /** types text for txtJTextArea
166      * @param text String text
167      */

168     public void typeJTextArea(String JavaDoc text) {
169         txtJTextArea().typeText(text);
170     }
171     
172     /** clicks on "OK" JButton
173      */

174     public void oK() {
175         btOK().push();
176     }
177     
178     /** clicks on "Clear" JButton
179      */

180     public void clear() {
181         btClear().push();
182     }
183     
184     /** clicks on "Cancel" JButton
185      */

186     public void cancel() {
187         btCancel().push();
188     }
189     
190     /** clicks on "Help" JButton
191      */

192     public void help() {
193         btHelp().push();
194     }
195     
196     
197     //*****************************************
198
// High-level functionality definition part
199
//*****************************************
200

201     /** Performs verification of AddKeybinding by accessing all its components.
202      */

203     public void verify() {
204         lblShortcutSequence();
205         txtShortcutSequence();
206         txtJTextArea();
207         btOK();
208         btClear();
209         btCancel();
210         btHelp();
211     }
212     
213     /** Performs simple test of AddKeybinding
214      * @param args the command line arguments
215      */

216     public static void main(String JavaDoc args[]) {
217         new AddKeybinding().verify();
218         System.out.println("AddKeybinding verification finished.");
219     }
220 }
221
222
Popular Tags