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