KickJava   Java API By Example, From Geeks To Geeks.

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


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  * OverrideMethodsOperator.java
22  *
23  * Created on 12/4/04 7:32 PM
24  */

25 package org.netbeans.jellytools.modules.java;
26
27 import org.netbeans.jemmy.operators.*;
28
29 /** Class implementing all necessary methods for handling "Override and Implement Methods" NbDialog.
30  *
31  * @author Roman Strobl
32  * @version 1.0
33  */

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

38     public OverrideMethodsOperator() {
39         super(org.netbeans.jellytools.Bundle.getString("org.netbeans.modules.java.tools.Bundle", "LBL_OverridePanel2_Title"));
40     }
41
42     private JLabelOperator _lblSelectTheMethodsToOverrideOrImplementForMultipleSelectionUseCTRLKey;
43     private JCheckBoxOperator _cbShowSuperclassesAndInterfaces;
44     private JCheckBoxOperator _cbShowAbstractMethodsOnly;
45     private JLabelOperator _lblAvailableSuperclassAndInterfaceMethods;
46     private JTreeOperator _treeAvailableSuperclassAndInterfaceMethods;
47     private JCheckBoxOperator _cbGenerateSuperCalls;
48     private JCheckBoxOperator _cbCopyJavadoc;
49     private JButtonOperator _btOK;
50     private JButtonOperator _btCancel;
51
52
53     //******************************
54
// Subcomponents definition part
55
//******************************
56

57     /** Tries to find "Select the methods to override or implement. For multiple selection use CTRL key." JLabel in this dialog.
58      * @return JLabelOperator
59      */

60     public JLabelOperator lblSelectTheMethodsToOverrideOrImplementForMultipleSelectionUseCTRLKey() {
61         if (_lblSelectTheMethodsToOverrideOrImplementForMultipleSelectionUseCTRLKey==null) {
62             _lblSelectTheMethodsToOverrideOrImplementForMultipleSelectionUseCTRLKey = new JLabelOperator(this, "Select the methods to override or implement. For multiple selection use CTRL key.");
63         }
64         return _lblSelectTheMethodsToOverrideOrImplementForMultipleSelectionUseCTRLKey;
65     }
66
67     /** Tries to find "Show Superclasses and Interfaces" JCheckBox in this dialog.
68      * @return JCheckBoxOperator
69      */

70     public JCheckBoxOperator cbShowSuperclassesAndInterfaces() {
71         if (_cbShowSuperclassesAndInterfaces==null) {
72             _cbShowSuperclassesAndInterfaces = new JCheckBoxOperator(this, "Show Superclasses and Interfaces");
73         }
74         return _cbShowSuperclassesAndInterfaces;
75     }
76
77     /** Tries to find "Show Abstract Methods Only" JCheckBox in this dialog.
78      * @return JCheckBoxOperator
79      */

80     public JCheckBoxOperator cbShowAbstractMethodsOnly() {
81         if (_cbShowAbstractMethodsOnly==null) {
82             _cbShowAbstractMethodsOnly = new JCheckBoxOperator(this, "Show Abstract Methods Only");
83         }
84         return _cbShowAbstractMethodsOnly;
85     }
86
87     /** Tries to find "Available Superclass and Interface Methods:" JLabel in this dialog.
88      * @return JLabelOperator
89      */

90     public JLabelOperator lblAvailableSuperclassAndInterfaceMethods() {
91         if (_lblAvailableSuperclassAndInterfaceMethods==null) {
92             _lblAvailableSuperclassAndInterfaceMethods = new JLabelOperator(this, "Available Superclass and Interface Methods:");
93         }
94         return _lblAvailableSuperclassAndInterfaceMethods;
95     }
96
97     /** Tries to find null TreeView$ExplorerTree in this dialog.
98      * @return JTreeOperator
99      */

