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