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-2006 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: import javax.swing.JDialog;
045: import org.netbeans.jellytools.NbDialogOperator;
046: import org.netbeans.jemmy.JemmyException;
047: import org.netbeans.jemmy.operators.*;
048:
049: // editor for Rectangle
050: /** Class implementing all necessary methods for handling Rectangle Custom Editor
051: * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a>
052: * @version 1.0 */
053: public class RectangleCustomEditorOperator extends NbDialogOperator {
054:
055: JTextFieldOperator _txtFieldX;
056: JTextFieldOperator _txtFieldY;
057: JTextFieldOperator _txtFieldWidth;
058: JTextFieldOperator _txtFieldHeight;
059:
060: /** creates new RectangleCustomEditorOperator
061: * @param title String title of custom editor */
062: public RectangleCustomEditorOperator(String title) {
063: super (title);
064: }
065:
066: /** creates new RectangleCustomEditorOperator
067: * @param wrapper JDialogOperator wrapper for custom editor */
068: public RectangleCustomEditorOperator(JDialogOperator wrapper) {
069: super ((JDialog) wrapper.getSource());
070: }
071:
072: /** setter for edited rectangle value
073: * @param x int x
074: * @param y int y
075: * @param width int width
076: * @param height int height */
077: public void setRectangleValue(String x, String y, String width,
078: String height) {
079: txtFieldX().setText(x);
080: txtFieldY().setText(y);
081: txtFieldWidth().setText(width);
082: txtFieldHeight().setText(height);
083: }
084:
085: /** getter for edited X value
086: * @return int X */
087: public String getXValue() {
088: return txtFieldX().getText();
089: }
090:
091: /** setter for edited X value
092: * @param value int X */
093: public void setXValue(String value) {
094: txtFieldX().setText(value);
095: }
096:
097: /** getter for edited Y value
098: * @return int Y */
099: public String getYValue() {
100: return txtFieldY().getText();
101: }
102:
103: /** setter for edited Y value
104: * @param value int Y */
105: public void setYValue(String value) {
106: txtFieldY().setText(value);
107: }
108:
109: /** getter for edited Width value
110: * @return int Width */
111: public String getWidthValue() {
112: return txtFieldWidth().getText();
113: }
114:
115: /** setter for edited Width value
116: * @param value int Width */
117: public void setWidthValue(String value) {
118: txtFieldWidth().setText(value);
119: }
120:
121: /** getter for edited Height value
122: * @return int Height */
123: public String getHeightValue() {
124: return txtFieldHeight().getText();
125: }
126:
127: /** setter for edited Height value
128: * @param value int Height */
129: public void setHeightValue(String value) {
130: txtFieldHeight().setText(value);
131: }
132:
133: /** getter for X JTextFieldOperator
134: * @return JTextFieldOperator */
135: public JTextFieldOperator txtFieldX() {
136: if (_txtFieldX == null) {
137: _txtFieldX = new JTextFieldOperator(this , 0);
138: }
139: return _txtFieldX;
140: }
141:
142: /** getter for Y JTextFieldOperator
143: * @return JTextFieldOperator */
144: public JTextFieldOperator txtFieldY() {
145: if (_txtFieldY == null) {
146: _txtFieldY = new JTextFieldOperator(this , 1);
147: }
148: return _txtFieldY;
149: }
150:
151: /** getter for Width JTextFieldOperator
152: * @return JTextFieldOperator */
153: public JTextFieldOperator txtFieldWidth() {
154: if (_txtFieldWidth == null) {
155: _txtFieldWidth = new JTextFieldOperator(this , 2);
156: }
157: return _txtFieldWidth;
158: }
159:
160: /** getter for Height JTextFieldOperator
161: * @return JTextFieldOperator */
162: public JTextFieldOperator txtFieldHeight() {
163: if (_txtFieldHeight == null) {
164: _txtFieldHeight = new JTextFieldOperator(this , 3);
165: }
166: return _txtFieldHeight;
167: }
168:
169: /** Performs verification by accessing all sub-components */
170: public void verify() {
171: txtFieldHeight();
172: txtFieldWidth();
173: txtFieldX();
174: txtFieldY();
175: }
176:
177: }
|