100     public JTreeOperator treeAvailableSuperclassAndInterfaceMethods() {
101         if (_treeAvailableSuperclassAndInterfaceMethods==null) {
102             _treeAvailableSuperclassAndInterfaceMethods = new JTreeOperator(this);
103         }
104         return _treeAvailableSuperclassAndInterfaceMethods;
105     }
106
107     /** Tries to find "Generate Super Calls" JCheckBox in this dialog.
108      * @return JCheckBoxOperator
109      */

110     public JCheckBoxOperator cbGenerateSuperCalls() {
111         if (_cbGenerateSuperCalls==null) {
112             _cbGenerateSuperCalls = new JCheckBoxOperator(this, "Generate Super Calls");
113         }
114         return _cbGenerateSuperCalls;
115     }
116
117     /** Tries to find "Copy Javadoc" JCheckBox in this dialog.
118      * @return JCheckBoxOperator
119      */

120     public JCheckBoxOperator cbCopyJavadoc() {
121         if (_cbCopyJavadoc==null) {
122             _cbCopyJavadoc = new JCheckBoxOperator(this, "Copy Javadoc");
123         }
124         return _cbCopyJavadoc;
125     }
126
127     /** Tries to find "OK" JButton in this dialog.
128      * @return JButtonOperator
129      */

130     public JButtonOperator btOK() {
131         if (_btOK==null) {
132             _btOK = new JButtonOperator(this, "OK");
133         }
134         return _btOK;
135     }
136
137     /** Tries to find "Cancel" JButton in this dialog.
138      * @return JButtonOperator
139      */

140     public JButtonOperator btCancel() {
141         if (_btCancel==null) {
142             _btCancel = new JButtonOperator(this, "Cancel");
143         }
144         return _btCancel;
145     }
146
147
148     //****************************************
149
// Low-level functionality definition part
150
//****************************************
151

152     /** checks or unchecks given JCheckBox
153      * @param state boolean requested state
154      */

155     public void checkShowSuperclassesAndInterfaces(boolean state) {
156         if (cbShowSuperclassesAndInterfaces().isSelected()!=state) {
157             cbShowSuperclassesAndInterfaces().push();
158         }
159     }
160
161     /** checks or unchecks given JCheckBox
162      * @param state boolean requested state
163      */

164     public void checkShowAbstractMethodsOnly(boolean state) {
165         if (cbShowAbstractMethodsOnly().isSelected()!=state) {
166             cbShowAbstractMethodsOnly().push();
167         }
168     }
169
170     /** checks or unchecks given JCheckBox
171      * @param state boolean requested state
172      */

173     public void checkGenerateSuperCalls(boolean state) {
174         if (cbGenerateSuperCalls().isSelected()!=state) {
175             cbGenerateSuperCalls().push();
176         }
177     }
178
179     /** checks or unchecks given JCheckBox
180      * @param state boolean requested state
181      */

182     public void checkCopyJavadoc(boolean state) {
183         if (cbCopyJavadoc().isSelected()!=state) {
184             cbCopyJavadoc().push();
185         }
186     }
187
188     /** clicks on "OK" JButton
189      */

190     public void ok() {
191         btOK().push();
192     }
193
194     /** clicks on "Cancel" JButton
195      */

196     public void cancel() {
197         btCancel().push();
198     }
199
200
201     //*****************************************
202
// High-level functionality definition part
203
//*****************************************
204

205     /** Performs verification of OverrideAndImplementMethods by accessing all its components.
206      */

207     public void verify() {
208         lblSelectTheMethodsToOverrideOrImplementForMultipleSelectionUseCTRLKey();
209         cbShowSuperclassesAndInterfaces();
210         cbShowAbstractMethodsOnly();
211         lblAvailableSuperclassAndInterfaceMethods();
212         treeAvailableSuperclassAndInterfaceMethods();
213         cbGenerateSuperCalls();
214         cbCopyJavadoc();
215         btOK();
216         btCancel();
217     }
218
219     /** Performs simple test of OverrideMethodsOperator
220     * @param args the command line arguments
221     */

222     public static void main(String JavaDoc args[]) {
223         new OverrideMethodsOperator().verify();
224         System.out.println("OverrideMethodsOperator verification finished.");
225     }
226 }
227
Popular Tags