1 19 20 package org.netbeans.test.db.derby.lib; 21 22 import org.netbeans.jemmy.operators.*; 23 import org.netbeans.jemmy.util.NameComponentChooser; 24 25 30 public class CreateDerbyDatabaseOperator extends JDialogOperator { 31 32 34 public CreateDerbyDatabaseOperator() { 35 super("Create Java DB Database"); 36 } 37 38 private JTextAreaOperator _txtJTextArea; 39 private JLabelOperator _lblDatabaseName; 40 private JLabelOperator _lblUserName; 41 private JLabelOperator _lblPassword; 42 private JLabelOperator _lblDatabaseLocation; 43 private JTextFieldOperator _txtPassword; 44 private JTextFieldOperator _txtUserName; 45 private JTextFieldOperator _txtDatabaseName; 46 private JTextFieldOperator _txtDatabaseLocation; 47 private JLabelOperator _lblTheDatabaseNameIsEmpty; 48 private JButtonOperator _btOK; 49 private JButtonOperator _btCancel; 50 51 52 56 59 public JTextAreaOperator txtJTextArea() { 60 if (_txtJTextArea==null) { 61 _txtJTextArea = new JTextAreaOperator(this); 62 } 63 return _txtJTextArea; 64 } 65 66 69 public JLabelOperator lblDatabaseName() { 70 if (_lblDatabaseName==null) { 71 _lblDatabaseName = new JLabelOperator(this, "Database Name:"); 72 } 73 return _lblDatabaseName; 74 } 75 76 79 public JLabelOperator lblUserName() { 80 if (_lblUserName==null) { 81 _lblUserName = new JLabelOperator(this, "User Name:"); 82 } 83 return _lblUserName; 84 } 85 86 89 public JLabelOperator lblPassword() { 90 if (_lblPassword==null) { 91 _lblPassword = new JLabelOperator(this, "Password:"); 92 } 93 return _lblPassword; 94 } 95 96 99 public JLabelOperator lblDatabaseLocation() { 100 if (_lblDatabaseLocation==null) { 101 _lblDatabaseLocation = new JLabelOperator(this, "Database Location:"); 102 } 103 return _lblDatabaseLocation; 104 } 105 106 109 public JTextFieldOperator txtPassword() { 110 if (_txtPassword==null) { 111 _txtPassword = new JTextFieldOperator(this); 112 } 113 return _txtPassword; 114 } 115 116 119 public JTextFieldOperator txtUserName() { 120 if (_txtUserName==null) { 121 _txtUserName = new JTextFieldOperator(this, 1); 122 } 123 return _txtUserName; 124 } 125 126 129 public JTextFieldOperator txtDatabaseName() { 130 if (_txtDatabaseName==null) { 131 _txtDatabaseName = new JTextFieldOperator(this, 2); 132 } 133 return _txtDatabaseName; 134 } 135 136 139 public JTextFieldOperator txtDatabaseLocation() { 140 if (_txtDatabaseLocation==null) { 141 _txtDatabaseLocation = new JTextFieldOperator(this, 3); 142 } 143 return _txtDatabaseLocation; 144 } 145 146 149 public JLabelOperator lblTheDatabaseNameIsEmpty() { 150 if (_lblTheDatabaseNameIsEmpty==null) { 151 _lblTheDatabaseNameIsEmpty = new JLabelOperator(this, "The database name is empty."); 152 } 153 return _lblTheDatabaseNameIsEmpty; 154 } 155 156 159 public JButtonOperator btOK() { 160 if (_btOK==null) { 161 _btOK = new JButtonOperator(this, "OK"); 162 } 163 return _btOK; 164 } 165 166 169 public JButtonOperator btCancel() { 170 if (_btCancel==null) { 171 _btCancel = new JButtonOperator(this, "Cancel"); 172 } 173 return _btCancel; 174 } 175 176 177 181 184 public String getJTextArea() { 185 return txtJTextArea().getText(); 186 } 187 188 191 public void setJTextArea(String text) { 192 txtJTextArea().setText(text); 193 } 194 195 198 public void typeJTextArea(String text) { 199 txtJTextArea().typeText(text); 200 } 201 202 205 public String getPassword() { 206 return txtPassword().getText(); 207 } 208 209 212 public void setPassword(String text) { 213 txtPassword().setText(text); 214 } 215 216 219 public void typePassword(String text) { 220 txtPassword().typeText(text); 221 } 222 223 226 public String getUserName() { 227 return txtUserName().getText(); 228 } 229 230 233 public void setUserName(String text) { 234 txtUserName().setText(text); 235 } 236 237 240 public void typeUserName(String text) { 241 txtUserName().typeText(text); 242 } 243 244 247 public String getDatabaseName() { 248 return txtDatabaseName().getText(); 249 } 250 251 254 public void setDatabaseName(String text) { 255 txtDatabaseName().setText(text); 256 } 257 258 261 public void typeDatabaseName(String text) { 262 txtDatabaseName().typeText(text); 263 } 264 265 268 public String getDatabaseLocation() { 269 return txtDatabaseLocation().getText(); 270 } 271 272 275 public void setDatabaseLocation(String text) { 276 txtDatabaseLocation().setText(text); 277 } 278 279 282 public void typeDatabaseLocation(String text) { 283 txtDatabaseLocation().typeText(text); 284 } 285 286 288 public void ok() { 289 btOK().push(); 290 } 291 292 294 public void cancel() { 295 btCancel().push(); 296 } 297 298 299 303 305 public void verify() { 306 txtJTextArea(); 307 lblDatabaseName(); 308 lblUserName(); 309 lblPassword(); 310 lblDatabaseLocation(); 311 txtPassword(); 312 txtUserName(); 313 txtDatabaseName(); 314 txtDatabaseLocation(); 315 lblTheDatabaseNameIsEmpty(); 316 btOK(); 317 btCancel(); 318 } 319 320 323 public static void main(String args[]) { 324 new CreateDerbyDatabaseOperator().verify(); 325 System.out.println("Create Java DB Database verification finished."); 326 } 327 } 328 329 | Popular Tags |