1 19 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 40 public class MountCatalogDialogOperator extends NbDialogOperator { 41 42 44 public MountCatalogDialogOperator() { 45 super("Add Catalog"); 46 } 47 48 private JLabelOperator _lblCatalogType; 49 private JComboBoxOperator _cboCatalogType; 50 public static final String ITEM_OASISCATALOGRESOLVER = "OASIS Catalog Resolver"; 52 public static final String 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 64 67 public JLabelOperator lblCatalogType() { 68 if (_lblCatalogType==null) { 69 _lblCatalogType = new JLabelOperator(this, "Catalog Type:"); 70 } 71 return _lblCatalogType; 72 } 73 74 77 public JComboBoxOperator cboCatalogType() { 78 if (_cboCatalogType==null) { 79 _cboCatalogType = new JComboBoxOperator(this); 80 } 81 return _cboCatalogType; 82 } 83 84 87 public JLabelOperator lblCatalogURL() { 88 if (_lblCatalogURL==null) { 89 _lblCatalogURL = new JLabelOperator(this, "Catalog URL:"); 90 } 91 return _lblCatalogURL; 92 } 93 94 97 public JTextFieldOperator txtCatalogURL() { 98 if (_txtCatalogURL==null) { 99 _txtCatalogURL = new JTextFieldOperator(this); 100 } 101 return _txtCatalogURL; 102 } 103 104 107 public JButtonOperator btBrowse() { 108 if (_btBrowse==null) { 109 _btBrowse = new JButtonOperator(this, "Browse..."); 110 } 111 return _btBrowse; 112 } 113 114 117 public JCheckBoxOperator cbPreferPublicID() { 118 if (_cbPreferPublicID==null) { 119 _cbPreferPublicID = new JCheckBoxOperator(this, "Prefer Public ID"); 120 } 121 return _cbPreferPublicID; 122 } 123 124 127 public JTextAreaOperator txtJTextArea() { 128 if (_txtJTextArea==null) { 129 _txtJTextArea = new JTextAreaOperator(this); 130 } 131 return _txtJTextArea; 132 } 133 134 135 139 142 public String getSelectedCatalogType() { 143 return cboCatalogType().getSelectedItem().toString(); 144 } 145 146 149 public void selectCatalogType(String item) { 150 cboCatalogType().selectItem(item); 151 152 } 153 154 157 public String getCatalogURL() { 158 return txtCatalogURL().getText(); 159 } 160 161 164 public void setCatalogURL(String text) { 165 txtCatalogURL().setText(text); 166 } 167 168 171 public void typeCatalogURL(String text) { 172 txtCatalogURL().typeText(text); 173 } 174 175 177 public void browse() { 178 btBrowse().push(); 179 } 180 181 184 public void checkPreferPublicID(boolean state) { 185 if (cbPreferPublicID().isSelected()!=state) { 186 cbPreferPublicID().push(); 187 } 188 } 189 190 193 public String getJTextArea() { 194 return txtJTextArea().getText(); 195 } 196 197 200 public void setJTextArea(String text) { 201 txtJTextArea().setText(text); 202 } 203 204 207 212 216 217 220 public static void main(String args[]) { 221 MountCatalogDialogOperator mcdo = new MountCatalogDialogOperator(); 222 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 233 public void verifyOASIS() { 234 lblCatalogType(); 235 cboCatalogType(); 236 lblCatalogURL(); 237 txtCatalogURL(); 238 btBrowse(); 239 cbPreferPublicID(); 240 txtJTextArea(); 241 } 242 243 246 public void verifyNb() { 247 lblCatalogType(); 248 cboCatalogType(); 249 txtJTextArea(); 250 } 251 252 255 public void verifyXML() { 256 lblCatalogType(); 257 cboCatalogType(); 258 lblCatalogURL(); 259 txtCatalogURL(); 260 txtJTextArea(); 261 } 262 263 } 264 265 | Popular Tags |