001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: * The Original Software is NetBeans.
026: * The Initial Developer of the Original Software is Sun Microsystems, Inc.
027: * Portions created by Sun Microsystems, Inc. are Copyright (C) 2003
028: * All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: *
041: * Contributor(s): Sun Microsystems, Inc.
042: */
043:
044: package org.netbeans.jellytools.modules.debuggercore.operators;
045:
046: import org.netbeans.jemmy.operators.*;
047:
048: /** Class implementing all necessary methods for handling "Attach" NbDialog.
049: *
050: * @author mg105252
051: * @version 1.0
052: */
053: public class AttachJDialogOperator extends JDialogOperator {
054:
055: /** Creates new AttachJDialogOperator that can handle it.
056: */
057: public AttachJDialogOperator() {
058: super ("Attach");
059: }
060:
061: private JComboBoxOperator _cboDebugger;
062: private JComboBoxOperator _cboConnector;
063: // public static final String ITEM_DEFAULTDEBUGGERJPDA = "Default Debugger (JPDA)";
064: private JTextFieldOperator _txtTransport;
065: private JTextFieldOperator _txtHost;
066: private JTextFieldOperator _txtPort;
067: private JButtonOperator _btOK;
068: private JButtonOperator _btCancel;
069: private JButtonOperator _btHelp;
070:
071: //******************************
072: // Subcomponents definition part
073: //******************************
074:
075: /** Tries to find null JComboBox in this dialog.
076: * @return JComboBoxOperator
077: */
078: public JComboBoxOperator cboDebugger() {
079: if (_cboDebugger == null) {
080: _cboDebugger = new JComboBoxOperator(this );
081: }
082: return _cboDebugger;
083: }
084:
085: ///////////////////////////////////////////////////////////////////////////////
086: public JComboBoxOperator cboConnector() {
087: if (_cboConnector == null) {
088: _cboConnector = new JComboBoxOperator(this , 1);
089: }
090: return _cboConnector;
091: }
092:
093: ///////////////////////////////////////////////////////////////////////////////
094:
095: /** Tries to find null JTextField in this dialog.
096: * @return JTextFieldOperator
097: */
098: public JTextFieldOperator txtTransport() {
099: if (_txtTransport == null) {
100: _txtTransport = new JTextFieldOperator(this );
101: }
102: return _txtTransport;
103: }
104:
105: /** Tries to find null JTextField in this dialog.
106: * @return JTextFieldOperator
107: */
108: public JTextFieldOperator txtHost() {
109: if (_txtHost == null) {
110: _txtHost = new JTextFieldOperator(this , 1);
111: }
112: return _txtHost;
113: }
114:
115: /** Tries to find null JTextField in this dialog.
116: * @return JTextFieldOperator
117: */
118: public JTextFieldOperator txtPort() {
119: if (_txtPort == null) {
120: _txtPort = new JTextFieldOperator(this , 2);
121: }
122: return _txtPort;
123: }
124:
125: /** Tries to find "OK" JButton in this dialog.
126: * @return JButtonOperator
127: */
128: public JButtonOperator btOK() {
129: if (_btOK == null) {
130: _btOK = new JButtonOperator(this , "OK");
131: }
132: return _btOK;
133: }
134:
135: /** Tries to find "Cancel" JButton in this dialog.
136: * @return JButtonOperator
137: */
138: public JButtonOperator btCancel() {
139: if (_btCancel == null) {
140: _btCancel = new JButtonOperator(this , "Cancel");
141: }
142: return _btCancel;
143: }
144:
145: /** Tries to find "Help" JButton in this dialog.
146: * @return JButtonOperator
147: */
148: public JButtonOperator btHelp() {
149: if (_btHelp == null) {
150: _btHelp = new JButtonOperator(this , "Help");
151: }
152: return _btHelp;
153: }
154:
155: //****************************************
156: // Low-level functionality definition part
157: //****************************************
158:
159: /** returns selected item for cboDebugger
160: * @return String item
161: */
162: public String getSelectedDebugger() {
163: return cboDebugger().getSelectedItem().toString();
164: }
165:
166: /** selects item for cboDebugger
167: * @param item String item
168: */
169: public void selectDebugger(String item) {
170: cboDebugger().selectItem(item);
171: }
172:
173: ///////////////////////////////////////////////////////////////////////////////
174: public void selectConnector(String item) {
175: cboConnector().selectItem(item);
176: }
177:
178: public void selectConnector(int item) {
179: cboConnector().selectItem(1);
180: }
181:
182: ///////////////////////////////////////////////////////////////////////////////
183: /** types text for cboDebugger
184: * @param text String text
185: */
186: public void typeDebugger(String text) {
187: cboDebugger().typeText(text);
188: }
189:
190: /** gets text for txtTransport
191: * @return String text
192: */
193: public String getTransport() {
194: return txtTransport().getText();
195: }
196:
197: /** sets text for txtTransport
198: * @param text String text
199: */
200: public void setTransport(String text) {
201: txtTransport().setText(text);
202: }
203:
204: /** types text for txtTransport
205: * @param text String text
206: */
207: public void typeTransport(String text) {
208: txtTransport().typeText(text);
209: }
210:
211: /** gets text for txtHost
212: * @return String text
213: */
214: public String getHost() {
215: return txtHost().getText();
216: }
217:
218: /** sets text for txtHost
219: * @param text String text
220: */
221: public void setHost(String text) {
222: txtHost().setText(text);
223: }
224:
225: /** types text for txtHost
226: * @param text String text
227: */
228: public void typeHost(String text) {
229: txtHost().typeText(text);
230: }
231:
232: /** gets text for txtPort
233: * @return String text
234: */
235: public String getPort() {
236: return txtPort().getText();
237: }
238:
239: /** sets text for txtPort
240: * @param text String text
241: */
242: public void setPort(String text) {
243: txtPort().setText(text);
244: }
245:
246: /** types text for txtPort
247: * @param text String text
248: */
249: public void typePort(String text) {
250: txtPort().typeText(text);
251: }
252:
253: /** clicks on "OK" JButton
254: */
255: public void oK() {
256: btOK().push();
257: }
258:
259: /** clicks on "Cancel" JButton
260: */
261: public void cancel() {
262: btCancel().push();
263: }
264:
265: /** clicks on "Help" JButton
266: */
267: public void help() {
268: btHelp().push();
269: }
270:
271: //*****************************************
272: // High-level functionality definition part
273: //*****************************************
274:
275: /** Performs verification of AttachJDialogOperator by accessing all its components.
276: */
277: public void verify() {
278: cboDebugger();
279: txtTransport();
280: txtHost();
281: txtPort();
282: btOK();
283: btCancel();
284: btHelp();
285: }
286:
287: /** Performs simple test of AttachJDialogOperator
288: * @param args the command line arguments
289: */
290: public static void main(String args[]) {
291: // new AttachJDialogOperator().verify();
292: System.out
293: .println("AttachJDialogOperator verification finished.");
294: java.util.Enumeration enumeration = System.getProperties()
295: .keys();
296: String property;
297: while (enumeration.hasMoreElements()) {
298: property = (String) enumeration.nextElement();
299: System.out.println(property + "\t"
300: + System.getProperty(property));
301: }
302:
303: }
304: }
|