1 19 package org.netbeans.test.jsf; 20 21 import javax.swing.JTextField ; 22 import org.netbeans.jellytools.NbDialogOperator; 23 import org.netbeans.jemmy.operators.JButtonOperator; 24 import org.netbeans.jemmy.operators.JComboBoxOperator; 25 import org.netbeans.jemmy.operators.JLabelOperator; 26 import org.netbeans.jemmy.operators.JTextAreaOperator; 27 import org.netbeans.jemmy.operators.JTextFieldOperator; 28 29 32 public class AddManagedBeanOperator extends NbDialogOperator { 33 34 36 public AddManagedBeanOperator() { 37 super("Add Managed Bean"); 38 } 39 40 private JLabelOperator _lblBeanClass; 41 private JTextFieldOperator _txtBeanClass; 42 private JButtonOperator _btBrowse; 43 private JLabelOperator _lblScope; 44 private JComboBoxOperator _cboScope; 45 private JLabelOperator _lblBeanDescription; 46 private JTextAreaOperator _txtBeanDescription; 47 private JLabelOperator _lblBeanName; 48 private JTextFieldOperator _txtBeanName; 49 private JButtonOperator _btAdd; 50 51 52 56 59 public JLabelOperator lblBeanClass() { 60 if (_lblBeanClass==null) { 61 _lblBeanClass = new JLabelOperator(this, "Bean Class:"); 62 } 63 return _lblBeanClass; 64 } 65 66 69 public JTextFieldOperator txtBeanClass() { 70 if (_txtBeanClass==null) { 71 _txtBeanClass = new JTextFieldOperator((JTextField )lblBeanClass().getLabelFor()); 72 } 73 return _txtBeanClass; 74 } 75 76 79 public JButtonOperator btBrowse() { 80 if (_btBrowse==null) { 81 _btBrowse = new JButtonOperator(this, "Browse..."); 82 } 83 return _btBrowse; 84 } 85 86 89 public JLabelOperator lblScope() { 90 if (_lblScope==null) { 91 _lblScope = new JLabelOperator(this, "Scope:"); 92 } 93 return _lblScope; 94 } 95 96 99 public JComboBoxOperator cboScope() { 100 if (_cboScope==null) { 101 _cboScope = new JComboBoxOperator(this); 102 } 103 return _cboScope; 104 } 105 106 109 public JLabelOperator lblBeanDescription() { 110 if (_lblBeanDescription==null) { 111 _lblBeanDescription = new JLabelOperator(this, "Bean Description:"); 112 } 113 return _lblBeanDescription; 114 } 115 116 119 public JTextAreaOperator txtBeanDescription() { 120 if (_txtBeanDescription==null) { 121 _txtBeanDescription = new JTextAreaOperator(this); 122 } 123 return _txtBeanDescription; 124 } 125 126 129 public JLabelOperator lblBeanName() { 130 if (_lblBeanName==null) { 131 _lblBeanName = new JLabelOperator(this, "Bean Name:"); 132 } 133 return _lblBeanName; 134 } 135 136 139 public JTextFieldOperator txtBeanName() { 140 if (_txtBeanName==null) { 141 _txtBeanName = new JTextFieldOperator((JTextField )lblBeanName().getLabelFor()); 142 } 143 return _txtBeanName; 144 } 145 146 149 public JButtonOperator btAdd() { 150 if (_btAdd==null) { 151 _btAdd = new JButtonOperator(this, "Add"); 152 } 153 return _btAdd; 154 } 155 156 157 161 164 public String getBeanClass() { 165 return txtBeanClass().getText(); 166 } 167 168 171 public void setBeanClass(String text) { 172 txtBeanClass().setText(text); 173 } 174 175 178 public void typeBeanClass(String text) { 179 txtBeanClass().typeText(text); 180 } 181 182 184 public void browse() { 185 btBrowse().push(); 186 } 187 188 191 public String getSelectedScope() { 192 return cboScope().getSelectedItem().toString(); 193 } 194 195 198 public void selectScope(String item) { 199 cboScope().selectItem(item); 200 } 201 202 205 public String getBeanDescription() { 206 return txtBeanDescription().getText(); 207 } 208 209 212 public void setBeanDescription(String text) { 213 txtBeanDescription().setText(text); 214 } 215 216 219 public void typeBeanDescription(String text) { 220 txtBeanDescription().typeText(text); 221 } 222 223 226 public String getBeanName() { 227 return txtBeanName().getText(); 228 } 229 230 233 public void setBeanName(String text) { 234 txtBeanName().setText(text); 235 } 236 237 240 public void typeBeanName(String text) { 241 txtBeanName().typeText(text); 242 } 243 244 246 public void add() { 247 btAdd().push(); 248 } 249 250 251 255 257 public void verify() { 258 lblBeanClass(); 259 txtBeanClass(); 260 btBrowse(); 261 lblScope(); 262 cboScope(); 263 lblBeanDescription(); 264 txtBeanDescription(); 265 lblBeanName(); 266 txtBeanName(); 267 btAdd(); 268 } 269 } 270 271 | Popular Tags |