KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > subversion > operators > MergeOperator


1 /*
2  * MergeOperator.java
3  *
4  * Created on 16/05/06 15:09
5  */

6 package org.netbeans.test.subversion.operators;
7
8 import org.netbeans.jellytools.nodes.Node;
9 import org.netbeans.jemmy.operators.*;
10 import org.netbeans.test.subversion.operators.actions.MergeAction;
11
12 /** Class implementing all necessary methods for handling "Merge AnagramGame to..." NbDialog.
13  *
14  * @author peter
15  * @version 1.0
16  */

17 public class MergeOperator extends JDialogOperator {
18
19     /**
20      * Creates new MergeOperator that can handle it.
21      */

22     public MergeOperator() {
23         super("Merge");
24     }
25
26     /** Selects nodes and call merge action on them.
27      * @param nodes an array of nodes
28      * @return MergeOperator instance
29      */

30     public static MergeOperator invoke(Node[] nodes) {
31         new MergeAction().perform(nodes);
32         return new MergeOperator();
33     }
34     
35     /** Selects node and call merge action on it.
36      * @param node node to be selected
37      * @return CommitOperator instance
38      */

39     public static MergeOperator invoke(Node node) {
40         return invoke(new Node[] {node});
41     }
42
43     private JComboBoxOperator _cboMergeFrom;
44     private JButtonOperator _btMerge;
45     private JButtonOperator _btCancel;
46     private JButtonOperator _btHelp;
47
48
49     //******************************
50
// Subcomponents definition part
51
//******************************
52

53     /** Tries to find null JComboBox in this dialog.
54      * @return JComboBoxOperator
55      */

56     public JComboBoxOperator cboMergeFrom() {
57         if (_cboMergeFrom==null) {
58             _cboMergeFrom = new JComboBoxOperator(this, 1);
59         }
60         return _cboMergeFrom;
61     }
62
63     
64     /** Tries to find "Merge" JButton in this dialog.
65      * @return JButtonOperator
66      */

67     public JButtonOperator btMerge() {
68         if (_btMerge==null) {
69             _btMerge = new JButtonOperator(this, "Merge");
70         }
71         return _btMerge;
72     }
73
74     /** Tries to find "Cancel" JButton in this dialog.
75      * @return JButtonOperator
76      */

77     public JButtonOperator btCancel() {
78         if (_btCancel==null) {
79             _btCancel = new JButtonOperator(this, "Cancel");
80         }
81         return _btCancel;
82     }
83
84     /** Tries to find "Help" JButton in this dialog.
85      * @return JButtonOperator
86      */

87     public JButtonOperator btHelp() {
88         if (_btHelp==null) {
89             _btHelp = new JButtonOperator(this, "Help");
90         }
91         return _btHelp;
92     }
93
94
95     //****************************************
96
// Low-level functionality definition part
97
//****************************************
98

99     /**
100      * returns selected item for cboMergeFrom
101      *
102      * @return String item
103      */

104     public String JavaDoc getSelectedMergeFrom() {
105         return cboMergeFrom().getSelectedItem().toString();
106     }
107
108     /**
109      * selects item for cboMergeFrom
110      *
111      * @param item String item
112      */

113     public void selectMergeFrom(String JavaDoc item) {
114         cboMergeFrom().selectItem(item);
115     }
116
117     /**
118      * types text for cboMergeFrom
119      *
120      * @param text String text
121      */

122     public void setMergeFrom(String JavaDoc text) {
123         cboMergeFrom().clearText();
124         cboMergeFrom().typeText(text);
125     }
126 }
127
128
Popular Tags