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: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. 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:
042: package org.netbeans.jellytools.properties.editors;
043:
044: /*
045: * ProcessDescriptorCustomEditorOperator.java
046: *
047: * Created on 6/12/02 5:00 PM
048: */
049:
050: import javax.swing.JDialog;
051: import org.netbeans.jellytools.Bundle;
052: import org.netbeans.jellytools.NbDialogOperator;
053: import org.netbeans.jemmy.operators.JButtonOperator;
054: import org.netbeans.jemmy.operators.JDialogOperator;
055: import org.netbeans.jemmy.operators.JTextAreaOperator;
056: import org.netbeans.jemmy.operators.JTextFieldOperator;
057:
058: /** Class implementing all necessary methods for handling Process Descriptor Custom
059: * Editor
060: * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a>
061: * @version 1.0 */
062: public class ProcessDescriptorCustomEditorOperator extends
063: NbDialogOperator {
064:
065: /** Creates new ProcessDescriptorCustomEditorOperator
066: * @throws TimeoutExpiredException when NbDialog not found
067: * @param title String title of custom editor */
068: public ProcessDescriptorCustomEditorOperator(String title) {
069: super (title);
070: }
071:
072: /** creates new ProcessDescriptorCustomEditorOperator
073: * @param wrapper JDialogOperator wrapper for custom editor */
074: public ProcessDescriptorCustomEditorOperator(JDialogOperator wrapper) {
075: super ((JDialog) wrapper.getSource());
076: }
077:
078: private JTextAreaOperator _txtArgumentKey;
079: private JButtonOperator _btSelectProcessExecutable;
080: private JTextFieldOperator _txtProcess;
081: private JTextAreaOperator _txtArguments;
082:
083: /** Tries to find null JTextArea in this dialog.
084: * @throws TimeoutExpiredException when component not found
085: * @return JTextAreaOperator
086: */
087: public JTextAreaOperator txtArgumentKey() {
088: if (_txtArgumentKey == null) {
089: _txtArgumentKey = new JTextAreaOperator(this , 1);
090: }
091: return _txtArgumentKey;
092: }
093:
094: /** Tries to find Browse... JButton in this dialog.
095: * @throws TimeoutExpiredException when component not found
096: * @return JButtonOperator
097: */
098: public JButtonOperator btSelectProcessExecutable() {
099: if (_btSelectProcessExecutable == null) {
100: _btSelectProcessExecutable = new JButtonOperator(
101: this ,
102: Bundle
103: .getStringTrimmed(
104: "org.netbeans.core.execution.beaninfo.editors.Bundle",
105: "CTL_NbProcessDescriptorCustomEditor.jButton1.text"));
106: }
107: return _btSelectProcessExecutable;
108: }
109:
110: /** Tries to find null JTextField in this dialog.
111: * @throws TimeoutExpiredException when component not found
112: * @return JTextFieldOperator
113: */
114: public JTextFieldOperator txtProcess() {
115: if (_txtProcess == null) {
116: _txtProcess = new JTextFieldOperator(this , 0);
117: }
118: return _txtProcess;
119: }
120:
121: /** Tries to find null JTextArea in this dialog.
122: * @throws TimeoutExpiredException when component not found
123: * @return JTextAreaOperator
124: */
125: public JTextAreaOperator txtArguments() {
126: if (_txtArguments == null) {
127: _txtArguments = new JTextAreaOperator(this , 0);
128: }
129: return _txtArguments;
130: }
131:
132: /** getter for Argument Key text
133: * @return String text of Argument Key */
134: public String getArgumentKey() {
135: return txtArgumentKey().getText();
136: }
137:
138: /** clicks on ... JButton
139: * @throws TimeoutExpiredException when JButton not found
140: * @return FileCustomEditorOperator */
141: public FileCustomEditorOperator selectProcessExecutable() {
142: btSelectProcessExecutable().pushNoBlock();
143: return new FileCustomEditorOperator(Bundle.getString(
144: "org.openide.actions.Bundle", "Open"));
145: }
146:
147: /** getter of edited process text
148: * @return String process text */
149: public String getProcess() {
150: return txtProcess().getText();
151: }
152:
153: /** tries to find and set text of txtProcess
154: * @param text String text
155: */
156: public void setProcess(String text) {
157: txtProcess().setText(text);
158: }
159:
160: /** getter of edited arguments text
161: * @return String argumentstext */
162: public String getArguments() {
163: return txtArguments().getText();
164: }
165:
166: /** tries to find and set text of txtArguments
167: * @param text String text
168: */
169: public void setArguments(String text) {
170: txtArguments().setText(text);
171: }
172:
173: /** Performs verification by accessing all sub-components */
174: public void verify() {
175: txtArgumentKey();
176: txtArguments();
177: txtProcess();
178: btSelectProcessExecutable();
179: }
180: }
|