1 19 20 25 package org.netbeans.jellytools.modules.editor; 26 27 import org.netbeans.jemmy.operators.*; 28 29 34 public class EnterAbbreviation extends JDialogOperator { 35 36 38 public EnterAbbreviation() { 39 super(java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("AEP_EnterAbbrev")); 40 } 41 42 private JLabelOperator _lblAbbreviation; 43 private JTextFieldOperator _txtAbbreviation; 44 private JLabelOperator _lblExpansion; 45 private JTextAreaOperator _txtExpansion; 46 private JButtonOperator _btOK; 47 private JButtonOperator _btCancel; 48 private JButtonOperator _btHelp; 49 50 51 55 58 public JLabelOperator lblAbbreviation() { 59 if (_lblAbbreviation==null) { 60 _lblAbbreviation = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("AIP_Abbrev")); 61 } 62 return _lblAbbreviation; 63 } 64 65 68 public JTextFieldOperator txtAbbreviation() { 69 if (_txtAbbreviation==null) { 70 _txtAbbreviation = new JTextFieldOperator(this); 71 } 72 return _txtAbbreviation; 73 } 74 75 78 public JLabelOperator lblExpansion() { 79 if (_lblExpansion==null) { 80 _lblExpansion = new JLabelOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("AIP_Expand")); 81 } 82 return _lblExpansion; 83 } 84 85 88 public JTextAreaOperator txtExpansion() { 89 if (_txtExpansion==null) { 90 _txtExpansion = new JTextAreaOperator(this); 91 } 92 return _txtExpansion; 93 } 94 95 98 public JButtonOperator btOK() { 99 if (_btOK==null) { 100 _btOK = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.netbeans.modules.editor.options.Bundle").getString("KBEP_OK_LABEL")); 101 } 102 return _btOK; 103 } 104 105 108 public JButtonOperator btCancel() { 109 if (_btCancel==null) { 110 _btCancel = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Cancel")); 111 } 112 return _btCancel; 113 } 114 115 118 public JButtonOperator btHelp() { 119 if (_btHelp==null) { 120 _btHelp = new JButtonOperator(this, java.util.ResourceBundle.getBundle("org.openide.explorer.propertysheet.Bundle").getString("CTL_Help")); 121 } 122 return _btHelp; 123 } 124 125 126 130 133 public String getAbbreviation() { 134 return txtAbbreviation().getText(); 135 } 136 137 140 public void setAbbreviation(String text) { 141 txtAbbreviation().setText(text); 142 } 143 144 147 public void typeAbbreviation(String text) { 148 txtAbbreviation().typeText(text); 149 } 150 151 154 public String getExpansion() { 155 return txtExpansion().getText(); 156 } 157 158 161 public void setExpansion(String text) { 162 txtExpansion().setText(text); 163 } 164 165 168 public void typeExpansion(String text) { 169 txtExpansion().typeText(text); 170 } 171 172 174 public void oK() { 175 btOK().push(); 176 177 try { 178 Thread.sleep(2000); 179 } catch (InterruptedException e) { 180 e.printStackTrace(System.err); 181 } 182 } 183 184 186 public void cancel() { 187 btCancel().push(); 188 } 189 190 192 public void help() { 193 btHelp().push(); 194 } 195 196 197 201 203 public void verify() { 204 lblAbbreviation(); 205 txtAbbreviation(); 206 lblExpansion(); 207 txtExpansion(); 208 btOK(); 209 btCancel(); 210 btHelp(); 211 } 212 213 public void fillAbbreviation(String abbreviation, String expansion) { 214 if (!"".equals(txtAbbreviation().getText())) 215 txtAbbreviation().clearText(); 216 typeAbbreviation(abbreviation); 217 218 if (!"".equals(txtExpansion().getText())) 219 txtExpansion().clearText(); 220 typeExpansion(expansion); 221 } 222 223 226 public static void main(String args[]) { 227 new EnterAbbreviation().verify(); 228 System.out.println("EnterAbbreviation verification finished."); 229 } 230 } 231 232 | Popular Tags |