1 6 package org.netbeans.test.subversion.operators; 7 8 import org.netbeans.jellytools.NbDialogOperator; 9 import org.netbeans.jellytools.nodes.Node; 10 import org.netbeans.jemmy.operators.*; 11 import org.netbeans.test.subversion.operators.actions.SwitchAction; 12 13 18 public class SwitchOperator extends NbDialogOperator { 19 20 23 public SwitchOperator() { 24 super("Switch"); 25 } 26 27 31 public static SwitchOperator invoke(Node[] nodes) { 32 new SwitchAction().perform(nodes); 33 return new SwitchOperator(); 34 } 35 36 40 public static SwitchOperator invoke(Node node) { 41 return invoke(new Node[] {node}); 42 } 43 44 private JLabelOperator _lblRepositoryFolder; 45 private JComboBoxOperator _cboRepositoryFolder; 46 private JButtonOperator _btBrowseRepositoryFolder; 47 private JLabelOperator _lblRepositoryRevision; 48 private JLabelOperator _lblEmptyMeansRepositoryHEAD; 49 private JTextFieldOperator _txtRepositoryRevision; 50 private JButtonOperator _btSearch; 51 private JButtonOperator _btSwitch; 52 private JButtonOperator _btCancel; 53 private JButtonOperator _btHelp; 54 55 56 60 63 public JLabelOperator lblRepositoryFolder() { 64 if (_lblRepositoryFolder==null) { 65 _lblRepositoryFolder = new JLabelOperator(this, "Repository Folder:"); 66 } 67 return _lblRepositoryFolder; 68 } 69 70 73 public JComboBoxOperator cboRepositoryFolder() { 74 if (_cboRepositoryFolder==null) { 75 _cboRepositoryFolder = new JComboBoxOperator(this); 76 } 77 return _cboRepositoryFolder; 78 } 79 80 83 public JButtonOperator btBrowseRepositoryFolder() { 84 if (_btBrowseRepositoryFolder==null) { 85 _btBrowseRepositoryFolder = new JButtonOperator(this, "Browse"); 86 } 87 return _btBrowseRepositoryFolder; 88 } 89 90 93 public JLabelOperator lblRepositoryRevision() { 94 if (_lblRepositoryRevision==null) { 95 _lblRepositoryRevision = new JLabelOperator(this, "Repository Revision:"); 96 } 97 return _lblRepositoryRevision; 98 } 99 100 103 public JLabelOperator lblEmptyMeansRepositoryHEAD() { 104 if (_lblEmptyMeansRepositoryHEAD==null) { 105 _lblEmptyMeansRepositoryHEAD = new JLabelOperator(this, "(empty means repository HEAD)"); 106 } 107 return _lblEmptyMeansRepositoryHEAD; 108 } 109 110 113 public JTextFieldOperator txtRepositoryRevision() { 114 if (_txtRepositoryRevision==null) { 115 _txtRepositoryRevision = new JTextFieldOperator(this, 1); 116 } 117 return _txtRepositoryRevision; 118 } 119 120 123 public JButtonOperator btSearch() { 124 if (_btSearch==null) { 125 _btSearch = new JButtonOperator(this, "Search..."); 126 } 127 return _btSearch; 128 } 129 130 133 public JButtonOperator btSwitch() { 134 if (_btSwitch==null) { 135 _btSwitch = new JButtonOperator(this, "Switch"); 136 } 137 return _btSwitch; 138 } 139 140 143 public JButtonOperator btCancel() { 144 if (_btCancel==null) { 145 _btCancel = new JButtonOperator(this, "Cancel"); 146 } 147 return _btCancel; 148 } 149 150 153 public JButtonOperator btHelp() { 154 if (_btHelp==null) { 155 _btHelp = new JButtonOperator(this, "Help"); 156 } 157 return _btHelp; 158 } 159 160 161 165 170 public String getSelectedRepositoryFolder() { 171 return cboRepositoryFolder().getSelectedItem().toString(); 172 } 173 174 public String getRepositoryFolder() { 175 return cboRepositoryFolder().getEditor().getItem().toString(); 176 } 177 178 183 public void selectJComboBox(String item) { 184 cboRepositoryFolder().clearText(); 185 cboRepositoryFolder().selectItem(item); 186 } 187 188 193 public void setRepositoryFolder(String text) { 194 cboRepositoryFolder().clearText(); 195 cboRepositoryFolder().typeText(text); 196 } 197 198 200 public RepositoryBrowserOperator browseRepositoryFolder() { 201 btBrowseRepositoryFolder().pushNoBlock(); 202 return new RepositoryBrowserOperator(); 203 } 204 205 210 public String getRepositoryRevision() { 211 return txtRepositoryRevision().getText(); 212 } 213 214 219 public void setRepositoryRevision(String text) { 220 txtRepositoryRevision().clearText(); 221 txtRepositoryRevision().typeText(text); 222 } 223 224 226 public void search() { 227 btSearch().push(); 228 } 229 230 232 public void switchBt() { 233 btSwitch().push(); 234 } 235 236 238 public void cancel() { 239 btCancel().push(); 240 } 241 242 244 public void help() { 245 btHelp().push(); 246 } 247 248 249 253 255 public void verify() { 256 lblRepositoryFolder(); 257 cboRepositoryFolder(); 258 btBrowseRepositoryFolder(); 259 lblRepositoryRevision(); 260 lblEmptyMeansRepositoryHEAD(); 261 txtRepositoryRevision(); 262 btSearch(); 263 btSwitch(); 264 btCancel(); 265 btHelp(); 266 } 267 } 268 269 | Popular Tags |