KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > jellytools > modules > xml > saxwizard > SAXDocumentHandlerWizardPage1


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  * SAXDocumentHandlerWizard.java
21  *
22  * Created on 8/5/02 4:14 PM
23  */

24 package org.netbeans.jellytools.modules.xml.saxwizard;
25
26 import org.netbeans.jellytools.WizardOperator;
27 import org.netbeans.jemmy.operators.*;
28
29 /** Class implementing all necessary methods for handling "SAX Document Handler Wizard" NbDialog.
30  *
31  * @author ms113234
32  * @version 1.0
33  */

34 public class SAXDocumentHandlerWizardPage1 extends WizardOperator {
35
36     /** Creates new SAXDocumentHandlerWizard that can handle it.
37      */

38     public SAXDocumentHandlerWizardPage1() {
39         super("SAX Document Handler Wizard");
40     }
41
42     private JLabelOperator _lblSteps;
43     private JLabelOperator _lbl1Of4APIVersions;
44     private JTextAreaOperator _txtJTextArea;
45     private JLabelOperator _lblJAXPVersion;
46     private JComboBoxOperator _cboJAXPVersion;
47     public static final String JavaDoc ITEM_JAXP10 = "JAXP 1.0";
48     public static final String JavaDoc ITEM_JAXP11 = "JAXP 1.1";
49     private JLabelOperator _lblSAXParserVersion;
50     private JComboBoxOperator _cboSAXParserVersion;
51     public static final String JavaDoc ITEM_SAX10 = "SAX 1.0";
52     public static final String JavaDoc ITEM_SAX20 = "SAX 2.0";
53     private JCheckBoxOperator _cbPropagateSAXEventsToGeneratedHandler;
54     private JButtonOperator _btCancel;
55     private JButtonOperator _btHelp;
56
57
58     //******************************
59
// Subcomponents definition part
60
//******************************
61

62     /** Tries to find "Steps" JLabel in this dialog.
63      * @return JLabelOperator
64      */

65     public JLabelOperator lblSteps() {
66         if (_lblSteps==null) {
67             _lblSteps = new JLabelOperator(this, "Steps");
68         }
69         return _lblSteps;
70     }
71
72     /** Tries to find "1 of 4 - API Versions" JLabel in this dialog.
73      * @return JLabelOperator
74      */

75     public JLabelOperator lbl1Of4APIVersions() {
76         if (_lbl1Of4APIVersions==null) {
77             _lbl1Of4APIVersions = new JLabelOperator(this, "1 of 4 - API Versions");
78         }
79         return _lbl1Of4APIVersions;
80     }
81
82     /** Tries to find null JTextArea in this dialog.
83      * @return JTextAreaOperator
84      */

85     public JTextAreaOperator txtJTextArea() {
86         if (_txtJTextArea==null) {
87             _txtJTextArea = new JTextAreaOperator(this);
88         }
89         return _txtJTextArea;
90     }
91
92     /** Tries to find "JAXP Version:" JLabel in this dialog.
93      * @return JLabelOperator
94      */

95     public JLabelOperator lblJAXPVersion() {
96         if (_lblJAXPVersion==null) {
97             _lblJAXPVersion = new JLabelOperator(this, "JAXP Version:");
98         }
99         return _lblJAXPVersion;
100     }
101
102     /** Tries to find null JComboBox in this dialog.
103      * @return JComboBoxOperator
104      */

105     public JComboBoxOperator cboJAXPVersion() {
106         if (_cboJAXPVersion==null) {
107             _cboJAXPVersion = new JComboBoxOperator(this);
108         }
109         return _cboJAXPVersion;
110     }
111
112     /** Tries to find "SAX Parser Version:" JLabel in this dialog.
113      * @return JLabelOperator
114      */

115     public JLabelOperator lblSAXParserVersion() {
116         if (_lblSAXParserVersion==null) {
117             _lblSAXParserVersion = new JLabelOperator(this, "SAX Parser Version:");
118         }
119         return _lblSAXParserVersion;
120     }
121
122     /** Tries to find null JComboBox in this dialog.
123      * @return JComboBoxOperator
124      */

125     public JComboBoxOperator cboSAXParserVersion() {
126         if (_cboSAXParserVersion==null) {
127             _cboSAXParserVersion = new JComboBoxOperator(this, 1);
128         }
129         return _cboSAXParserVersion;
130     }
131
132     /** Tries to find " Propagate SAX Events to Generated Handler" JCheckBox in this dialog.
133      * @return JCheckBoxOperator
134      */

135     public JCheckBoxOperator cbPropagateSAXEventsToGeneratedHandler() {
136         if (_cbPropagateSAXEventsToGeneratedHandler==null) {
137             _cbPropagateSAXEventsToGeneratedHandler = new JCheckBoxOperator(this, " Propagate SAX Events to Generated Handler");
138         }
139         return _cbPropagateSAXEventsToGeneratedHandler;
140     }
141
142     /** Tries to find "Cancel" JButton in this dialog.
143      * @return JButtonOperator
144      */

145     public JButtonOperator btCancel() {
146         if (_btCancel==null) {
147             _btCancel = new JButtonOperator(this, "Cancel");
148         }
149         return _btCancel;
150     }
151
152     /** Tries to find "Help" JButton in this dialog.
153      * @return JButtonOperator
154      */

155     public JButtonOperator btHelp() {
156         if (_btHelp==null) {
157             _btHelp = new JButtonOperator(this, "Help");
158         }
159         return _btHelp;
160     }
161
162
163     //****************************************
164
// Low-level functionality definition part
165
//****************************************
166

167     /** gets text for txtJTextArea
168      * @return String text
169      */

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

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

184     public void typeJTextArea(String JavaDoc text) {
185         txtJTextArea().typeText(text);
186     }
187
188     /** returns selected item for cboJAXPVersion
189      * @return String item
190      */

191     public String JavaDoc getSelectedJAXPVersion() {
192         return cboJAXPVersion().getSelectedItem().toString();
193     }
194
195     /** selects item for cboJAXPVersion
196      * @param item String item
197      */

198     public void selectJAXPVersion(String JavaDoc item) {
199         cboJAXPVersion().selectItem(item);
200     }
201
202     /** types text for cboJAXPVersion
203      * @param text String text
204      */

205     public void typeJAXPVersion(String JavaDoc text) {
206         cboJAXPVersion().typeText(text);
207     }
208
209     /** returns selected item for cboSAXParserVersion
210      * @return String item
211      */

212     public String JavaDoc getSelectedSAXParserVersion() {
213         return cboSAXParserVersion().getSelectedItem().toString();
214     }
215
216     /** selects item for cboSAXParserVersion
217      * @param item String item
218      */

219     public void selectSAXParserVersion(String JavaDoc item) {
220         cboSAXParserVersion().selectItem(item);
221     }
222
223     /** types text for cboSAXParserVersion
224      * @param text String text
225      */

226     public void typeSAXParserVersion(String JavaDoc text) {
227         cboSAXParserVersion().typeText(text);
228     }
229
230     /** checks or unchecks given JCheckBox
231      * @param state boolean requested state
232      */

233     public void checkPropagateSAXEventsToGeneratedHandler(boolean state) {
234         if (cbPropagateSAXEventsToGeneratedHandler().isSelected()!=state) {
235             cbPropagateSAXEventsToGeneratedHandler().push();
236         }
237     }
238
239     /** clicks on "Cancel" JButton
240      */

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

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

256     /** Performs verification of SAXDocumentHandlerWizard by accessing all its components.
257      */

258     public void verify() {
259         lblSteps();
260         lbl1Of4APIVersions();
261         txtJTextArea();
262         lblJAXPVersion();
263         cboJAXPVersion();
264         lblSAXParserVersion();
265         cboSAXParserVersion();
266         cbPropagateSAXEventsToGeneratedHandler();
267         btCancel();
268         btHelp();
269     }
270
271     /** Performs simple test of SAXDocumentHandlerWizard
272     * @param args the command line arguments
273     */

274     public static void main(String JavaDoc args[]) {
275         new SAXDocumentHandlerWizardPage1().verify();
276         System.out.println("SAXDocumentHandlerWizardPage1 verification finished.");
277     }
278 }
279
280
Popular Tags