KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * AddShortcutDialog.java
3  *
4  * Created on 2/27/07 5:44 PM
5  */

6 package org.netbeans.jellytools.modules.editor;
7
8 import org.netbeans.jemmy.operators.*;
9 import org.netbeans.jemmy.util.NameComponentChooser;
10
11 /** Class implementing all necessary methods for handling "Add Shortcut Dialog" NbDialog.
12  *
13  * @author jp159440
14  * @version 1.0
15  */

16 public class AddShortcutDialog extends JDialogOperator {
17
18     /** Creates new AddShortcutDialog that can handle it.
19      */

20     public AddShortcutDialog() {
21         super("Add Shortcut Dialog");
22     }
23
24     private JLabelOperator _lblShortcut;
25     private JLabelOperator _lblConflict;
26     private JTextFieldOperator _txtJTextField;
27     private JButtonOperator _btOK;
28     private JButtonOperator _btCancel;
29     private JButtonOperator _btClear;
30     private JButtonOperator _btTab;
31
32
33     //******************************
34
// Subcomponents definition part
35
//******************************
36

37     /** Tries to find "Shortcut:" JLabel in this dialog.
38      * @return JLabelOperator
39      */

40     public JLabelOperator lblShortcut() {
41         if (_lblShortcut==null) {
42             _lblShortcut = new JLabelOperator(this, "Shortcut:");
43         }
44         return _lblShortcut;
45     }
46     
47     /** Tries to find "Shortcut:" JLabel in this dialog.
48      * @return JLabelOperator
49      */

50     public JLabelOperator lblConflict() {
51         if (_lblConflict==null) {
52             _lblConflict = new JLabelOperator(this,0);
53         }
54         return _lblConflict;
55     }
56
57     /** Tries to find null JTextField in this dialog.
58      * @return JTextFieldOperator
59      */

60     public JTextFieldOperator txtJTextField() {
61         if (_txtJTextField==null) {
62             _txtJTextField = new JTextFieldOperator(this);
63         }
64         return _txtJTextField;
65     }
66
67     /** Tries to find "OK" JButton in this dialog.
68      * @return JButtonOperator
69      */

70     public JButtonOperator btOK() {
71         if (_btOK==null) {
72             _btOK = new JButtonOperator(this, "OK");
73         }
74         return _btOK;
75     }
76
77     /** Tries to find "Cancel" JButton in this dialog.
78      * @return JButtonOperator
79      */

80     public JButtonOperator btCancel() {
81         if (_btCancel==null) {
82             _btCancel = new JButtonOperator(this, "Cancel");
83         }
84         return _btCancel;
85     }
86
87     /** Tries to find "Clear" JButton in this dialog.
88      * @return JButtonOperator
89      */

90     public JButtonOperator btClear() {
91         if (_btClear==null) {
92             _btClear = new JButtonOperator(this, "Clear");
93         }
94         return _btClear;
95     }
96
97     /** Tries to find "Tab" JButton in this dialog.
98      * @return JButtonOperator
99      */

100     public JButtonOperator btTab() {
101         if (_btTab==null) {
102             _btTab = new JButtonOperator(this, "Tab");
103         }
104         return _btTab;
105     }
106
107
108     //****************************************
109
// Low-level functionality definition part
110
//****************************************
111

112     /** gets text for txtJTextField
113      * @return String text
114      */

115     public String JavaDoc getJTextField() {
116         return txtJTextField().getText();
117     }
118
119     /** sets text for txtJTextField
120      * @param text String text
121      */

122     public void setJTextField(String JavaDoc text) {
123         txtJTextField().setText(text);
124     }
125
126     /** types text for txtJTextField
127      * @param text String text
128      */

129     public void typeJTextField(String JavaDoc text) {
130         txtJTextField().typeText(text);
131     }
132
133     /** clicks on "OK" JButton
134      */

135     public void ok() {
136         btOK().push();
137     }
138
139     /** clicks on "Cancel" JButton
140      */

141     public void cancel() {
142         btCancel().push();
143     }
144
145     /** clicks on "Clear" JButton
146      */

147     public void clear() {
148         btClear().push();
149     }
150
151     /** clicks on "Tab" JButton
152      */

153     public void tab() {
154         btTab().push();
155     }
156
157
158     //*****************************************
159
// High-level functionality definition part
160
//*****************************************
161

162     /** Performs verification of AddShortcutDialog by accessing all its components.
163      */

164     public void verify() {
165         lblShortcut();
166         txtJTextField();
167         btOK();
168         btCancel();
169         btClear();
170         btTab();
171     }
172
173     /** Performs simple test of AddShortcutDialog
174     * @param args the command line arguments
175     */

176     public static void main(String JavaDoc args[]) {
177         new AddShortcutDialog().verify();
178         System.out.println("AddShortcutDialog verification finished.");
179     }
180 }
181
182
Popular Tags