KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > jellytools > modules > java > SynchronizeOperator


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  * SynchronizeOperator.java
22  *
23  * Created on 9/30/02 4:03 PM
24  */

25 package org.netbeans.jellytools.modules.java;
26
27 import org.netbeans.jellytools.Bundle;
28 import org.netbeans.jemmy.operators.*;
29
30 /** Class implementing all necessary methods for handling "Confirm Changes" NbDialog.
31  *
32  * @author jb105785
33  * @version 1.0
34  */

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

39     public SynchronizeOperator() {
40         super(Bundle.getString("org.netbeans.modules.java.Bundle", "LAB_ConfirmDialog"));
41     }
42
43     private JTextAreaOperator _txtJTextArea;
44     private JLabelOperator _lblChangesList;
45     private JListOperator _lstChangesList;
46     private JRadioButtonOperator _rbDoNotSynchronizeThisObjectNowToDoSoExplicitlyUseToolsSynchronize;
47     private JRadioButtonOperator _rbConfirmAllChangesDuringSynchronization;
48     private JRadioButtonOperator _rbPerformSynchronizationWithoutConfirmation;
49     private JButtonOperator _btProcess;
50     private JButtonOperator _btProcessAll;
51     private JButtonOperator _btHelp;
52     private JButtonOperator _btClose;
53
54
55     //******************************
56
// Subcomponents definition part
57
//******************************
58

59     /** Tries to find null JTextArea in this dialog.
60      * @return JTextAreaOperator
61      */

62     public JTextAreaOperator txtJTextArea() {
63         if (_txtJTextArea==null) {
64             _txtJTextArea = new JTextAreaOperator(this);
65         }
66         return _txtJTextArea;
67     }
68
69     /** Tries to find "Changes List" JLabel in this dialog.
70      * @return JLabelOperator
71      */

72     public JLabelOperator lblChangesList() {
73         if (_lblChangesList==null) {
74             _lblChangesList = new JLabelOperator(this, Bundle.getString("org.netbeans.modules.java.Bundle", "LAB_ChangesList"));
75         }
76         return _lblChangesList;
77     }
78
79     /** Tries to find null JList in this dialog.
80      * @return JListOperator
81      */

82     public JListOperator lstChangesList() {
83         if (_lstChangesList==null) {
84             _lstChangesList = new JListOperator(this);
85         }
86         return _lstChangesList;
87     }
88
89     /** Tries to find "Do not synchronize this object now (to do so explicitly, use Tools | Synchronize)" JRadioButton in this dialog.
90      * @return JRadioButtonOperator
91      */

92     public JRadioButtonOperator rbDoNotSynchronizeThisObjectNowToDoSoExplicitlyUseToolsSynchronize() {
93         if (_rbDoNotSynchronizeThisObjectNowToDoSoExplicitlyUseToolsSynchronize==null) {
94             _rbDoNotSynchronizeThisObjectNowToDoSoExplicitlyUseToolsSynchronize = new JRadioButtonOperator(this, Bundle.getString("org.netbeans.modules.java.Bundle", "LAB_radioDisable"));
95         }
96         return _rbDoNotSynchronizeThisObjectNowToDoSoExplicitlyUseToolsSynchronize;
97     }
98
99     /** Tries to find "Confirm all changes during synchronization" JRadioButton in this dialog.
100      * @return JRadioButtonOperator
101      */

102     public JRadioButtonOperator rbConfirmAllChangesDuringSynchronization() {
103         if (_rbConfirmAllChangesDuringSynchronization==null) {
104             _rbConfirmAllChangesDuringSynchronization = new JRadioButtonOperator(this, Bundle.getString("org.netbeans.modules.java.Bundle", "LAB_radioConfirm"));
105         }
106         return _rbConfirmAllChangesDuringSynchronization;
107     }
108
109     /** Tries to find "Perform synchronization without confirmation" JRadioButton in this dialog.
110      * @return JRadioButtonOperator
111      */

112     public JRadioButtonOperator rbPerformSynchronizationWithoutConfirmation() {
113         if (_rbPerformSynchronizationWithoutConfirmation==null) {
114             _rbPerformSynchronizationWithoutConfirmation = new JRadioButtonOperator(this, Bundle.getString("org.netbeans.modules.java.Bundle", "LAB_radioAuto"));
115         }
116         return _rbPerformSynchronizationWithoutConfirmation;
117     }
118
119     /** Tries to find "Process" JButton in this dialog.
120      * @return JButtonOperator
121      */

