KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > jellytools > modules > debuggercore > operators > AttachJDialogOperator


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  * The Original Software is NetBeans.
15  * The Initial Developer of the Original Software is Sun Microsystems, Inc.
16  * Portions created by Sun Microsystems, Inc. are Copyright (C) 2003
17  * All Rights Reserved.
18  *
19  * Contributor(s): Sun Microsystems, Inc.
20  */

21
22 package org.netbeans.jellytools.modules.debuggercore.operators;
23
24 import org.netbeans.jemmy.operators.*;
25
26 /** Class implementing all necessary methods for handling "Attach" NbDialog.
27  *
28  * @author mg105252
29  * @version 1.0
30  */

31 public class AttachJDialogOperator extends JDialogOperator {
32
33     /** Creates new AttachJDialogOperator that can handle it.
34      */

35     public AttachJDialogOperator() {
36         super("Attach");
37     }
38
39     private JComboBoxOperator _cboDebugger;
40     private JComboBoxOperator _cboConnector;
41 // public static final String ITEM_DEFAULTDEBUGGERJPDA = "Default Debugger (JPDA)";
42
private JTextFieldOperator _txtTransport;
43     private JTextFieldOperator _txtHost;
44     private JTextFieldOperator _txtPort;
45     private JButtonOperator _btOK;
46     private JButtonOperator _btCancel;
47     private JButtonOperator _btHelp;
48
49
50     //******************************
51
// Subcomponents definition part
52
//******************************
53

54     /** Tries to find null JComboBox in this dialog.
55      * @return JComboBoxOperator
56      */

57     public JComboBoxOperator cboDebugger() {
58         if (_cboDebugger==null) {
59             _cboDebugger = new JComboBoxOperator(this);
60         }
61         return _cboDebugger;
62     }
63
64 ///////////////////////////////////////////////////////////////////////////////
65
public JComboBoxOperator cboConnector() {
66         if (_cboConnector==null) {
67             _cboConnector = new JComboBoxOperator(this,1);
68         }
69         return _cboConnector;
70     }
71 ///////////////////////////////////////////////////////////////////////////////
72

73     /** Tries to find null JTextField in this dialog.
74      * @return JTextFieldOperator
75      */

76     public JTextFieldOperator txtTransport() {
77         if (_txtTransport==null) {
78             _txtTransport = new JTextFieldOperator(this);
79         }
80         return _txtTransport;
81     }
82
83     /** Tries to find null JTextField in this dialog.
84      * @return JTextFieldOperator
85      */

86     public JTextFieldOperator txtHost() {
87         if (_txtHost==null) {
88             _txtHost = new JTextFieldOperator(this, 1);
89         }
90         return _txtHost;
91     }
92
93     /** Tries to find null JTextField in this dialog.
94      * @return JTextFieldOperator
95      */

96     public JTextFieldOperator txtPort() {
97         if (_txtPort==null) {
98             _txtPort = new JTextFieldOperator(this, 2);
99         }
100         return _txtPort;
101     }
102
103     /** Tries to find "OK" JButton in this dialog.
104      * @return JButtonOperator
105      */

106     public JButtonOperator btOK() {
107         if (_btOK==null) {
108             _btOK = new JButtonOperator(this, "OK");
109         }
110         return _btOK;
111     }
112
113     /** Tries to find "Cancel" JButton in this dialog.
114      * @return JButtonOperator
115      */

116     public JButtonOperator btCancel() {
117         if (_btCancel==null) {
118             _btCancel = new JButtonOperator(this, "Cancel");
119         }
120         return _btCancel;
121     }
122
123     /** Tries to find "Help" JButton in this dialog.
124      * @return JButtonOperator
125      */

126     public JButtonOperator btHelp() {
127         if (_btHelp==null) {
128             _btHelp = new JButtonOperator(this, "Help");
129         }
130         return _btHelp;
131     }
132
133
134     //****************************************
135
// Low-level functionality definition part
136
//****************************************
137

138     /** returns selected item for cboDebugger
139      * @return String item
140      */

141     public String JavaDoc getSelectedDebugger() {
142         return cboDebugger().getSelectedItem().toString();
143     }
144
145     /** selects item for cboDebugger
146      * @param item String item
147      */

148     public void selectDebugger(String JavaDoc item) {
149         cboDebugger().selectItem(item);
150     }
151
152 ///////////////////////////////////////////////////////////////////////////////
153
public void selectConnector(String JavaDoc item) {
154         cboConnector().selectItem(item);
155     }
156
157     public void selectConnector(int item) {
158         cboConnector().selectItem(1);
159     }
160 ///////////////////////////////////////////////////////////////////////////////
161
/** types text for cboDebugger
162      * @param text String text
163      */

164     public void typeDebugger(String JavaDoc text) {
165         cboDebugger().typeText(text);
166     }
167
168     /** gets text for txtTransport
169      * @return String text
170      */

171     public String JavaDoc getTransport() {
172         return txtTransport().getText();
173     }
174
175     /** sets text for txtTransport
176      * @param text String text
177      */

178     public void setTransport(String JavaDoc text) {
179         txtTransport().setText(text);
180     }
181
182     /** types text for txtTransport
183      * @param text String text
184      */

185     public void typeTransport(String JavaDoc text) {
186         txtTransport().typeText(text);
187     }
188
189     /** gets text for txtHost
190      * @return String text
191      */

192     public String JavaDoc getHost() {
193         return txtHost().getText();
194     }
195
196     /** sets text for txtHost
197      * @param text String text
198      */

199     public void setHost(String JavaDoc text) {
200         txtHost().setText(text);
201     }
202
203     /** types text for txtHost
204      * @param text String text
205      */

206     public void typeHost(String JavaDoc text) {
207         txtHost().typeText(text);
208     }
209
210     /** gets text for txtPort
211      * @return String text
212      */

213     public String JavaDoc getPort() {
214         return txtPort().getText();
215     }
216
217     /** sets text for txtPort
218      * @param text String text
219      */

220     public void setPort(String JavaDoc text) {
221         txtPort().setText(text);
222     }
223
224     /** types text for txtPort
225      * @param text String text
226      */

227     public void typePort(String JavaDoc text) {
228         txtPort().typeText(text);
229     }
230
231     /** clicks on "OK" JButton
232      */

233     public void oK() {
234         btOK().push();
235     }
236
237     /** clicks on "Cancel" JButton
238      */

239     public void cancel() {
240         btCancel().push();
241     }
242
243     /** clicks on "Help" JButton
244      */

245     public void help() {
246         btHelp().push();
247     }
248
249
250     //*****************************************
251
// High-level functionality definition part
252
//*****************************************
253

254     /** Performs verification of AttachJDialogOperator by accessing all its components.
255      */

256     public void verify() {
257         cboDebugger();
258         txtTransport();
259         txtHost();
260         txtPort();
261         btOK();
262         btCancel();
263         btHelp();
264     }
265
266     /** Performs simple test of AttachJDialogOperator
267     * @param args the command line arguments
268     */

269     public static void main(String JavaDoc args[]) {
270 // new AttachJDialogOperator().verify();
271
System.out.println("AttachJDialogOperator verification finished.");
272         java.util.Enumeration JavaDoc enumeration = System.getProperties().keys();
273         String JavaDoc property;
274         while (enumeration.hasMoreElements()) {
275             property = (String JavaDoc) enumeration.nextElement();
276             System.out.println(property + "\t" + System.getProperty(property) );
277         }
278         
279         
280     }
281 }
282
283
Popular Tags