KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > subversion > operators > ProxyConfigurationOperator


1 /*
2  * ProxyConfigurationOperator.java
3  *
4  * Created on 10/05/06 10:53
5  */

6 package org.netbeans.test.subversion.operators;
7
8 import org.netbeans.jellytools.NbDialogOperator;
9 import org.netbeans.jemmy.operators.*;
10
11 /** Class implementing all necessary methods for handling "Proxy Configuration" NbDialog.
12  *
13  * @author peter
14  * @version 1.0
15  */

16 public class ProxyConfigurationOperator extends NbDialogOperator {
17
18     /**
19      * Creates new ProxyConfigurationOperator that can handle it.
20      */

21     public ProxyConfigurationOperator() {
22         super("Proxy Configuration");
23     }
24
25     private JRadioButtonOperator _rbUseSystemProxySettings;
26     private JRadioButtonOperator _rbNoProxyDirectConnection;
27     private JRadioButtonOperator _rbHTTPProxy;
28     //private JRadioButtonOperator _rbSOCKSProxy;
29
private JLabelOperator _lblProxyHost;
30     private JTextFieldOperator _txtProxyHost;
31     private JLabelOperator _lblPort;
32     private JTextFieldOperator _txtPort;
33     private JCheckBoxOperator _cbProxyServerRequiresLogin;
34     private JLabelOperator _lblName;
35     private JTextFieldOperator _txtName;
36     private JLabelOperator _lblPassword;
37     private JPasswordFieldOperator _txtPassword;
38     private JButtonOperator _btOK;
39     private JButtonOperator _btCancel;
40     private JButtonOperator _btHelp;
41
42
43     //******************************
44
// Subcomponents definition part
45
//******************************
46

47     /** Tries to find "Use System Proxy Settings" JRadioButton in this dialog.
48      * @return JRadioButtonOperator
49      */

50     public JRadioButtonOperator rbUseSystemProxySettings() {
51         if (_rbUseSystemProxySettings==null) {
52             _rbUseSystemProxySettings = new JRadioButtonOperator(this, "Use NetBeans Proxy Settings");
53         }
54         return _rbUseSystemProxySettings;
55     }
56
57     /** Tries to find "No Proxy (direct connection)" JRadioButton in this dialog.
58      * @return JRadioButtonOperator
59      */

60     public JRadioButtonOperator rbNoProxyDirectConnection() {
61         if (_rbNoProxyDirectConnection==null) {
62             _rbNoProxyDirectConnection = new JRadioButtonOperator(this, "No Proxy (direct connection)");
63         }
64         return _rbNoProxyDirectConnection;
65     }
66
67     /** Tries to find "HTTP Proxy" JRadioButton in this dialog.
68      * @return JRadioButtonOperator
69      */

70     public JRadioButtonOperator rbHTTPProxy() {
71         if (_rbHTTPProxy==null) {
72             _rbHTTPProxy = new JRadioButtonOperator(this, "HTTP Proxy");
73         }
74         return _rbHTTPProxy;
75     }
76
77     /** Tries to find "Proxy Host:" JLabel in this dialog.
78      * @return JLabelOperator
79      */

80     public JLabelOperator lblProxyHost() {
81         if (_lblProxyHost==null) {
82             _lblProxyHost = new JLabelOperator(this, "Proxy Host:");
83         }
84         return _lblProxyHost;
85     }
86
87     /** Tries to find null JTextField in this dialog.
88      * @return JTextFieldOperator
89      */

90     public JTextFieldOperator txtProxyHost() {
91         if (_txtProxyHost==null) {
92             _txtProxyHost = new JTextFieldOperator(this);
93         }
94         return _txtProxyHost;
95     }
96
97     /** Tries to find "Port:" JLabel in this dialog.
98      * @return JLabelOperator
99      */

100     public JLabelOperator lblPort() {
101         if (_lblPort==null) {
102             _lblPort = new JLabelOperator(this, "Port:");
103         }
104         return _lblPort;
105     }
106
107     /** Tries to find null JFormattedTextField in this dialog.
108      * @return JTextFieldOperator
109      */

110     public JTextFieldOperator txtPort() {
111         if (_txtPort==null) {
112             _txtPort = new JTextFieldOperator(this, 1);
113         }
114         return _txtPort;
115     }
116
117     /** Tries to find "Proxy Server Requires Login" JCheckBox in this dialog.
118      * @return JCheckBoxOperator
119      */

120     public JCheckBoxOperator cbProxyServerRequiresLogin() {
121         if (_cbProxyServerRequiresLogin==null) {
122             _cbProxyServerRequiresLogin = new JCheckBoxOperator(this, "Proxy Server Requires Login");
123         }
124         return _cbProxyServerRequiresLogin;
125     }
126
127     /** Tries to find "Name:" JLabel in this dialog.
128      * @return JLabelOperator
129      */

130     public JLabelOperator lblName() {
131         if (_lblName==null) {
132             _lblName = new JLabelOperator(this, "Name:");
133         }
134         return _lblName;
135     }
136
137     /** Tries to find null JTextField in this dialog.
138      * @return JTextFieldOperator
139      */

140     public JTextFieldOperator txtName() {
141         if (_txtName==null) {
142             _txtName = new JTextFieldOperator(this, 2);
143         }
144         return _txtName;
145     }
146
147     /** Tries to find "Password:" JLabel in this dialog.
148      * @return JLabelOperator
149      */

150     public JLabelOperator lblPassword() {
151         if (_lblPassword==null) {
152             _lblPassword = new JLabelOperator(this, "Password:");
153         }
154         return _lblPassword;
155     }
156
157     /** Tries to find null JPasswordField in this dialog.
158      * @return JPasswordFieldOperator
159      */

160     public JPasswordFieldOperator txtPassword() {
161         if (_txtPassword==null) {
162             _txtPassword = new JPasswordFieldOperator(this);
163         }
164         return _txtPassword;
165     }
166
167     /** Tries to find "OK" JButton in this dialog.
168      * @return JButtonOperator
169      */

170     public JButtonOperator btOK() {
171         if (_btOK==null) {
172             _btOK = new JButtonOperator(this, "OK");
173         }
174         return _btOK;
175     }
176
177     /** Tries to find "Cancel" JButton in this dialog.
178      * @return JButtonOperator
179      */

180     public JButtonOperator btCancel() {
181         if (_btCancel==null) {
182             _btCancel = new JButtonOperator(this, "Cancel");
183         }
184         return _btCancel;
185     }
186
187     /** Tries to find "Help" JButton in this dialog.
188      * @return JButtonOperator
189      */

190     public JButtonOperator btHelp() {
191         if (_btHelp==null) {
192             _btHelp = new JButtonOperator(this, "Help");
193         }
194         return _btHelp;
195     }
196
197
198     //****************************************
199
// Low-level functionality definition part
200
//****************************************
201

202     /** clicks on "Use System Proxy Settings" JRadioButton
203      */

204     public void useSystemProxySettings() {
205         rbUseSystemProxySettings().push();
206     }
207
208     /** clicks on "No Proxy (direct connection)" JRadioButton
209      */

210     public void noProxyDirectConnection() {
211         rbNoProxyDirectConnection().push();
212     }
213
214     /** clicks on "HTTP Proxy" JRadioButton
215      */

216     public void hTTPProxy() {
217         rbHTTPProxy().push();
218     }
219
220     /** gets text for txtProxyHost
221      * @return String text
222      */

223     public String JavaDoc getProxyHost() {
224         return txtProxyHost().getText();
225     }
226
227     /** sets text for txtProxyHost
228      * @param text String text
229      */

230     public void setProxyHost(String JavaDoc text) {
231         txtProxyHost().setText(text);
232     }
233
234     /** types text for txtProxyHost
235      * @param text String text
236      */

237     public void typeProxyHost(String JavaDoc text) {
238         txtProxyHost().typeText(text);
239     }
240
241     /** gets text for txtPort
242      * @return String text
243      */

244     public String JavaDoc getPort() {
245         return txtPort().getText();
246     }
247
248     /** sets text for txtPort
249      * @param text String text
250      */

251     public void setPort(String JavaDoc text) {
252         txtPort().setText(text);
253     }
254
255     /** types text for txtPort
256      * @param text String text
257      */

258     public void typePort(String JavaDoc text) {
259         txtPort().typeText(text);
260     }
261
262     /** checks or unchecks given JCheckBox
263      * @param state boolean requested state
264      */

265     public void checkProxyServerRequiresLogin(boolean state) {
266         if (cbProxyServerRequiresLogin().isSelected()!=state) {
267             cbProxyServerRequiresLogin().push();
268         }
269     }
270
271     /** gets text for txtName
272      * @return String text
273      */

274     public String JavaDoc getName() {
275         return txtName().getText();
276     }
277
278     /** sets text for txtName
279      * @param text String text
280      */

281     public void setName(String JavaDoc text) {
282         txtName().setText(text);
283     }
284
285     /** types text for txtName
286      * @param text String text
287      */

288     public void typeName(String JavaDoc text) {
289         txtName().typeText(text);
290     }
291
292     /** sets text for txtPassword
293      * @param text String text
294      */

295     public void setPassword(String JavaDoc text) {
296         txtPassword().setText(text);
297     }
298
299     /** types text for txtPassword
300      * @param text String text
301      */

302     public void typePassword(String JavaDoc text) {
303         txtPassword().typeText(text);
304     }
305
306     /** clicks on "OK" JButton
307      */

308     public void ok() {
309         btOK().push();
310     }
311
312     /** clicks on "Cancel" JButton
313      */

314     public void cancel() {
315         btCancel().push();
316     }
317
318     /** clicks on "Help" JButton
319      */

320     public void help() {
321         btHelp().push();
322     }
323
324
325     //*****************************************
326
// High-level functionality definition part
327
//*****************************************
328

329     /**
330      * Performs verification of ProxyConfigurationOperator by accessing all its components.
331      */

332     public void verify() {
333         rbUseSystemProxySettings();
334         rbNoProxyDirectConnection();
335         rbHTTPProxy();
336         lblProxyHost();
337         txtProxyHost();
338         lblPort();
339         txtPort();
340         cbProxyServerRequiresLogin();
341         lblName();
342         txtName();
343         lblPassword();
344         txtPassword();
345         btOK();
346         btCancel();
347         btHelp();
348     }
349 }
350
351
Popular Tags