KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > jellytools > modules > xml > catalog > MountCatalogDialogOperator


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  * MountOASISCatalogDialogOperator.java
21  *
22  * Created on 11/13/03 4:20 PM
23  */

24 package org.netbeans.jellytools.modules.xml.catalog;
25
26 import org.netbeans.jemmy.operators.*;
27 import org.netbeans.jellytools.*;
28 import org.netbeans.jellytools.properties.PropertySheetOperator;
29
30 /** Class implementing all necessary methods for handling "Mount Catalog" NbDialog.
31  *
32  * @author ms113234
33  * @version 1.0
34  */

35 public class MountCatalogDialogOperator extends NbDialogOperator {
36
37     /** Creates new MountOASISCatalogDialogOperator that can handle it.
38      */

39     public MountCatalogDialogOperator() {
40         super("Mount Catalog");
41     }
42
43     private JLabelOperator _lblCatalogType;
44     private JComboBoxOperator _cboCatalogType;
45     public static final String JavaDoc ITEM_NETBEANSCATALOG = "NetBeans Catalog";
46     public static final String JavaDoc ITEM_OASISCATALOGRESOLVER = "OASIS Catalog Resolver";
47     public static final String JavaDoc ITEM_XMLCATALOG = "XML Catalog";
48     private JLabelOperator _lblCatalogURL;
49     private JTextFieldOperator _txtCatalogURL;
50     private JButtonOperator _btBrowse;
51     private JCheckBoxOperator _cbPreferPublicID;
52     private JTextAreaOperator _txtJTextArea;
53
54
55     //******************************
56
// Subcomponents definition part
57
//******************************
58

59     /** Tries to find "Catalog Type:" JLabel in this dialog.
60      * @return JLabelOperator
61      */

62     public JLabelOperator lblCatalogType() {
63         if (_lblCatalogType==null) {
64             _lblCatalogType = new JLabelOperator(this, "Catalog Type:");
65         }
66         return _lblCatalogType;
67     }
68
69     /** Tries to find null JComboBox in this dialog.
70      * @return JComboBoxOperator
71      */

72     public JComboBoxOperator cboCatalogType() {
73         if (_cboCatalogType==null) {
74             _cboCatalogType = new JComboBoxOperator(this);
75         }
76         return _cboCatalogType;
77     }
78
79     /** Tries to find "Catalog URL:" JLabel in this dialog.
80      * @return JLabelOperator
81      */

82     public JLabelOperator lblCatalogURL() {
83         if (_lblCatalogURL==null) {
84             _lblCatalogURL = new JLabelOperator(this, "Catalog URL:");
85         }
86         return _lblCatalogURL;
87     }
88
89     /** Tries to find null JTextField in this dialog.
90      * @return JTextFieldOperator
91      */

92     public JTextFieldOperator txtCatalogURL() {
93         if (_txtCatalogURL==null) {
94             _txtCatalogURL = new JTextFieldOperator(this);
95         }
96         return _txtCatalogURL;
97     }
98
99     /** Tries to find "Browse..." JButton in this dialog.
100      * @return JButtonOperator
101      */

102     public JButtonOperator btBrowse() {
103         if (_btBrowse==null) {
104             _btBrowse = new JButtonOperator(this, "Browse...");
105         }
106         return _btBrowse;
107     }
108
109     /** Tries to find "Prefer Public ID" JCheckBox in this dialog.
110      * @return JCheckBoxOperator
111      */

112     public JCheckBoxOperator cbPreferPublicID() {
113         if (_cbPreferPublicID==null) {
114             _cbPreferPublicID = new JCheckBoxOperator(this, "Prefer Public ID");
115         }
116         return _cbPreferPublicID;
117     }
118
119     /** Tries to find null JTextArea in this dialog.
120      * @return JTextAreaOperator
121      */

122     public JTextAreaOperator txtJTextArea() {
123         if (_txtJTextArea==null) {
124             _txtJTextArea = new JTextAreaOperator(this);
125         }
126         return _txtJTextArea;
127     }
128
129
130     //****************************************
131
// Low-level functionality definition part
132
//****************************************
133

134     /** returns selected item for cboCatalogType
135      * @return String item
136      */

137     public String JavaDoc getSelectedCatalogType() {
138         return cboCatalogType().getSelectedItem().toString();
139     }
140
141     /** selects item for cboCatalogType
142      * @param item String item
143      */

144     public void selectCatalogType(String JavaDoc item) {
145         cboCatalogType().selectItem(item);
146     }
147
148     /** gets text for txtCatalogURL
149      * @return String text
150      */

151     public String JavaDoc getCatalogURL() {
152         return txtCatalogURL().getText();
153     }
154
155     /** sets text for txtCatalogURL
156      * @param text String text
157      */

158     public void setCatalogURL(String JavaDoc text) {
159         txtCatalogURL().setText(text);
160     }
161
162     /** types text for txtCatalogURL
163      * @param text String text
164      */

165     public void typeCatalogURL(String JavaDoc text) {
166         txtCatalogURL().typeText(text);
167     }
168
169     /** clicks on "Browse..." JButton
170      */

171     public void browse() {
172         btBrowse().push();
173     }
174
175     /** checks or unchecks given JCheckBox
176      * @param state boolean requested state
177      */

178     public void checkPreferPublicID(boolean state) {
179         if (cbPreferPublicID().isSelected()!=state) {
180             cbPreferPublicID().push();
181         }
182     }
183
184     /** gets text for txtJTextArea
185      * @return String text
186      */

187     public String JavaDoc getJTextArea() {
188         return txtJTextArea().getText();
189     }
190
191     /** sets text for txtJTextArea
192      * @param text String text
193      */

194     public void setJTextArea(String JavaDoc text) {
195         txtJTextArea().setText(text);
196     }
197
198     /** types text for txtJTextArea
199      * @param text String text
200      */

201     public void typeJTextArea(String JavaDoc text) {
202         txtJTextArea().typeText(text);
203     }
204
205
206     //*****************************************
207
// High-level functionality definition part
208
//*****************************************
209

210     /** Performs verification of MountOASISCatalogDialogOperator by accessing all its components.
211      */

212     public void verifyOASIS() {
213         lblCatalogType();
214         cboCatalogType();
215         lblCatalogURL();
216         txtCatalogURL();
217         btBrowse();
218         cbPreferPublicID();
219         txtJTextArea();
220     }
221
222     /** Performs simple test of MountOASISCatalogDialogOperator
223     * @param args the command line arguments
224     */

225     public static void main(String JavaDoc args[]) {
226         MountCatalogDialogOperator mcdo = new MountCatalogDialogOperator();
227         mcdo.selectCatalogType(mcdo.ITEM_NETBEANSCATALOG);
228         mcdo.verifyNb();
229         mcdo.selectCatalogType(mcdo.ITEM_OASISCATALOGRESOLVER);
230         mcdo.verifyOASIS();
231         mcdo.selectCatalogType(mcdo.ITEM_XMLCATALOG);
232         mcdo.verifyXML();
233         System.out.println("MountOASISCatalogDialogOperator verification finished.");
234     }
235     
236     /**
237      * Performs verification of MountNbCatalogDialogOperator by accessing all its components.
238      */

239     public void verifyNb() {
240         lblCatalogType();
241         cboCatalogType();
242         txtJTextArea();
243     }
244     
245     /**
246      * Performs verification of MountXMLCatalogDialogOperator by accessing all its components.
247      */

248     public void verifyXML() {
249         lblCatalogType();
250         cboCatalogType();
251         lblCatalogURL();
252         txtCatalogURL();
253         txtJTextArea();
254     }
255     
256 }
257
258
Popular Tags