122     public JButtonOperator btProcess() {
123         if (_btProcess==null) {
124             _btProcess = new JButtonOperator(this, Bundle.getString("org.netbeans.modules.java.Bundle", "LAB_processButton"));
125         }
126         return _btProcess;
127     }
128
129     /** Tries to find "Process All" JButton in this dialog.
130      * @return JButtonOperator
131      */

132     public JButtonOperator btProcessAll() {
133         if (_btProcessAll==null) {
134             _btProcessAll = new JButtonOperator(this, Bundle.getString("org.netbeans.modules.java.Bundle", "LAB_processAllButton"));
135         }
136         return _btProcessAll;
137     }
138
139     /** Tries to find "Help" JButton in this dialog.
140      * @return JButtonOperator
141      */

142     public JButtonOperator btHelp() {
143         if (_btHelp==null) {
144             _btHelp = new JButtonOperator(this, Bundle.getString("org.openide.Bundle", "CTL_HelpName"));
145         }
146         return _btHelp;
147     }
148
149     /** Tries to find "Close" JButton in this dialog.
150      * @return JButtonOperator
151      */

152     public JButtonOperator btClose() {
153         if (_btClose==null) {
154             _btClose = new JButtonOperator(this, Bundle.getString("org.openide.Bundle", "CTL_CLOSE"));
155         }
156         return _btClose;
157     }
158
159
160     //****************************************
161
// Low-level functionality definition part
162
//****************************************
163

164     /** gets text for txtJTextArea
165      * @return String text
166      */

167     public String JavaDoc getJTextArea() {
168         return txtJTextArea().getText();
169     }
170
171     /** sets text for txtJTextArea
172      * @param text String text
173      */

174     public void setJTextArea(String JavaDoc text) {
175         txtJTextArea().setText(text);
176     }
177
178     /** types text for txtJTextArea
179      * @param text String text
180      */

181     public void typeJTextArea(String JavaDoc text) {
182         txtJTextArea().typeText(text);
183     }
184
185     /** clicks on "Do not synchronize this object now (to do so explicitly, use Tools | Synchronize)" JRadioButton
186      */

187     public void doNotSynchronizeThisObjectNowToDoSoExplicitlyUseToolsSynchronize() {
188         rbDoNotSynchronizeThisObjectNowToDoSoExplicitlyUseToolsSynchronize().push();
189     }
190
191     /** clicks on "Confirm all changes during synchronization" JRadioButton
192      */

193     public void confirmAllChangesDuringSynchronization() {
194         rbConfirmAllChangesDuringSynchronization().push();
195     }
196
197     /** clicks on "Perform synchronization without confirmation" JRadioButton
198      */

199     public void performSynchronizationWithoutConfirmation() {
200         rbPerformSynchronizationWithoutConfirmation().push();
201     }
202
203     /** clicks on "Process" JButton
204      */

205     public void process() {
206         btProcess().push();
207     }
208
209     /** clicks on "Process All" JButton
210      */

211     public void processAll() {
212         btProcessAll().push();
213     }
214
215     /** clicks on "Help" JButton
216      */

217     public void help() {
218         btHelp().push();
219     }
220
221     /** clicks on "Close" JButton
222      */

223     public void close() {
224         btClose().push();
225     }
226
227
228     //*****************************************
229
// High-level functionality definition part
230
//*****************************************
231

232     /** Performs verification of SynchronizeOperator by accessing all its components.
233      */

234     public void verify() {
235         txtJTextArea();
236         lblChangesList();
237         lstChangesList();
238         rbDoNotSynchronizeThisObjectNowToDoSoExplicitlyUseToolsSynchronize();
239         rbConfirmAllChangesDuringSynchronization();
240         rbPerformSynchronizationWithoutConfirmation();
241         btProcess();
242         btProcessAll();
243         btHelp();
244         btClose();
245     }
246
247     /** Performs simple test of SynchronizeOperator
248     * @param args the command line arguments
249     */

250     public static void main(String JavaDoc args[]) {
251         new SynchronizeOperator().verify();
252         System.out.println("SynchronizeOperator verification finished.");
253     }
254 }
255
256
Popular Tags