1 19 package org.netbeans.test.subversion.operators; 20 21 import org.netbeans.jellytools.NbDialogOperator; 22 import org.netbeans.jellytools.nodes.Node; 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.JTableOperator; 27 import org.netbeans.jemmy.operators.JTextAreaOperator; 28 import org.netbeans.test.subversion.operators.actions.CommitAction; 29 30 31 47 public class CommitOperator extends NbDialogOperator { 48 49 52 public CommitOperator() { 53 super("Commit"); 54 } 55 56 60 public static CommitOperator invoke(Node[] nodes) { 61 new CommitAction().perform(nodes); 62 return new CommitOperator(); 63 } 64 65 69 public static CommitOperator invoke(Node node) { 70 return invoke(new Node[] {node}); 71 } 72 73 private JLabelOperator _lblCommitMessage; 74 private JTextAreaOperator _txtCommitMessage; 75 private JLabelOperator _lblFilesToCommit; 76 private JTableOperator _tabFiles; 77 private JButtonOperator _btCommit; 78 private JButtonOperator _btCancel; 79 private JButtonOperator _btHelp; 80 81 85 88 public JLabelOperator lblCommitMessage() { 89 if (_lblCommitMessage==null) { 90 _lblCommitMessage = new JLabelOperator(this, "Commit Message"); 91 } 92 return _lblCommitMessage; 93 } 94 95 98 public JTextAreaOperator txtCommitMessage() { 99 if (_txtCommitMessage==null) { 100 _txtCommitMessage = new JTextAreaOperator(this); 101 } 102 return _txtCommitMessage; 103 } 104 105 108 public JLabelOperator lblFilesToCommit() { 109 if (_lblFilesToCommit==null) { 110 _lblFilesToCommit = new JLabelOperator(this, "Files to Commit"); 111 } 112 return _lblFilesToCommit; 113 } 114 115 118 public JTableOperator tabFiles() { 119 if (_tabFiles==null) { 120 _tabFiles = new JTableOperator(this); 121 } 122 return _tabFiles; 123 } 124 125 128 public JButtonOperator btCommit() { 129 if (_btCommit==null) { 130 _btCommit = new JButtonOperator(this, "Commit"); 131 } 132 return _btCommit; 133 } 134 135 138 public JButtonOperator btCancel() { 139 if (_btCancel==null) { 140 _btCancel = new JButtonOperator(this, "Cancel"); 141 } 142 return _btCancel; 143 } 144 145 148 public JButtonOperator btHelp() { 149 if (_btHelp==null) { 150 _btHelp = new JButtonOperator(this, "Help"); 151 } 152 return _btHelp; 153 } 154 155 159 162 public String getCommitMessage() { 163 return txtCommitMessage().getText(); 164 } 165 166 169 public void setCommitMessage(String text) { 170 txtCommitMessage().clearText(); 171 txtCommitMessage().typeText(text); 172 } 173 174 176 public void commit() { 177 btCommit().push(); 178 } 179 180 184 public void selectCommitAction(int rowIndex, String action) { 185 tabFiles().clickOnCell(rowIndex, 2); 186 JComboBoxOperator combo = new JComboBoxOperator(tabFiles()); 187 combo.selectItem(action); 188 } 189 190 194 public void selectCommitAction(String filename, String action) { 195 selectCommitAction(tabFiles().findCellRow(filename), action); 196 } 197 198 202 204 public void verify() { 205 lblCommitMessage(); 206 txtCommitMessage(); 207 tabFiles(); 209 btCommit(); 210 btCancel(); 211 btHelp(); 212 } 213 } 214 | Popular Tags |