KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > jellytools > modules > java > MethodCustomizerOperator


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * MethodCustomizerOperator.java
22  *
23  * Created on 12/24/04 12:01 PM
24  */

25 package org.netbeans.jellytools.modules.java;
26
27 import org.netbeans.jemmy.operators.*;
28 import org.netbeans.jemmy.util.NameComponentChooser;
29
30 /** Class implementing all necessary methods for handling "Method - Properties" NbDialog.
31  *
32  * @author Roman Strobl
33  * @version 1.0
34  */

35 public class MethodCustomizerOperator extends JDialogOperator {
36
37     /** Creates new NewMethodProperties that can handle it.
38      */

39     public MethodCustomizerOperator(String JavaDoc name) {
40         super(name);
41     }
42
43     private JSplitPaneOperator _sppJSplitPane;
44     private JTextAreaOperator _txtJTextArea;
45     private JLabelOperator _lblNewMethod;
46     private JButtonOperator _btJButton;
47     private JTableOperator _tabPropertiesTable;
48     private JButtonOperator _btClose;
49
50
51     //******************************
52
// Subcomponents definition part
53
//******************************
54

55     /** Tries to find null JSplitPane in this dialog.
56      * @return JSplitPaneOperator
57      */

58     public JSplitPaneOperator sppJSplitPane() {
59         if (_sppJSplitPane==null) {
60             _sppJSplitPane = new JSplitPaneOperator(this);
61         }
62         return _sppJSplitPane;
63     }
64
65     /** Tries to find null JTextArea in this dialog.
66      * @return JTextAreaOperator
67      */

68     public JTextAreaOperator txtJTextArea() {
69         if (_txtJTextArea==null) {
70             _txtJTextArea = new JTextAreaOperator(sppJSplitPane());
71         }
72         return _txtJTextArea;
73     }
74
75     /** Tries to find "newMethod" JLabel in this dialog.
76      * @return JLabelOperator
77      */

78     public JLabelOperator lblNewMethod() {
79         if (_lblNewMethod==null) {
80             _lblNewMethod = new JLabelOperator(sppJSplitPane(), "newMethod");
81         }
82         return _lblNewMethod;
83     }
84
85     /** Tries to find null JButton in this dialog.
86      * @return JButtonOperator
87      */

88     public JButtonOperator btJButton() {
89         if (_btJButton==null) {
90             _btJButton = new JButtonOperator(sppJSplitPane());
91         }
92         return _btJButton;
93     }
94
95     /** Tries to find null SheetTable in this dialog.
96      * @return JTableOperator
97      */

98     public JTableOperator tabPropertiesTable() {
99         if (_tabPropertiesTable==null) {
100             _tabPropertiesTable = new JTableOperator(sppJSplitPane());
101         }
102         return _tabPropertiesTable;
103     }
104
105     /** Tries to find "Close" JButton in this dialog.
106      * @return JButtonOperator
107      */

108     public JButtonOperator btClose() {
109         if (_btClose==null) {
110             _btClose = new JButtonOperator(this, "Close");
111         }
112         return _btClose;
113     }
114
115
116     //****************************************
117
// Low-level functionality definition part
118
//****************************************
119

120     /** gets text for txtJTextArea
121      * @return String text
122      */

123     public String JavaDoc getJTextArea() {
124         return txtJTextArea().getText();
125     }
126
127     /** sets text for txtJTextArea
128      * @param text String text
129      */

130     public void setJTextArea(String JavaDoc text) {
131         txtJTextArea().setText(text);
132     }
133
134     /** types text for txtJTextArea
135      * @param text String text
136      */

137     public void typeJTextArea(String JavaDoc text) {
138         txtJTextArea().typeText(text);
139     }
140
141     /** clicks on null JButton
142      */

143     public void jButton() {
144         btJButton().push();
145     }
146
147     /** clicks on "Close" JButton
148      */

149     public void close() {
150         btClose().push();
151     }
152
153
154     //*****************************************
155
// High-level functionality definition part
156
//*****************************************
157

158     /** Performs verification of NewMethodProperties by accessing all its components.
159      */

160     public void verify() {
161         sppJSplitPane();
162         txtJTextArea();
163         lblNewMethod();
164         btJButton();
165         tabPropertiesTable();
166         btClose();
167     }
168
169     /** Performs simple test of MethodCustomizerOperator
170     * @param args the command line arguments
171     */

172     public static void main(String JavaDoc args[]) {
173         new MethodCustomizerOperator("Edit New Method").verify();
174         System.out.println("MethodCustomizerOperator verification finished.");
175     }
176 }
177
178
Popular Tags