KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > jellytools > modules > xml > catalog > operators > 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.operators;
25
26 import org.netbeans.jellytools.NbDialogOperator;
27 import org.netbeans.jemmy.operators.JButtonOperator;
28 import org.netbeans.jemmy.operators.JCheckBoxOperator;
29 import org.netbeans.jemmy.operators.JComboBoxOperator;
30 import org.netbeans.jemmy.operators.JLabelOperator;
31 import org.netbeans.jemmy.operators.JTextAreaOperator;
32 import org.netbeans.jemmy.operators.JTextFieldOperator;
33
34
35 /** Class implementing all necessary methods for handling "Mount Catalog" NbDialog.
36  *
37  * @author ms113234
38  * @version 1.0
39  */

40 public class MountCatalogDialogOperator extends NbDialogOperator {
41     
42     /** Creates new MountOASISCatalogDialogOperator that can handle it.
43      */

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

64     /** Tries to find "Catalog Type:" JLabel in this dialog.
65      * @return JLabelOperator
66      */

67     public JLabelOperator lblCatalogType() {
68         if (_lblCatalogType==null) {
69             _lblCatalogType = new JLabelOperator(this, "Catalog Type:");
70         }
71         return _lblCatalogType;
72     }
73     
74     /** Tries to find null JComboBox in this dialog.
75      * @return JComboBoxOperator
76      */

77     public JComboBoxOperator cboCatalogType() {
78         if (_cboCatalogType==null) {
79             _cboCatalogType = new JComboBoxOperator(this);
80         }
81         return _cboCatalogType;
82     }
83     
84     /** Tries to find "Catalog URL:" JLabel in this dialog.
85      * @return JLabelOperator
86      */

87     public JLabelOperator lblCatalogURL() {
88         if (_lblCatalogURL==null) {
89             _lblCatalogURL = new JLabelOperator(this, "Catalog URL:");
90         }
91         return _lblCatalogURL;
92     }
93     
94     /** Tries to find null JTextField in this dialog.
95      * @return JTextFieldOperator
96      */

97     public JTextFieldOperator txtCatalogURL() {
98         if (_txtCatalogURL==null) {
99             _txtCatalogURL = new JTextFieldOperator(this);
100         }
101         return _txtCatalogURL;
102     }
103     
104     /** Tries to find "Browse..." JButton in this dialog.
105      * @return JButtonOperator
106      */

107     public JButtonOperator btBrowse() {
108         if (_btBrowse==null) {
109             _btBrowse = new JButtonOperator(this, "Browse...");
110         }
111         return _btBrowse;
112     }
113     
114     /** Tries to find "Prefer Public ID" JCheckBox in this dialog.
115      * @return JCheckBoxOperator
116      */

117     public JCheckBoxOperator cbPreferPublicID() {
118         if (_cbPreferPublicID==null) {
119             _cbPreferPublicID = new JCheckBoxOperator(this, "Prefer Public ID");
120         }
121         return _cbPreferPublicID;
122     }
123     
124     /** Tries to find null JTextArea in this dialog.
125      * @return JTextAreaOperator
126      */

127     public JTextAreaOperator txtJTextArea() {
128         if (_txtJTextArea==null) {
129             _txtJTextArea = new JTextAreaOperator(this);
130         }
131         return _txtJTextArea;
132     }
133     
134     
135     //****************************************
136
// Low-level functionality definition part
137
//****************************************
138

139     /** returns selected item for cboCatalogType
140      * @return String item
141      */

142     public String JavaDoc getSelectedCatalogType() {
143         return cboCatalogType().getSelectedItem().toString();
144     }
145     
146     /** selects item for cboCatalogType
147      * @param item String item
148      */

149     public void selectCatalogType(String JavaDoc item) {
150         cboCatalogType().selectItem(item);
151         
152     }
153     
154     /** gets text for txtCatalogURL
155      * @return String text
156      */

157     public String JavaDoc getCatalogURL() {
158         return txtCatalogURL().getText();
159     }
160     
161     /** sets text for txtCatalogURL
162      * @param text String text
163      */

164     public void setCatalogURL(String JavaDoc text) {
165         txtCatalogURL().setText(text);
166     }
167     
168     /** types text for txtCatalogURL
169      * @param text String text
170      */

171     public void typeCatalogURL(String JavaDoc text) {
172         txtCatalogURL().typeText(text);
173     }
174     
175     /** clicks on "Browse..." JButton
176      */

177     public void browse() {
178         btBrowse().push();
179     }
180     
181     /** checks or unchecks given JCheckBox
182      * @param state boolean requested state
183      */

184     public void checkPreferPublicID(boolean state) {
185         if (cbPreferPublicID().isSelected()!=state) {
186             cbPreferPublicID().push();
187         }
188     }
189     
190     /** gets text for txtJTextArea
191      * @return String text
192      */

193     public String JavaDoc getJTextArea() {
194         return txtJTextArea().getText();
195     }
196     
197     /** sets text for txtJTextArea
198      * @param text String text
199      */

200     public void setJTextArea(String JavaDoc text) {
201         txtJTextArea().setText(text);
202     }
203     
204     /** types text for txtJTextArea
205      * @param text String text
206      */

207 /** public void typeJTextArea(String text) {
208         txtJTextArea().typeText(text);
209     }
210     
211    */

212     //*****************************************
213
// High-level functionality definition part
214
//*****************************************
215

216     
217     /** Performs simple test of MountOASISCatalogDialogOperator
218      * @param args the command line arguments
219      */

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

233     public void verifyOASIS() {
234         lblCatalogType();
235         cboCatalogType();
236         lblCatalogURL();
237         txtCatalogURL();
238         btBrowse();
239         cbPreferPublicID();
240         txtJTextArea();
241     }
242     
243     /**
244      * Performs verification of MountNbCatalogDialogOperator by accessing all its components.
245      */

246     public void verifyNb() {
247         lblCatalogType();
248         cboCatalogType();
249         txtJTextArea();
250     }
251     
252     /**
253      * Performs verification of MountXMLCatalogDialogOperator by accessing all its components.
254      */

255     public void verifyXML() {
256         lblCatalogType();
257         cboCatalogType();
258         lblCatalogURL();
259         txtCatalogURL();
260         txtJTextArea();
261     }
262     
263 }
264
265
Popular Tags