1 19 24 package org.netbeans.jellytools.modules.xml.saxwizard; 25 26 import java.awt.Component ; 27 import javax.swing.JComboBox ; 28 import javax.swing.JTextField ; 29 import javax.swing.table.TableCellEditor ; 30 import org.netbeans.jellytools.WizardOperator; 31 import org.netbeans.jemmy.operators.*; 32 import org.netbeans.jemmy.util.Dumper; 33 34 39 public class SAXDocumentHandlerWizardPage2 extends WizardOperator { 40 static final int ELEMENT_COLUMN = 0; 41 static final int TYPE_COLUMN = 1; 42 static final int METHOD_COLUMN = 2; 43 44 public static final String IGNORE = "Ignore"; 45 public static final String DATA = "Data"; 46 public static final String CONTAINER = "Container"; 47 public static final String MIXED = "Mixed"; 48 public static final String MIXED_CONTAINER = "Mixed Container"; 49 50 52 public SAXDocumentHandlerWizardPage2() { 53 super("SAX Document Handler Wizard"); 54 } 55 56 private JLabelOperator _lblSteps; 57 private JLabelOperator _lbl2Of4ElementMappings; 58 private JTextAreaOperator _txtJTextArea; 59 private JTableOperator _tabElementMappings; 60 private JButtonOperator _btCancel; 61 private JButtonOperator _btHelp; 62 63 64 68 71 public JLabelOperator lblSteps() { 72 if (_lblSteps==null) { 73 _lblSteps = new JLabelOperator(this, "Steps"); 74 } 75 return _lblSteps; 76 } 77 78 81 public JLabelOperator lbl2Of4ElementMappings() { 82 if (_lbl2Of4ElementMappings==null) { 83 _lbl2Of4ElementMappings = new JLabelOperator(this, "2 of 4 - Element Mappings"); 84 } 85 return _lbl2Of4ElementMappings; 86 } 87 88 91 public JTextAreaOperator txtJTextArea() { 92 if (_txtJTextArea==null) { 93 _txtJTextArea = new JTextAreaOperator(this); 94 } 95 return _txtJTextArea; 96 } 97 98 101 public JTableOperator tabElementMappings() { 102 if (_tabElementMappings==null) { 103 _tabElementMappings = new JTableOperator(this); 104 } 105 return _tabElementMappings; 106 } 107 108 111 public JButtonOperator btCancel() { 112 if (_btCancel==null) { 113 _btCancel = new JButtonOperator(this, "Cancel"); 114 } 115 return _btCancel; 116 } 117 118 121 public JButtonOperator btHelp() { 122 if (_btHelp==null) { 123 _btHelp = new JButtonOperator(this, "Help"); 124 } 125 return _btHelp; 126 } 127 128 130 133 public JTextFieldOperator txtElement(int row) { 134 tabElementMappings().clickForEdit(row, ELEMENT_COLUMN); 136 return new JTextFieldOperator(tabElementMappings()); 137 } 138 139 143 public JComboBoxOperator cboHandlerType(int row) { 144 tabElementMappings().clickForEdit(row, TYPE_COLUMN); 145 return new JComboBoxOperator(tabElementMappings()); 146 } 147 148 151 public JTextFieldOperator txtHandlerMethod(int row) { 152 tabElementMappings().clickForEdit(row, METHOD_COLUMN); 153 return new JTextFieldOperator(tabElementMappings()); 154 } 155 156 160 163 public String getJTextArea() { 164 return txtJTextArea().getText(); 165 } 166 167 170 public void setJTextArea(String text) { 171 txtJTextArea().setText(text); 172 } 173 174 177 public void typeJTextArea(String text) { 178 txtJTextArea().typeText(text); 179 } 180 181 183 public void cancel() { 184 btCancel().push(); 185 } 186 187 189 public void help() { 190 btHelp().push(); 191 } 192 193 195 198 public String getSelectedHandlerType(int row) { 199 return cboHandlerType(row).getSelectedItem().toString(); 200 } 201 202 205 public void selectHandlerType(int row, String item) { 206 cboHandlerType(row).selectItem(item); 207 } 208 209 212 public String getHandlerMethod(int row) { 213 return txtHandlerMethod(row).getText(); 214 } 215 216 219 public void setHandlerMethod(int row, String text) { 220 txtHandlerMethod(row).enterText(text); 221 } 222 223 226 public String getElement(int row) { 227 return txtElement(row).getText(); 228 } 229 230 234 237 public int findTabRow(String element) { 238 int rows = tabElementMappings().getRowCount(); 239 for (int i = 0; i < rows; i++) { 240 String cellVal = tabElementMappings().getCellEditor(i, ELEMENT_COLUMN).getCellEditorValue().toString(); 241 if (element.equals(cellVal)) return i; 242 } 243 return -1; 244 } 245 246 248 public void verify() { 249 lblSteps(); 250 lbl2Of4ElementMappings(); 251 txtJTextArea(); 252 tabElementMappings(); 253 btCancel(); 254 btHelp(); 255 } 256 257 260 public static void main(String args[]) { 261 new SAXDocumentHandlerWizardPage2().verify(); 262 System.out.println("SAXDocumentHandlerWizardPage2 verification finished."); 263 } 264 } 265 266 | Popular Tags |