0001: /*
0002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003: *
0004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005: *
0006: * The contents of this file are subject to the terms of either the GNU
0007: * General Public License Version 2 only ("GPL") or the Common
0008: * Development and Distribution License("CDDL") (collectively, the
0009: * "License"). You may not use this file except in compliance with the
0010: * License. You can obtain a copy of the License at
0011: * http://www.netbeans.org/cddl-gplv2.html
0012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013: * specific language governing permissions and limitations under the
0014: * License. When distributing the software, include this License Header
0015: * Notice in each file and include the License file at
0016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
0017: * particular file as subject to the "Classpath" exception as provided
0018: * by Sun in the GPL Version 2 section of the License file that
0019: * accompanied this code. If applicable, add the following below the
0020: * License Header, with the fields enclosed by brackets [] replaced by
0021: * your own identifying information:
0022: * "Portions Copyrighted [year] [name of copyright owner]"
0023: *
0024: * Contributor(s): Alexandre Iline.
0025: *
0026: * The Original Software is the Jemmy library.
0027: * The Initial Developer of the Original Software is Alexandre Iline.
0028: * All Rights Reserved.
0029: *
0030: * If you wish your version of this file to be governed by only the CDDL
0031: * or only the GPL Version 2, indicate your decision by adding
0032: * "[Contributor] elects to include this software in this distribution
0033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034: * single choice of license, a recipient has the option to distribute
0035: * your version of this file under either the CDDL, the GPL Version 2 or
0036: * to extend the choice of license to its licensees as provided above.
0037: * However, if you add GPL Version 2 code and therefore, elected the GPL
0038: * Version 2 license, then the option applies only if the new code is
0039: * made subject to such option by the copyright holder.
0040: *
0041: *
0042: *
0043: * $Id: ComponentOperator.java,v 1.20 2007/10/05 11:35:39 jskrivanek Exp $ $Revision: 1.20 $ $Date: 2007/10/05 11:35:39 $
0044: *
0045: */
0046:
0047: package org.netbeans.jemmy.operators;
0048:
0049: import org.netbeans.jemmy.CharBindingMap;
0050: import org.netbeans.jemmy.ComponentChooser;
0051: import org.netbeans.jemmy.ComponentSearcher;
0052: import org.netbeans.jemmy.EventDispatcher;
0053: import org.netbeans.jemmy.JemmyException;
0054: import org.netbeans.jemmy.JemmyProperties;
0055: import org.netbeans.jemmy.Outputable;
0056: import org.netbeans.jemmy.QueueTool;
0057: import org.netbeans.jemmy.TestOut;
0058: import org.netbeans.jemmy.Timeoutable;
0059: import org.netbeans.jemmy.TimeoutExpiredException;
0060: import org.netbeans.jemmy.Timeouts;
0061: import org.netbeans.jemmy.Waitable;
0062: import org.netbeans.jemmy.Waiter;
0063:
0064: import org.netbeans.jemmy.drivers.DriverManager;
0065: import org.netbeans.jemmy.drivers.FocusDriver;
0066: import org.netbeans.jemmy.drivers.KeyDriver;
0067: import org.netbeans.jemmy.drivers.MouseDriver;
0068:
0069: import java.awt.AWTEvent;
0070: import java.awt.Color;
0071: import java.awt.Component;
0072: import java.awt.ComponentOrientation;
0073: import java.awt.Container;
0074: import java.awt.Cursor;
0075: import java.awt.Dimension;
0076: import java.awt.Font;
0077: import java.awt.FontMetrics;
0078: import java.awt.Graphics;
0079: import java.awt.Image;
0080: import java.awt.MenuComponent;
0081: import java.awt.Point;
0082: import java.awt.PopupMenu;
0083: import java.awt.Rectangle;
0084: import java.awt.Toolkit;
0085: import java.awt.Window;
0086:
0087: import java.awt.dnd.DropTarget;
0088:
0089: import java.awt.event.ComponentListener;
0090: import java.awt.event.FocusListener;
0091: import java.awt.event.InputEvent;
0092: import java.awt.event.InputMethodListener;
0093: import java.awt.event.KeyEvent;
0094: import java.awt.event.KeyListener;
0095: import java.awt.event.MouseEvent;
0096: import java.awt.event.MouseListener;
0097: import java.awt.event.MouseMotionListener;
0098:
0099: import java.awt.im.InputContext;
0100: import java.awt.im.InputMethodRequests;
0101:
0102: import java.awt.image.ColorModel;
0103: import java.awt.image.ImageObserver;
0104: import java.awt.image.ImageProducer;
0105:
0106: import java.beans.PropertyChangeListener;
0107:
0108: import java.io.PrintStream;
0109: import java.io.PrintWriter;
0110:
0111: import java.util.Hashtable;
0112: import java.util.Locale;
0113:
0114: /**
0115: * Root class for all component operators.
0116: *
0117: * Provides basic methods to operate with mouse and keyboard.<BR>
0118: * <BR>
0119: * Almost all input methods can throw JemmyInputException or its subclass.<BR>
0120: *
0121: * ComponentOperator and its subclasses has a lot of methods which name and parameters just like
0122: * consistent component has. In this case operator class just invokes consistent component method
0123: * through AWT Event Queue (invokeAndWait method).
0124: *
0125: * <BR><BR>Timeouts used: <BR>
0126: * ComponentOperator.PushKeyTimeout - time between key pressing and releasing <BR>
0127: * ComponentOperator.MouseClickTimeout - time between mouse pressing and releasing <BR>
0128: * ComponentOperator.WaitComponentTimeout - time to wait component displayed <BR>
0129: * ComponentOperator.WaitComponentEnabledTimeout - time to wait component enabled <BR>
0130: * ComponentOperator.BeforeDragTimeout - time to sleep before grag'n'drop operations <BR>
0131: * ComponentOperator.AfterDragTimeout - time to sleep after grag'n'drop operations <BR>
0132: * ComponentOperator.WaitFocusTimeout - time to wait component focus <BR>
0133: * ComponentOperator.WaitStateTimeout- time to wait component to be in some state.
0134: * Typically used from methods like <code>Operator.wait"something happened"(*)</code><br>.
0135: *
0136: * @see org.netbeans.jemmy.Timeouts
0137: *
0138: * @author Alexandre Iline (alexandre.iline@sun.com)
0139: */
0140:
0141: public class ComponentOperator extends Operator implements Timeoutable,
0142: Outputable {
0143:
0144: /**
0145: * Identifier for a name property.
0146: * @see #getDump
0147: */
0148: public static final String NAME_DPROP = "Name:";
0149:
0150: /**
0151: * Identifier for a visible property.
0152: * @see #getDump
0153: */
0154: public static final String IS_VISIBLE_DPROP = "Visible";
0155:
0156: /**
0157: * Identifier for a showing property.
0158: * @see #getDump
0159: */
0160: public static final String IS_SHOWING_DPROP = "Showing";
0161:
0162: /**
0163: * Identifier for a x coordinate property.
0164: * @see #getDump
0165: */
0166: public static final String X_DPROP = "X";
0167:
0168: /**
0169: * Identifier for a y coordinate property.
0170: * @see #getDump
0171: */
0172: public static final String Y_DPROP = "Y";
0173:
0174: /**
0175: * Identifier for a width property.
0176: * @see #getDump
0177: */
0178: public static final String WIDTH_DPROP = "Width";
0179:
0180: /**
0181: * Identifier for a height property.
0182: * @see #getDump
0183: */
0184: public static final String HEIGHT_DPROP = "Height";
0185:
0186: private final static long PUSH_KEY_TIMEOUT = 0;
0187: private final static long MOUSE_CLICK_TIMEOUT = 0;
0188: private final static long BEFORE_DRAG_TIMEOUT = 0;
0189: private final static long AFTER_DRAG_TIMEOUT = 0;
0190: private final static long WAIT_COMPONENT_TIMEOUT = 60000;
0191: private final static long WAIT_COMPONENT_ENABLED_TIMEOUT = 60000;
0192: private final static long WAIT_FOCUS_TIMEOUT = 60000;
0193: private final static long WAIT_STATE_TIMEOUT = 60000;
0194:
0195: private Component source;
0196: private Timeouts timeouts;
0197: private TestOut output;
0198: private EventDispatcher dispatcher;
0199: private KeyDriver kDriver;
0200: private MouseDriver mDriver;
0201: private FocusDriver fDriver;
0202:
0203: /**
0204: * Constructor.
0205: * @param comp a component
0206: */
0207: public ComponentOperator(Component comp) {
0208: super ();
0209: source = comp;
0210: kDriver = DriverManager.getKeyDriver(getClass());
0211: mDriver = DriverManager.getMouseDriver(getClass());
0212: fDriver = DriverManager.getFocusDriver(getClass());
0213: setEventDispatcher(new EventDispatcher(comp));
0214: }
0215:
0216: /**
0217: * Constructs a ComponentOperator object.
0218: * @param cont container
0219: * @param chooser a component chooser specifying searching criteria.
0220: * @param index an index between appropriate ones.
0221: */
0222: public ComponentOperator(ContainerOperator cont,
0223: ComponentChooser chooser, int index) {
0224: this (waitComponent((Container) cont.getSource(), chooser,
0225: index, cont.getTimeouts(), cont.getOutput()));
0226: copyEnvironment(cont);
0227: }
0228:
0229: /**
0230: * Constructs a ComponentOperator object.
0231: * @param cont container
0232: * @param chooser a component chooser specifying searching criteria.
0233: */
0234: public ComponentOperator(ContainerOperator cont,
0235: ComponentChooser chooser) {
0236: this (cont, chooser, 0);
0237: }
0238:
0239: /**
0240: * Constructor.
0241: * Waits for a component in a container to show. The component is
0242: * iis the <code>index+1</code>'th <code>java.awt.Component</code>
0243: * that shows and that lies below the container in the display
0244: * containment hierarchy.
0245: * Uses cont's timeout and output for waiting and to init operator.
0246: * @param cont Operator for a java.awt.Container.
0247: * @param index an index between appropriate ones.
0248: * @throws TimeoutExpiredException
0249: */
0250: public ComponentOperator(ContainerOperator cont, int index) {
0251: this (cont, ComponentSearcher.getTrueChooser("Any component"),
0252: index);
0253: }
0254:
0255: /**
0256: * Constructor.
0257: * Waits for a component in a container to show. The component is
0258: * is the first <code>java.awt.Component</code>
0259: * that shows and that lies below the container in the display
0260: * containment hierarchy.
0261: * Uses cont's timeout and output for waiting and to init operator.
0262: * @param cont Operator for a java.awt.Container.
0263: * @throws TimeoutExpiredException
0264: */
0265: public ComponentOperator(ContainerOperator cont) {
0266: this (cont, 0);
0267: }
0268:
0269: /**
0270: * Searches Component in container.
0271: * @param cont Container to search component in.
0272: * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
0273: * @param index Ordinal component index.
0274: * @return Component instance or null if component was not found.
0275: */
0276: public static Component findComponent(Container cont,
0277: ComponentChooser chooser, int index) {
0278: return (findComponent(cont, chooser, index, false));
0279: }
0280:
0281: /**
0282: * Searches Component in container.
0283: * @param cont Container to search component in.
0284: * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
0285: * @return Component instance or null if component was not found.
0286: */
0287: public static Component findComponent(Container cont,
0288: ComponentChooser chooser) {
0289: return (findComponent(cont, chooser, 0));
0290: }
0291:
0292: /**
0293: * Waits Component in container.
0294: * @param cont Container to search component in.
0295: * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
0296: * @param index Ordinal component index.
0297: * @return Component instance or null if component was not found.
0298: * @throws TimeoutExpiredException
0299: */
0300: public static Component waitComponent(Container cont,
0301: ComponentChooser chooser, int index) {
0302: return (waitComponent(cont, chooser, index, JemmyProperties
0303: .getCurrentTimeouts(), JemmyProperties
0304: .getCurrentOutput()));
0305: }
0306:
0307: /**
0308: * Waits Component in container.
0309: * @param cont Container to search component in.
0310: * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
0311: * @return Component instance or null if component was not found.
0312: * @throws TimeoutExpiredException
0313: */
0314: public static Component waitComponent(Container cont,
0315: ComponentChooser chooser) {
0316: return (waitComponent(cont, chooser, 0));
0317: }
0318:
0319: /**
0320: * A method to be used from subclasses.
0321: * Uses <code>contOper</code>'s timeouts and output during the waiting.
0322: * @param contOper Container to search component in.
0323: * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
0324: * @param index Ordinal component index.
0325: * @return Component instance or null if component was not found.
0326: * @throws TimeoutExpiredException
0327: */
0328: protected static Component waitComponent(
0329: ContainerOperator contOper, ComponentChooser chooser,
0330: int index) {
0331: return (waitComponent((Container) contOper.getSource(),
0332: chooser, index, contOper.getTimeouts(), contOper
0333: .getOutput()));
0334: }
0335:
0336: /**
0337: * A method to be used from subclasses.
0338: * Uses timeouts and output passed as parameters during the waiting.
0339: * @param cont Container to search component in.
0340: * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
0341: * @param index Ordinal component index.
0342: * @param timeouts timeouts to be used during the waiting.
0343: * @param output an output to be used during the waiting.
0344: * @return Component instance or null if component was not found.
0345: * @throws TimeoutExpiredException
0346: */
0347: protected static Component waitComponent(final Container cont,
0348: final ComponentChooser chooser, final int index,
0349: Timeouts timeouts, final TestOut output) {
0350: try {
0351: Waiter waiter = new Waiter(new Waitable() {
0352: public Object actionProduced(Object obj) {
0353: return (findComponent(cont,
0354: new VisibleComponentFinder(chooser), index,
0355: output.createErrorOutput()));
0356: }
0357:
0358: public String getDescription() {
0359: return ("Wait " + chooser.getDescription() + " loaded");
0360: }
0361: });
0362: Timeouts times = timeouts.cloneThis();
0363: times
0364: .setTimeout(
0365: "Waiter.WaitingTime",
0366: times
0367: .getTimeout("ComponentOperator.WaitComponentTimeout"));
0368: waiter.setTimeouts(times);
0369: waiter.setOutput(output);
0370: return ((Component) waiter.waitAction(null));
0371: } catch (InterruptedException e) {
0372: return (null);
0373: }
0374: }
0375:
0376: private static Component findComponent(Container cont,
0377: ComponentChooser chooser, int index, TestOut output) {
0378: ComponentSearcher searcher = new ComponentSearcher(cont);
0379: searcher.setOutput(output);
0380: return (searcher.findComponent(new VisibleComponentFinder(
0381: chooser), index));
0382: }
0383:
0384: private static Component findComponent(Container cont,
0385: ComponentChooser chooser, int index, boolean supressOutout) {
0386: return (findComponent(cont, chooser, index, JemmyProperties
0387: .getCurrentOutput().createErrorOutput()));
0388: }
0389:
0390: static {
0391: Timeouts.initDefault("ComponentOperator.PushKeyTimeout",
0392: PUSH_KEY_TIMEOUT);
0393: Timeouts.initDefault("ComponentOperator.MouseClickTimeout",
0394: MOUSE_CLICK_TIMEOUT);
0395: Timeouts.initDefault("ComponentOperator.BeforeDragTimeout",
0396: BEFORE_DRAG_TIMEOUT);
0397: Timeouts.initDefault("ComponentOperator.AfterDragTimeout",
0398: AFTER_DRAG_TIMEOUT);
0399: Timeouts.initDefault("ComponentOperator.WaitComponentTimeout",
0400: WAIT_COMPONENT_TIMEOUT);
0401: Timeouts.initDefault(
0402: "ComponentOperator.WaitComponentEnabledTimeout",
0403: WAIT_COMPONENT_ENABLED_TIMEOUT);
0404: Timeouts.initDefault("ComponentOperator.WaitStateTimeout",
0405: WAIT_STATE_TIMEOUT);
0406: Timeouts.initDefault("ComponentOperator.WaitFocusTimeout",
0407: WAIT_FOCUS_TIMEOUT);
0408: }
0409:
0410: /**
0411: * Returns component.
0412: */
0413: public Component getSource() {
0414: return (source);
0415: }
0416:
0417: /**
0418: * Returnes org.netbeans.jemmy.EventDispatcher instance which is
0419: * used to dispatch events.
0420: * @return the dispatcher.
0421: * @see org.netbeans.jemmy.EventDispatcher
0422: */
0423: public EventDispatcher getEventDispatcher() {
0424: return (dispatcher);
0425: }
0426:
0427: ////////////////////////////////////////////////////////
0428: //Environment //
0429: ////////////////////////////////////////////////////////
0430:
0431: public void setOutput(TestOut out) {
0432: super .setOutput(out);
0433: this .output = out;
0434: if (dispatcher != null) {
0435: dispatcher.setOutput(output.createErrorOutput());
0436: }
0437: }
0438:
0439: public TestOut getOutput() {
0440: return (output);
0441: }
0442:
0443: public void setTimeouts(Timeouts timeouts) {
0444: super .setTimeouts(timeouts);
0445: this .timeouts = timeouts;
0446: if (dispatcher != null) {
0447: dispatcher.setTimeouts(getTimeouts());
0448: }
0449: }
0450:
0451: public Timeouts getTimeouts() {
0452: return (timeouts);
0453: }
0454:
0455: public void copyEnvironment(Operator anotherOperator) {
0456: super .copyEnvironment(anotherOperator);
0457: kDriver = (KeyDriver) DriverManager.getDriver(
0458: DriverManager.KEY_DRIVER_ID, getClass(),
0459: anotherOperator.getProperties());
0460: mDriver = (MouseDriver) DriverManager.getDriver(
0461: DriverManager.MOUSE_DRIVER_ID, getClass(),
0462: anotherOperator.getProperties());
0463: }
0464:
0465: ////////////////////////////////////////////////////////
0466: //Mouse operations
0467: ////////////////////////////////////////////////////////
0468:
0469: /**
0470: * Makes mouse click.
0471: * @param x Horizontal click coordinate
0472: * @param y Vertical click coordinate
0473: * @param clickCount Click count
0474: * @param mouseButton Mouse button (InputEvent.BUTTON1/2/3_MASK value)
0475: * @param modifiers Modifiers (combination of InputEvent.*_MASK values)
0476: * @param forPopup signals that click is intended to call popup.
0477: */
0478: public void clickMouse(final int x, final int y,
0479: final int clickCount, final int mouseButton,
0480: final int modifiers, final boolean forPopup) {
0481: getQueueTool().invokeSmoothly(
0482: new QueueTool.QueueAction("Path selecting") {
0483: public Object launch() {
0484: mDriver
0485: .clickMouse(
0486: ComponentOperator.this ,
0487: x,
0488: y,
0489: clickCount,
0490: mouseButton,
0491: modifiers,
0492: timeouts
0493: .create("ComponentOperator.MouseClickTimeout"));
0494: return (null);
0495: }
0496: });
0497: }
0498:
0499: /**
0500: * Makes mouse click.
0501: * @param x Horizontal click coordinate
0502: * @param y Vertical click coordinate
0503: * @param clickCount Click count
0504: * @param mouseButton Mouse button (InputEvent.BUTTON1/2/3_MASK value)
0505: * @param modifiers Modifiers (combination of InputEvent.*_MASK values)
0506: * @see #clickMouse(int, int, int, int, int, boolean)
0507: */
0508: public void clickMouse(int x, int y, int clickCount,
0509: int mouseButton, int modifiers) {
0510: clickMouse(x, y, clickCount, mouseButton, modifiers, false);
0511: }
0512:
0513: /**
0514: * Makes mouse click with 0 modifiers.
0515: * @param x Horizontal click coordinate
0516: * @param y Vertical click coordinate
0517: * @param clickCount Click count
0518: * @param mouseButton Mouse button (InputEvent.BUTTON1/2/3_MASK value)
0519: * @see #clickMouse(int, int, int, int, int)
0520: */
0521: public void clickMouse(int x, int y, int clickCount, int mouseButton) {
0522: clickMouse(x, y, clickCount, mouseButton, 0);
0523: }
0524:
0525: /**
0526: * Makes mouse click by default mouse button with 0 modifiers.
0527: * @param x Horizontal click coordinate
0528: * @param y Vertical click coordinate
0529: * @param clickCount Click count
0530: * @see #clickMouse(int, int, int, int)
0531: * @see #getDefaultMouseButton()
0532: */
0533: public void clickMouse(int x, int y, int clickCount) {
0534: clickMouse(x, y, clickCount, getDefaultMouseButton());
0535: }
0536:
0537: /**
0538: * Press mouse.
0539: * @param x Horizontal click coordinate
0540: * @param y Vertical click coordinate
0541: */
0542: public void pressMouse(int x, int y) {
0543: mDriver.pressMouse(this , x, y, getDefaultMouseButton(), 0);
0544: }
0545:
0546: /**
0547: * Releases mouse.
0548: * @param x Horizontal click coordinate
0549: * @param y Vertical click coordinate
0550: */
0551: public void releaseMouse(int x, int y) {
0552: mDriver.releaseMouse(this , x, y, getDefaultMouseButton(), 0);
0553: }
0554:
0555: /**
0556: * Move mouse over the component.
0557: * @param x Horisontal destination coordinate.
0558: * @param y Vertical destination coordinate.
0559: */
0560: public void moveMouse(int x, int y) {
0561: mDriver.moveMouse(this , x, y);
0562: }
0563:
0564: /**
0565: * Drag mouse over the component.
0566: * @param x Horisontal destination coordinate.
0567: * @param y Vertical destination coordinate.
0568: * @param mouseButton Mouse button
0569: * @param modifiers Modifiers
0570: */
0571: public void dragMouse(int x, int y, int mouseButton, int modifiers) {
0572: mDriver.dragMouse(this , x, y, getDefaultMouseButton(), 0);
0573: }
0574:
0575: /**
0576: * Drag mouse over the component with 0 modifiers.
0577: * @param x Horisontal destination coordinate.
0578: * @param y Vertical destination coordinate.
0579: * @param mouseButton Mouse button
0580: * @see #dragMouse(int, int, int, int)
0581: */
0582: public void dragMouse(int x, int y, int mouseButton) {
0583: dragMouse(x, y, mouseButton, 0);
0584: }
0585:
0586: /**
0587: * Drag mouse over the component with 0 modifiers and default mose button pressed.
0588: * @param x Horisontal destination coordinate.
0589: * @param y Vertical destination coordinate.
0590: * @see #dragMouse(int, int, int)
0591: * @see #getDefaultMouseButton()
0592: */
0593: public void dragMouse(int x, int y) {
0594: dragMouse(x, y, getDefaultMouseButton());
0595: }
0596:
0597: /**
0598: * Makes drag'n'drop operation.
0599: * @param start_x Start horizontal coordinate
0600: * @param start_y Start vertical coordinate
0601: * @param end_x End horizontal coordinate
0602: * @param end_y End vertical coordinate
0603: * @param mouseButton Mouse button
0604: * @param modifiers Modifiers
0605: */
0606: public void dragNDrop(int start_x, int start_y, int end_x,
0607: int end_y, int mouseButton, int modifiers) {
0608: mDriver.dragNDrop(this , start_x, start_y, end_x, end_y,
0609: mouseButton, modifiers, timeouts
0610: .create("ComponentOperator.BeforeDragTimeout"),
0611: timeouts.create("ComponentOperator.AfterDragTimeout"));
0612: }
0613:
0614: /**
0615: * Makes drag'n'drop operation with 0 modifiers.
0616: * @param start_x Start horizontal coordinate
0617: * @param start_y Start vertical coordinate
0618: * @param end_x End horizontal coordinate
0619: * @param end_y End vertical coordinate
0620: * @param mouseButton Mouse button
0621: * @see #dragNDrop(int, int, int, int, int, int)
0622: */
0623: public void dragNDrop(int start_x, int start_y, int end_x,
0624: int end_y, int mouseButton) {
0625: dragNDrop(start_x, start_y, end_x, end_y, mouseButton, 0);
0626: }
0627:
0628: /**
0629: * Makes drag'n'drop operation by default mouse buttons with 0 modifiers.
0630: * @param start_x Start horizontal coordinate
0631: * @param start_y Start vertical coordinate
0632: * @param end_x End horizontal coordinate
0633: * @param end_y End vertical coordinate
0634: * @see #dragNDrop(int, int, int, int, int)
0635: * @see #getDefaultMouseButton()
0636: */
0637: public void dragNDrop(int start_x, int start_y, int end_x, int end_y) {
0638: dragNDrop(start_x, start_y, end_x, end_y,
0639: getDefaultMouseButton(), 0);
0640: }
0641:
0642: /**
0643: * Clicks for popup.
0644: * @param x Horizontal click coordinate.
0645: * @param y Vertical click coordinate.
0646: * @param mouseButton Mouse button.
0647: * @see #clickMouse(int, int, int, int, int, boolean)
0648: */
0649: public void clickForPopup(int x, int y, int mouseButton) {
0650: makeComponentVisible();
0651: clickMouse(x, y, 1, mouseButton, 0, true);
0652: }
0653:
0654: /**
0655: * Clicks for popup by popup mouse button.
0656: * @param x Horizontal click coordinate.
0657: * @param y Vertical click coordinate.
0658: * @see #clickForPopup(int, int, int)
0659: * @see #getPopupMouseButton()
0660: */
0661: public void clickForPopup(int x, int y) {
0662: clickForPopup(x, y, getPopupMouseButton());
0663: }
0664:
0665: /**
0666: * Makes mouse click on the component center with 0 modifiers.
0667: * @param clickCount Click count
0668: * @param mouseButton Mouse button (InputEvent.BUTTON1/2/3_MASK value)
0669: * @see #clickMouse(int, int, int, int)
0670: */
0671: public void clickMouse(final int clickCount, final int mouseButton) {
0672: getQueueTool().invokeSmoothly(
0673: new QueueTool.QueueAction("Choise expanding") {
0674: public Object launch() {
0675: clickMouse(getCenterXForClick(),
0676: getCenterYForClick(), clickCount,
0677: mouseButton);
0678: return (null);
0679: }
0680: });
0681: }
0682:
0683: /**
0684: * Makes mouse click on the component center by default mouse button with 0 modifiers.
0685: * @param clickCount Click count
0686: * @see #clickMouse(int, int)
0687: * @see #getDefaultMouseButton()
0688: */
0689: public void clickMouse(int clickCount) {
0690: clickMouse(clickCount, getDefaultMouseButton());
0691: }
0692:
0693: /**
0694: * Makes siple mouse click on the component center by default mouse button with 0 modifiers.
0695: * @see #clickMouse(int)
0696: * @see #getDefaultMouseButton()
0697: */
0698: public void clickMouse() {
0699: clickMouse(1);
0700: }
0701:
0702: /**
0703: * Move mouse inside the component.
0704: */
0705: public void enterMouse() {
0706: mDriver.enterMouse(this );
0707: }
0708:
0709: /**
0710: * Move mouse outside the component.
0711: */
0712: public void exitMouse() {
0713: mDriver.exitMouse(this );
0714: }
0715:
0716: /**
0717: * Press mouse.
0718: */
0719: public void pressMouse() {
0720: getQueueTool().invokeSmoothly(
0721: new QueueTool.QueueAction("Choise expanding") {
0722: public Object launch() {
0723: pressMouse(getCenterXForClick(),
0724: getCenterYForClick());
0725: return (null);
0726: }
0727: });
0728: }
0729:
0730: /**
0731: * Releases mouse.
0732: */
0733: public void releaseMouse() {
0734: getQueueTool().invokeSmoothly(
0735: new QueueTool.QueueAction("Choise expanding") {
0736: public Object launch() {
0737: releaseMouse(getCenterXForClick(),
0738: getCenterYForClick());
0739: return (null);
0740: }
0741: });
0742: }
0743:
0744: /**
0745: * Clicks for popup at the component center.
0746: * @param mouseButton Mouse button.
0747: * @see #clickForPopup(int, int)
0748: */
0749: public void clickForPopup(int mouseButton) {
0750: clickForPopup(getCenterXForClick(), getCenterYForClick(),
0751: mouseButton);
0752: }
0753:
0754: /**
0755: * Clicks for popup by popup mouse button at the component center.
0756: * @see #clickForPopup(int)
0757: * @see #getPopupMouseButton()
0758: */
0759: public void clickForPopup() {
0760: clickForPopup(getPopupMouseButton());
0761: }
0762:
0763: ////////////////////////////////////////////////////////
0764: //Keyboard operations
0765: ////////////////////////////////////////////////////////
0766:
0767: /**
0768: * Press key.
0769: * @param keyCode Key code (KeyEvent.VK_* value)
0770: * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
0771: */
0772: public void pressKey(int keyCode, int modifiers) {
0773: kDriver.pressKey(this , keyCode, modifiers);
0774: }
0775:
0776: /**
0777: * Press key with no modifiers.
0778: * @param keyCode Key code (KeyEvent.VK_* value)
0779: */
0780: public void pressKey(int keyCode) {
0781: pressKey(keyCode, 0);
0782: }
0783:
0784: /**
0785: * Releases key.
0786: * @param keyCode Key code (KeyEvent.VK_* value)
0787: * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
0788: */
0789: public void releaseKey(int keyCode, int modifiers) {
0790: kDriver.releaseKey(this , keyCode, modifiers);
0791: }
0792:
0793: /**
0794: * Releases key with no modifiers.
0795: * @param keyCode Key code (KeyEvent.VK_* value)
0796: */
0797: public void releaseKey(int keyCode) {
0798: releaseKey(keyCode, 0);
0799: }
0800:
0801: /**
0802: * Pushs key.
0803: * @param keyCode Key code (KeyEvent.VK_* value)
0804: * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
0805: */
0806: public void pushKey(int keyCode, int modifiers) {
0807: kDriver.pushKey(this , keyCode, modifiers, timeouts
0808: .create("ComponentOperator.PushKeyTimeout"));
0809: }
0810:
0811: /**
0812: * Pushs key.
0813: * @param keyCode Key code (KeyEvent.VK_* value)
0814: */
0815: public void pushKey(int keyCode) {
0816: pushKey(keyCode, 0);
0817: }
0818:
0819: /**
0820: * Types one char.
0821: * @param keyCode Key code (KeyEvent.VK_* value)
0822: * @param keyChar Char to be typed.
0823: * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
0824: */
0825: public void typeKey(int keyCode, char keyChar, int modifiers) {
0826: kDriver.typeKey(this , keyCode, keyChar, modifiers, timeouts
0827: .create("ComponentOperator.PushKeyTimeout"));
0828: }
0829:
0830: /**
0831: * Types one char.
0832: * Uses map defined by setCharBindingMap(CharBindingMap) method to find a key should be pressed.
0833: * @param keyChar Char to be typed.
0834: * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
0835: * @see org.netbeans.jemmy.CharBindingMap
0836: * @see #setCharBindingMap(CharBindingMap)
0837: * @see #typeKey(int, char, int)
0838: */
0839: public void typeKey(char keyChar, int modifiers) {
0840: typeKey(getCharKey(keyChar), keyChar, modifiers
0841: | getCharModifiers(keyChar));
0842: }
0843:
0844: /**
0845: * Types one char.
0846: * Uses map defined by setCharBindingMap(CharBindingMap) method
0847: * to find a key and modifiers should be pressed.
0848: * @param keyChar Char to be typed.
0849: * @see #setCharBindingMap(CharBindingMap)
0850: * @see #typeKey(char, int)
0851: */
0852: public void typeKey(char keyChar) {
0853: typeKey(keyChar, 0);
0854: }
0855:
0856: ////////////////////////////////////////////////////////
0857: //Util
0858: ////////////////////////////////////////////////////////
0859:
0860: /**
0861: * Activates component's window.
0862: * @deprecated Use makeComponentVisible() instead.
0863: * @see #makeComponentVisible()
0864: */
0865: public void activateWindow() {
0866: getVisualizer().makeVisible((ComponentOperator) this );
0867: }
0868:
0869: /**
0870: * Prepares component for user input.
0871: * Uses visualizer defined by setVisualiser() method.
0872: */
0873: public void makeComponentVisible() {
0874: getVisualizer().makeVisible((ComponentOperator) this );
0875: /*
0876: final ComponentOperator compOper = (ComponentOperator)this;
0877: runMapping(new MapVoidAction("add") {
0878: public void map() {
0879: getVisualizer().makeVisible(compOper);
0880: }
0881: });
0882: */
0883: }
0884:
0885: /**
0886: * Gives inout focud to the component.
0887: */
0888: public void getFocus() {
0889: fDriver.giveFocus(this );
0890: }
0891:
0892: /**
0893: * Return the center x coordinate.
0894: * @return the center x coordinate.
0895: */
0896: public int getCenterX() {
0897: return (getWidth() / 2);
0898: }
0899:
0900: /**
0901: * Return the center y coordinate.
0902: * @return the center y coordinate.
0903: */
0904: public int getCenterY() {
0905: return (getHeight() / 2);
0906: }
0907:
0908: /**
0909: * Return the x coordinate which should be used
0910: * for mouse operations by default.
0911: * @return the center x coordinate of the visible component part.
0912: */
0913: public int getCenterXForClick() {
0914: return (getCenterX());
0915: }
0916:
0917: /**
0918: * Return the y coordinate which should be used
0919: * for mouse operations by default.
0920: * @return the center y coordinate of the visible component part.
0921: */
0922: public int getCenterYForClick() {
0923: return (getCenterY());
0924: }
0925:
0926: /**
0927: * Waits for the component to be enabled.
0928: * @throws TimeoutExpiredException
0929: * @throws InterruptedException
0930: */
0931: public void waitComponentEnabled() throws InterruptedException {
0932: Waiter waiter = new Waiter(new Waitable() {
0933: public Object actionProduced(Object obj) {
0934: if (((Component) obj).isEnabled()) {
0935: return (obj);
0936: } else {
0937: return (null);
0938: }
0939: }
0940:
0941: public String getDescription() {
0942: return ("Component enabled: " + getSource().getClass()
0943: .toString());
0944: }
0945: });
0946: waiter.setOutput(output);
0947: Timeouts times = timeouts.cloneThis();
0948: times
0949: .setTimeout(
0950: "Waiter.WaitingTime",
0951: times
0952: .getTimeout("ComponentOperator.WaitComponentEnabledTimeout"));
0953: waiter.setTimeouts(times);
0954: waiter.waitAction(getSource());
0955: }
0956:
0957: /**
0958: * Waits for the component to be enabled.
0959: * per request: 37831
0960: * @throws TimeoutExpiredException
0961: */
0962: public void wtComponentEnabled() {
0963: try {
0964: waitComponentEnabled();
0965: } catch (InterruptedException e) {
0966: throw (new JemmyException("Interrupted!", e));
0967: }
0968: }
0969:
0970: /**
0971: * Returns an array of containers for this component.
0972: * @return an array of containers
0973: */
0974: public Container[] getContainers() {
0975: int counter = 0;
0976: Container cont = getSource().getParent();
0977: if (cont == null) {
0978: return (new Container[0]);
0979: }
0980: do {
0981: counter++;
0982: } while ((cont = cont.getParent()) != null);
0983: Container[] res = new Container[counter];
0984: cont = getSource().getParent();
0985: counter = 0;
0986: do {
0987: counter++;
0988: res[counter - 1] = cont;
0989: } while ((cont = cont.getParent()) != null);
0990: return (res);
0991: }
0992:
0993: /**
0994: * Searches a container.
0995: * @param chooser a chooser specifying the searching criteria.
0996: * @return a containers specified by searching criteria.
0997: */
0998: public Container getContainer(ComponentChooser chooser) {
0999: int counter = 0;
1000: Container cont = getSource().getParent();
1001: if (cont == null) {
1002: return (null);
1003: }
1004: do {
1005: if (chooser.checkComponent(cont)) {
1006: return (cont);
1007: }
1008: counter++;
1009: } while ((cont = cont.getParent()) != null);
1010: return (null);
1011: }
1012:
1013: /**
1014: * Searches the window under component.
1015: * @return the component window.
1016: */
1017: public Window getWindow() {
1018: if (getSource() instanceof Window) {
1019: return ((Window) getSource());
1020: }
1021: Window window = (Window) getContainer(new ComponentChooser() {
1022: public boolean checkComponent(Component comp) {
1023: return (comp instanceof Window);
1024: }
1025:
1026: public String getDescription() {
1027: return ("");
1028: }
1029: });
1030: if (window == null && getSource() instanceof Window) {
1031: return ((Window) getSource());
1032: } else {
1033: return (window);
1034: }
1035: }
1036:
1037: /**
1038: * Waits for this Component has the keyboard focus.
1039: * @throws TimeoutExpiredException
1040: */
1041: public void waitHasFocus() {
1042: Timeouts times = timeouts.cloneThis();
1043: times.setTimeout("Waiter.WaitingTime", times
1044: .getTimeout("ComponentOperator.WaitFocusTimeout"));
1045: Waiter focusWaiter = new Waiter(new Waitable() {
1046: public Object actionProduced(Object obj) {
1047: return (hasFocus() ? "" : null);
1048: }
1049:
1050: public String getDescription() {
1051: return ("Wait component has focus");
1052: }
1053: });
1054: focusWaiter.setTimeouts(times);
1055: focusWaiter.setOutput(output.createErrorOutput());
1056: try {
1057: focusWaiter.waitAction(null);
1058: } catch (InterruptedException e) {
1059: output.printStackTrace(e);
1060: }
1061: }
1062:
1063: /**
1064: * Waits for the component to be visible or unvisible.
1065: * @param visibility required visiblity.
1066: * @throws TimeoutExpiredException
1067: */
1068: public void waitComponentVisible(final boolean visibility) {
1069: waitState(new ComponentChooser() {
1070: public boolean checkComponent(Component comp) {
1071: return (isVisible() == visibility);
1072: }
1073:
1074: public String getDescription() {
1075: return ("Component is " + (visibility ? "" : " not ") + "visible");
1076: }
1077: });
1078: }
1079:
1080: public void waitComponentShowing(final boolean visibility) {
1081: waitState(new ComponentChooser() {
1082: public boolean checkComponent(Component comp) {
1083: return (isShowing() == visibility);
1084: }
1085:
1086: public String getDescription() {
1087: return ("Component is " + (visibility ? "" : " not ") + "showing");
1088: }
1089: });
1090: }
1091:
1092: /**
1093: * Returns information about component.
1094: */
1095: public Hashtable getDump() {
1096: Hashtable result = super .getDump();
1097: if (getSource().getName() != null) {
1098: result.put(NAME_DPROP, getSource().getName());
1099: }
1100: result.put(IS_VISIBLE_DPROP, getSource().isVisible() ? "true"
1101: : "false");
1102: result.put(IS_SHOWING_DPROP, getSource().isShowing() ? "true"
1103: : "false");
1104: result.put(X_DPROP, Integer.toString(getSource().getX()));
1105: result.put(Y_DPROP, Integer.toString(getSource().getY()));
1106: result.put(WIDTH_DPROP, Integer
1107: .toString(getSource().getWidth()));
1108: result.put(HEIGHT_DPROP, Integer.toString(getSource()
1109: .getHeight()));
1110: return (result);
1111: }
1112:
1113: ////////////////////////////////////////////////////////
1114: //Mapping //
1115:
1116: /**Maps <code>Component.add(PopupMenu)</code> through queue*/
1117: public void add(final PopupMenu popupMenu) {
1118: runMapping(new MapVoidAction("add") {
1119: public void map() {
1120: ((Component) getSource()).add(popupMenu);
1121: }
1122: });
1123: }
1124:
1125: /**Maps <code>Component.addComponentListener(ComponentListener)</code> through queue*/
1126: public void addComponentListener(
1127: final ComponentListener componentListener) {
1128: runMapping(new MapVoidAction("addComponentListener") {
1129: public void map() {
1130: ((Component) getSource())
1131: .addComponentListener(componentListener);
1132: }
1133: });
1134: }
1135:
1136: /**Maps <code>Component.addFocusListener(FocusListener)</code> through queue*/
1137: public void addFocusListener(final FocusListener focusListener) {
1138: runMapping(new MapVoidAction("addFocusListener") {
1139: public void map() {
1140: ((Component) getSource())
1141: .addFocusListener(focusListener);
1142: }
1143: });
1144: }
1145:
1146: /**Maps <code>Component.addInputMethodListener(InputMethodListener)</code> through queue*/
1147: public void addInputMethodListener(
1148: final InputMethodListener inputMethodListener) {
1149: runMapping(new MapVoidAction("addInputMethodListener") {
1150: public void map() {
1151: ((Component) getSource())
1152: .addInputMethodListener(inputMethodListener);
1153: }
1154: });
1155: }
1156:
1157: /**Maps <code>Component.addKeyListener(KeyListener)</code> through queue*/
1158: public void addKeyListener(final KeyListener keyListener) {
1159: runMapping(new MapVoidAction("addKeyListener") {
1160: public void map() {
1161: ((Component) getSource()).addKeyListener(keyListener);
1162: }
1163: });
1164: }
1165:
1166: /**Maps <code>Component.addMouseListener(MouseListener)</code> through queue*/
1167: public void addMouseListener(final MouseListener mouseListener) {
1168: runMapping(new MapVoidAction("addMouseListener") {
1169: public void map() {
1170: ((Component) getSource())
1171: .addMouseListener(mouseListener);
1172: }
1173: });
1174: }
1175:
1176: /**Maps <code>Component.addMouseMotionListener(MouseMotionListener)</code> through queue*/
1177: public void addMouseMotionListener(
1178: final MouseMotionListener mouseMotionListener) {
1179: runMapping(new MapVoidAction("addMouseMotionListener") {
1180: public void map() {
1181: ((Component) getSource())
1182: .addMouseMotionListener(mouseMotionListener);
1183: }
1184: });
1185: }
1186:
1187: /**Maps <code>Component.addNotify()</code> through queue*/
1188: public void addNotify() {
1189: runMapping(new MapVoidAction("addNotify") {
1190: public void map() {
1191: ((Component) getSource()).addNotify();
1192: }
1193: });
1194: }
1195:
1196: /**Maps <code>Component.addPropertyChangeListener(PropertyChangeListener)</code> through queue*/
1197: public void addPropertyChangeListener(
1198: final PropertyChangeListener propertyChangeListener) {
1199: runMapping(new MapVoidAction("addPropertyChangeListener") {
1200: public void map() {
1201: ((Component) getSource())
1202: .addPropertyChangeListener(propertyChangeListener);
1203: }
1204: });
1205: }
1206:
1207: /**Maps <code>Component.addPropertyChangeListener(String, PropertyChangeListener)</code> through queue*/
1208: public void addPropertyChangeListener(final String string,
1209: final PropertyChangeListener propertyChangeListener) {
1210: runMapping(new MapVoidAction("addPropertyChangeListener") {
1211: public void map() {
1212: ((Component) getSource()).addPropertyChangeListener(
1213: string, propertyChangeListener);
1214: }
1215: });
1216: }
1217:
1218: /**Maps <code>Component.checkImage(Image, int, int, ImageObserver)</code> through queue*/
1219: public int checkImage(final Image image, final int i, final int i1,
1220: final ImageObserver imageObserver) {
1221: return (runMapping(new MapIntegerAction("checkImage") {
1222: public int map() {
1223: return (((Component) getSource()).checkImage(image, i,
1224: i1, imageObserver));
1225: }
1226: }));
1227: }
1228:
1229: /**Maps <code>Component.checkImage(Image, ImageObserver)</code> through queue*/
1230: public int checkImage(final Image image,
1231: final ImageObserver imageObserver) {
1232: return (runMapping(new MapIntegerAction("checkImage") {
1233: public int map() {
1234: return (((Component) getSource()).checkImage(image,
1235: imageObserver));
1236: }
1237: }));
1238: }
1239:
1240: /**Maps <code>Component.contains(int, int)</code> through queue*/
1241: public boolean contains(final int i, final int i1) {
1242: return (runMapping(new MapBooleanAction("contains") {
1243: public boolean map() {
1244: return (((Component) getSource()).contains(i, i1));
1245: }
1246: }));
1247: }
1248:
1249: /**Maps <code>Component.contains(Point)</code> through queue*/
1250: public boolean contains(final Point point) {
1251: return (runMapping(new MapBooleanAction("contains") {
1252: public boolean map() {
1253: return (((Component) getSource()).contains(point));
1254: }
1255: }));
1256: }
1257:
1258: /**Maps <code>Component.createImage(int, int)</code> through queue*/
1259: public Image createImage(final int i, final int i1) {
1260: return ((Image) runMapping(new MapAction("createImage") {
1261: public Object map() {
1262: return (((Component) getSource()).createImage(i, i1));
1263: }
1264: }));
1265: }
1266:
1267: /**Maps <code>Component.createImage(ImageProducer)</code> through queue*/
1268: public Image createImage(final ImageProducer imageProducer) {
1269: return ((Image) runMapping(new MapAction("createImage") {
1270: public Object map() {
1271: return (((Component) getSource())
1272: .createImage(imageProducer));
1273: }
1274: }));
1275: }
1276:
1277: /**Maps <code>Component.dispatchEvent(AWTEvent)</code> through queue*/
1278: public void dispatchEvent(final AWTEvent aWTEvent) {
1279: runMapping(new MapVoidAction("dispatchEvent") {
1280: public void map() {
1281: ((Component) getSource()).dispatchEvent(aWTEvent);
1282: }
1283: });
1284: }
1285:
1286: /**Maps <code>Component.doLayout()</code> through queue*/
1287: public void doLayout() {
1288: runMapping(new MapVoidAction("doLayout") {
1289: public void map() {
1290: ((Component) getSource()).doLayout();
1291: }
1292: });
1293: }
1294:
1295: /**Maps <code>Component.enableInputMethods(boolean)</code> through queue*/
1296: public void enableInputMethods(final boolean b) {
1297: runMapping(new MapVoidAction("enableInputMethods") {
1298: public void map() {
1299: ((Component) getSource()).enableInputMethods(b);
1300: }
1301: });
1302: }
1303:
1304: /**Maps <code>Component.getAlignmentX()</code> through queue*/
1305: public float getAlignmentX() {
1306: return (runMapping(new MapFloatAction("getAlignmentX") {
1307: public float map() {
1308: return (((Component) getSource()).getAlignmentX());
1309: }
1310: }));
1311: }
1312:
1313: /**Maps <code>Component.getAlignmentY()</code> through queue*/
1314: public float getAlignmentY() {
1315: return (runMapping(new MapFloatAction("getAlignmentY") {
1316: public float map() {
1317: return (((Component) getSource()).getAlignmentY());
1318: }
1319: }));
1320: }
1321:
1322: /**Maps <code>Component.getBackground()</code> through queue*/
1323: public Color getBackground() {
1324: return ((Color) runMapping(new MapAction("getBackground") {
1325: public Object map() {
1326: return (((Component) getSource()).getBackground());
1327: }
1328: }));
1329: }
1330:
1331: /**Maps <code>Component.getBounds()</code> through queue*/
1332: public Rectangle getBounds() {
1333: return ((Rectangle) runMapping(new MapAction("getBounds") {
1334: public Object map() {
1335: return (((Component) getSource()).getBounds());
1336: }
1337: }));
1338: }
1339:
1340: /**Maps <code>Component.getBounds(Rectangle)</code> through queue*/
1341: public Rectangle getBounds(final Rectangle rectangle) {
1342: return ((Rectangle) runMapping(new MapAction("getBounds") {
1343: public Object map() {
1344: return (((Component) getSource()).getBounds(rectangle));
1345: }
1346: }));
1347: }
1348:
1349: /**Maps <code>Component.getColorModel()</code> through queue*/
1350: public ColorModel getColorModel() {
1351: return ((ColorModel) runMapping(new MapAction("getColorModel") {
1352: public Object map() {
1353: return (((Component) getSource()).getColorModel());
1354: }
1355: }));
1356: }
1357:
1358: /**Maps <code>Component.getComponentAt(int, int)</code> through queue*/
1359: public Component getComponentAt(final int i, final int i1) {
1360: return ((Component) runMapping(new MapAction("getComponentAt") {
1361: public Object map() {
1362: return (((Component) getSource()).getComponentAt(i, i1));
1363: }
1364: }));
1365: }
1366:
1367: /**Maps <code>Component.getComponentAt(Point)</code> through queue*/
1368: public Component getComponentAt(final Point point) {
1369: return ((Component) runMapping(new MapAction("getComponentAt") {
1370: public Object map() {
1371: return (((Component) getSource()).getComponentAt(point));
1372: }
1373: }));
1374: }
1375:
1376: /**Maps <code>Component.getComponentOrientation()</code> through queue*/
1377: public ComponentOrientation getComponentOrientation() {
1378: return ((ComponentOrientation) runMapping(new MapAction(
1379: "getComponentOrientation") {
1380: public Object map() {
1381: return (((Component) getSource())
1382: .getComponentOrientation());
1383: }
1384: }));
1385: }
1386:
1387: /**Maps <code>Component.getCursor()</code> through queue*/
1388: public Cursor getCursor() {
1389: return ((Cursor) runMapping(new MapAction("getCursor") {
1390: public Object map() {
1391: return (((Component) getSource()).getCursor());
1392: }
1393: }));
1394: }
1395:
1396: /**Maps <code>Component.getDropTarget()</code> through queue*/
1397: public DropTarget getDropTarget() {
1398: return ((DropTarget) runMapping(new MapAction("getDropTarget") {
1399: public Object map() {
1400: return (((Component) getSource()).getDropTarget());
1401: }
1402: }));
1403: }
1404:
1405: /**Maps <code>Component.getFont()</code> through queue*/
1406: public Font getFont() {
1407: return ((Font) runMapping(new MapAction("getFont") {
1408: public Object map() {
1409: return (((Component) getSource()).getFont());
1410: }
1411: }));
1412: }
1413:
1414: /**Maps <code>Component.getFontMetrics(Font)</code> through queue*/
1415: public FontMetrics getFontMetrics(final Font font) {
1416: return ((FontMetrics) runMapping(new MapAction("getFontMetrics") {
1417: public Object map() {
1418: return (((Component) getSource()).getFontMetrics(font));
1419: }
1420: }));
1421: }
1422:
1423: /**Maps <code>Component.getForeground()</code> through queue*/
1424: public Color getForeground() {
1425: return ((Color) runMapping(new MapAction("getForeground") {
1426: public Object map() {
1427: return (((Component) getSource()).getForeground());
1428: }
1429: }));
1430: }
1431:
1432: /**Maps <code>Component.getGraphics()</code> through queue*/
1433: public Graphics getGraphics() {
1434: return ((Graphics) runMapping(new MapAction("getGraphics") {
1435: public Object map() {
1436: return (((Component) getSource()).getGraphics());
1437: }
1438: }));
1439: }
1440:
1441: /**Maps <code>Component.getHeight()</code> through queue*/
1442: public int getHeight() {
1443: return (runMapping(new MapIntegerAction("getHeight") {
1444: public int map() {
1445: return (((Component) getSource()).getHeight());
1446: }
1447: }));
1448: }
1449:
1450: /**Maps <code>Component.getInputContext()</code> through queue*/
1451: public InputContext getInputContext() {
1452: return ((InputContext) runMapping(new MapAction(
1453: "getInputContext") {
1454: public Object map() {
1455: return (((Component) getSource()).getInputContext());
1456: }
1457: }));
1458: }
1459:
1460: /**Maps <code>Component.getInputMethodRequests()</code> through queue*/
1461: public InputMethodRequests getInputMethodRequests() {
1462: return ((InputMethodRequests) runMapping(new MapAction(
1463: "getInputMethodRequests") {
1464: public Object map() {
1465: return (((Component) getSource())
1466: .getInputMethodRequests());
1467: }
1468: }));
1469: }
1470:
1471: /**Maps <code>Component.getLocale()</code> through queue*/
1472: public Locale getLocale() {
1473: return ((Locale) runMapping(new MapAction("getLocale") {
1474: public Object map() {
1475: return (((Component) getSource()).getLocale());
1476: }
1477: }));
1478: }
1479:
1480: /**Maps <code>Component.getLocation()</code> through queue*/
1481: public Point getLocation() {
1482: return ((Point) runMapping(new MapAction("getLocation") {
1483: public Object map() {
1484: return (((Component) getSource()).getLocation());
1485: }
1486: }));
1487: }
1488:
1489: /**Maps <code>Component.getLocation(Point)</code> through queue*/
1490: public Point getLocation(final Point point) {
1491: return ((Point) runMapping(new MapAction("getLocation") {
1492: public Object map() {
1493: return (((Component) getSource()).getLocation(point));
1494: }
1495: }));
1496: }
1497:
1498: /**Maps <code>Component.getLocationOnScreen()</code> through queue*/
1499: public Point getLocationOnScreen() {
1500: return ((Point) runMapping(new MapAction("getLocationOnScreen") {
1501: public Object map() {
1502: return (((Component) getSource()).getLocationOnScreen());
1503: }
1504: }));
1505: }
1506:
1507: /**Maps <code>Component.getMaximumSize()</code> through queue*/
1508: public Dimension getMaximumSize() {
1509: return ((Dimension) runMapping(new MapAction("getMaximumSize") {
1510: public Object map() {
1511: return (((Component) getSource()).getMaximumSize());
1512: }
1513: }));
1514: }
1515:
1516: /**Maps <code>Component.getMinimumSize()</code> through queue*/
1517: public Dimension getMinimumSize() {
1518: return ((Dimension) runMapping(new MapAction("getMinimumSize") {
1519: public Object map() {
1520: return (((Component) getSource()).getMinimumSize());
1521: }
1522: }));
1523: }
1524:
1525: /**Maps <code>Component.getName()</code> through queue*/
1526: public String getName() {
1527: return ((String) runMapping(new MapAction("getName") {
1528: public Object map() {
1529: return (((Component) getSource()).getName());
1530: }
1531: }));
1532: }
1533:
1534: /**Maps <code>Component.getParent()</code> through queue*/
1535: public Container getParent() {
1536: return ((Container) runMapping(new MapAction("getParent") {
1537: public Object map() {
1538: return (((Component) getSource()).getParent());
1539: }
1540: }));
1541: }
1542:
1543: /**Maps <code>Component.getPreferredSize()</code> through queue*/
1544: public Dimension getPreferredSize() {
1545: return ((Dimension) runMapping(new MapAction("getPreferredSize") {
1546: public Object map() {
1547: return (((Component) getSource()).getPreferredSize());
1548: }
1549: }));
1550: }
1551:
1552: /**Maps <code>Component.getSize()</code> through queue*/
1553: public Dimension getSize() {
1554: return ((Dimension) runMapping(new MapAction("getSize") {
1555: public Object map() {
1556: return (((Component) getSource()).getSize());
1557: }
1558: }));
1559: }
1560:
1561: /**Maps <code>Component.getSize(Dimension)</code> through queue*/
1562: public Dimension getSize(final Dimension dimension) {
1563: return ((Dimension) runMapping(new MapAction("getSize") {
1564: public Object map() {
1565: return (((Component) getSource()).getSize(dimension));
1566: }
1567: }));
1568: }
1569:
1570: /**Maps <code>Component.getToolkit()</code> through queue*/
1571: public Toolkit getToolkit() {
1572: return ((Toolkit) runMapping(new MapAction("getToolkit") {
1573: public Object map() {
1574: return (((Component) getSource()).getToolkit());
1575: }
1576: }));
1577: }
1578:
1579: /**Maps <code>Component.getTreeLock()</code> through queue*/
1580: public Object getTreeLock() {
1581: return ((Object) runMapping(new MapAction("getTreeLock") {
1582: public Object map() {
1583: return (((Component) getSource()).getTreeLock());
1584: }
1585: }));
1586: }
1587:
1588: /**Maps <code>Component.getWidth()</code> through queue*/
1589: public int getWidth() {
1590: return (runMapping(new MapIntegerAction("getWidth") {
1591: public int map() {
1592: return (((Component) getSource()).getWidth());
1593: }
1594: }));
1595: }
1596:
1597: /**Maps <code>Component.getX()</code> through queue*/
1598: public int getX() {
1599: return (runMapping(new MapIntegerAction("getX") {
1600: public int map() {
1601: return (((Component) getSource()).getX());
1602: }
1603: }));
1604: }
1605:
1606: /**Maps <code>Component.getY()</code> through queue*/
1607: public int getY() {
1608: return (runMapping(new MapIntegerAction("getY") {
1609: public int map() {
1610: return (((Component) getSource()).getY());
1611: }
1612: }));
1613: }
1614:
1615: /**Maps <code>Component.hasFocus()</code> through queue*/
1616: public boolean hasFocus() {
1617: return (runMapping(new MapBooleanAction("hasFocus") {
1618: public boolean map() {
1619: return (((Component) getSource()).hasFocus());
1620: }
1621: }));
1622: }
1623:
1624: /**Maps <code>Component.imageUpdate(Image, int, int, int, int, int)</code> through queue*/
1625: public boolean imageUpdate(final Image image, final int i,
1626: final int i1, final int i2, final int i3, final int i4) {
1627: return (runMapping(new MapBooleanAction("imageUpdate") {
1628: public boolean map() {
1629: return (((Component) getSource()).imageUpdate(image, i,
1630: i1, i2, i3, i4));
1631: }
1632: }));
1633: }
1634:
1635: /**Maps <code>Component.invalidate()</code> through queue*/
1636: public void invalidate() {
1637: runMapping(new MapVoidAction("invalidate") {
1638: public void map() {
1639: ((Component) getSource()).invalidate();
1640: }
1641: });
1642: }
1643:
1644: /**Maps <code>Component.isDisplayable()</code> through queue*/
1645: public boolean isDisplayable() {
1646: return (runMapping(new MapBooleanAction("isDisplayable") {
1647: public boolean map() {
1648: return (((Component) getSource()).isDisplayable());
1649: }
1650: }));
1651: }
1652:
1653: /**Maps <code>Component.isDoubleBuffered()</code> through queue*/
1654: public boolean isDoubleBuffered() {
1655: return (runMapping(new MapBooleanAction("isDoubleBuffered") {
1656: public boolean map() {
1657: return (((Component) getSource()).isDoubleBuffered());
1658: }
1659: }));
1660: }
1661:
1662: /**Maps <code>Component.isEnabled()</code> through queue*/
1663: public boolean isEnabled() {
1664: return (runMapping(new MapBooleanAction("isEnabled") {
1665: public boolean map() {
1666: return (((Component) getSource()).isEnabled());
1667: }
1668: }));
1669: }
1670:
1671: /**Maps <code>Component.isFocusTraversable()</code> through queue*/
1672: public boolean isFocusTraversable() {
1673: return (runMapping(new MapBooleanAction("isFocusTraversable") {
1674: public boolean map() {
1675: return (((Component) getSource()).isFocusTraversable());
1676: }
1677: }));
1678: }
1679:
1680: /**Maps <code>Component.isLightweight()</code> through queue*/
1681: public boolean isLightweight() {
1682: return (runMapping(new MapBooleanAction("isLightweight") {
1683: public boolean map() {
1684: return (((Component) getSource()).isLightweight());
1685: }
1686: }));
1687: }
1688:
1689: /**Maps <code>Component.isOpaque()</code> through queue*/
1690: public boolean isOpaque() {
1691: return (runMapping(new MapBooleanAction("isOpaque") {
1692: public boolean map() {
1693: return (((Component) getSource()).isOpaque());
1694: }
1695: }));
1696: }
1697:
1698: /**Maps <code>Component.isShowing()</code> through queue*/
1699: public boolean isShowing() {
1700: return (runMapping(new MapBooleanAction("isShowing") {
1701: public boolean map() {
1702: return (((Component) getSource()).isShowing());
1703: }
1704: }));
1705: }
1706:
1707: /**Maps <code>Component.isValid()</code> through queue*/
1708: public boolean isValid() {
1709: return (runMapping(new MapBooleanAction("isValid") {
1710: public boolean map() {
1711: return (((Component) getSource()).isValid());
1712: }
1713: }));
1714: }
1715:
1716: /**Maps <code>Component.isVisible()</code> through queue*/
1717: public boolean isVisible() {
1718: return (runMapping(new MapBooleanAction("isVisible") {
1719: public boolean map() {
1720: return (((Component) getSource()).isVisible());
1721: }
1722: }));
1723: }
1724:
1725: /**Maps <code>Component.list()</code> through queue*/
1726: public void list() {
1727: runMapping(new MapVoidAction("list") {
1728: public void map() {
1729: ((Component) getSource()).list();
1730: }
1731: });
1732: }
1733:
1734: /**Maps <code>Component.list(PrintStream)</code> through queue*/
1735: public void list(final PrintStream printStream) {
1736: runMapping(new MapVoidAction("list") {
1737: public void map() {
1738: ((Component) getSource()).list(printStream);
1739: }
1740: });
1741: }
1742:
1743: /**Maps <code>Component.list(PrintStream, int)</code> through queue*/
1744: public void list(final PrintStream printStream, final int i) {
1745: runMapping(new MapVoidAction("list") {
1746: public void map() {
1747: ((Component) getSource()).list(printStream, i);
1748: }
1749: });
1750: }
1751:
1752: /**Maps <code>Component.list(PrintWriter)</code> through queue*/
1753: public void list(final PrintWriter printWriter) {
1754: runMapping(new MapVoidAction("list") {
1755: public void map() {
1756: ((Component) getSource()).list(printWriter);
1757: }
1758: });
1759: }
1760:
1761: /**Maps <code>Component.list(PrintWriter, int)</code> through queue*/
1762: public void list(final PrintWriter printWriter, final int i) {
1763: runMapping(new MapVoidAction("list") {
1764: public void map() {
1765: ((Component) getSource()).list(printWriter, i);
1766: }
1767: });
1768: }
1769:
1770: /**Maps <code>Component.paint(Graphics)</code> through queue*/
1771: public void paint(final Graphics graphics) {
1772: runMapping(new MapVoidAction("paint") {
1773: public void map() {
1774: ((Component) getSource()).paint(graphics);
1775: }
1776: });
1777: }
1778:
1779: /**Maps <code>Component.paintAll(Graphics)</code> through queue*/
1780: public void paintAll(final Graphics graphics) {
1781: runMapping(new MapVoidAction("paintAll") {
1782: public void map() {
1783: ((Component) getSource()).paintAll(graphics);
1784: }
1785: });
1786: }
1787:
1788: /**Maps <code>Component.prepareImage(Image, int, int, ImageObserver)</code> through queue*/
1789: public boolean prepareImage(final Image image, final int i,
1790: final int i1, final ImageObserver imageObserver) {
1791: return (runMapping(new MapBooleanAction("prepareImage") {
1792: public boolean map() {
1793: return (((Component) getSource()).prepareImage(image,
1794: i, i1, imageObserver));
1795: }
1796: }));
1797: }
1798:
1799: /**Maps <code>Component.prepareImage(Image, ImageObserver)</code> through queue*/
1800: public boolean prepareImage(final Image image,
1801: final ImageObserver imageObserver) {
1802: return (runMapping(new MapBooleanAction("prepareImage") {
1803: public boolean map() {
1804: return (((Component) getSource()).prepareImage(image,
1805: imageObserver));
1806: }
1807: }));
1808: }
1809:
1810: /**Maps <code>Component.print(Graphics)</code> through queue*/
1811: public void print(final Graphics graphics) {
1812: runMapping(new MapVoidAction("print") {
1813: public void map() {
1814: ((Component) getSource()).print(graphics);
1815: }
1816: });
1817: }
1818:
1819: /**Maps <code>Component.printAll(Graphics)</code> through queue*/
1820: public void printAll(final Graphics graphics) {
1821: runMapping(new MapVoidAction("printAll") {
1822: public void map() {
1823: ((Component) getSource()).printAll(graphics);
1824: }
1825: });
1826: }
1827:
1828: /**Maps <code>Component.remove(MenuComponent)</code> through queue*/
1829: public void remove(final MenuComponent menuComponent) {
1830: runMapping(new MapVoidAction("remove") {
1831: public void map() {
1832: ((Component) getSource()).remove(menuComponent);
1833: }
1834: });
1835: }
1836:
1837: /**Maps <code>Component.removeComponentListener(ComponentListener)</code> through queue*/
1838: public void removeComponentListener(
1839: final ComponentListener componentListener) {
1840: runMapping(new MapVoidAction("removeComponentListener") {
1841: public void map() {
1842: ((Component) getSource())
1843: .removeComponentListener(componentListener);
1844: }
1845: });
1846: }
1847:
1848: /**Maps <code>Component.removeFocusListener(FocusListener)</code> through queue*/
1849: public void removeFocusListener(final FocusListener focusListener) {
1850: runMapping(new MapVoidAction("removeFocusListener") {
1851: public void map() {
1852: ((Component) getSource())
1853: .removeFocusListener(focusListener);
1854: }
1855: });
1856: }
1857:
1858: /**Maps <code>Component.removeInputMethodListener(InputMethodListener)</code> through queue*/
1859: public void removeInputMethodListener(
1860: final InputMethodListener inputMethodListener) {
1861: runMapping(new MapVoidAction("removeInputMethodListener") {
1862: public void map() {
1863: ((Component) getSource())
1864: .removeInputMethodListener(inputMethodListener);
1865: }
1866: });
1867: }
1868:
1869: /**Maps <code>Component.removeKeyListener(KeyListener)</code> through queue*/
1870: public void removeKeyListener(final KeyListener keyListener) {
1871: runMapping(new MapVoidAction("removeKeyListener") {
1872: public void map() {
1873: ((Component) getSource())
1874: .removeKeyListener(keyListener);
1875: }
1876: });
1877: }
1878:
1879: /**Maps <code>Component.removeMouseListener(MouseListener)</code> through queue*/
1880: public void removeMouseListener(final MouseListener mouseListener) {
1881: runMapping(new MapVoidAction("removeMouseListener") {
1882: public void map() {
1883: ((Component) getSource())
1884: .removeMouseListener(mouseListener);
1885: }
1886: });
1887: }
1888:
1889: /**Maps <code>Component.removeMouseMotionListener(MouseMotionListener)</code> through queue*/
1890: public void removeMouseMotionListener(
1891: final MouseMotionListener mouseMotionListener) {
1892: runMapping(new MapVoidAction("removeMouseMotionListener") {
1893: public void map() {
1894: ((Component) getSource())
1895: .removeMouseMotionListener(mouseMotionListener);
1896: }
1897: });
1898: }
1899:
1900: /**Maps <code>Component.removeNotify()</code> through queue*/
1901: public void removeNotify() {
1902: runMapping(new MapVoidAction("removeNotify") {
1903: public void map() {
1904: ((Component) getSource()).removeNotify();
1905: }
1906: });
1907: }
1908:
1909: /**Maps <code>Component.removePropertyChangeListener(PropertyChangeListener)</code> through queue*/
1910: public void removePropertyChangeListener(
1911: final PropertyChangeListener propertyChangeListener) {
1912: runMapping(new MapVoidAction("removePropertyChangeListener") {
1913: public void map() {
1914: ((Component) getSource())
1915: .removePropertyChangeListener(propertyChangeListener);
1916: }
1917: });
1918: }
1919:
1920: /**Maps <code>Component.removePropertyChangeListener(String, PropertyChangeListener)</code> through queue*/
1921: public void removePropertyChangeListener(final String string,
1922: final PropertyChangeListener propertyChangeListener) {
1923: runMapping(new MapVoidAction("removePropertyChangeListener") {
1924: public void map() {
1925: ((Component) getSource()).removePropertyChangeListener(
1926: string, propertyChangeListener);
1927: }
1928: });
1929: }
1930:
1931: /**Maps <code>Component.repaint()</code> through queue*/
1932: public void repaint() {
1933: runMapping(new MapVoidAction("repaint") {
1934: public void map() {
1935: ((Component) getSource()).repaint();
1936: }
1937: });
1938: }
1939:
1940: /**Maps <code>Component.repaint(int, int, int, int)</code> through queue*/
1941: public void repaint(final int i, final int i1, final int i2,
1942: final int i3) {
1943: runMapping(new MapVoidAction("repaint") {
1944: public void map() {
1945: ((Component) getSource()).repaint(i, i1, i2, i3);
1946: }
1947: });
1948: }
1949:
1950: /**Maps <code>Component.repaint(long)</code> through queue*/
1951: public void repaint(final long l) {
1952: runMapping(new MapVoidAction("repaint") {
1953: public void map() {
1954: ((Component) getSource()).repaint(l);
1955: }
1956: });
1957: }
1958:
1959: /**Maps <code>Component.repaint(long, int, int, int, int)</code> through queue*/
1960: public void repaint(final long l, final int i, final int i1,
1961: final int i2, final int i3) {
1962: runMapping(new MapVoidAction("repaint") {
1963: public void map() {
1964: ((Component) getSource()).repaint(l, i, i1, i2, i3);
1965: }
1966: });
1967: }
1968:
1969: /**Maps <code>Component.requestFocus()</code> through queue*/
1970: public void requestFocus() {
1971: runMapping(new MapVoidAction("requestFocus") {
1972: public void map() {
1973: ((Component) getSource()).requestFocus();
1974: }
1975: });
1976: }
1977:
1978: /**Maps <code>Component.setBackground(Color)</code> through queue*/
1979: public void setBackground(final Color color) {
1980: runMapping(new MapVoidAction("setBackground") {
1981: public void map() {
1982: ((Component) getSource()).setBackground(color);
1983: }
1984: });
1985: }
1986:
1987: /**Maps <code>Component.setBounds(int, int, int, int)</code> through queue*/
1988: public void setBounds(final int i, final int i1, final int i2,
1989: final int i3) {
1990: runMapping(new MapVoidAction("setBounds") {
1991: public void map() {
1992: ((Component) getSource()).setBounds(i, i1, i2, i3);
1993: }
1994: });
1995: }
1996:
1997: /**Maps <code>Component.setBounds(Rectangle)</code> through queue*/
1998: public void setBounds(final Rectangle rectangle) {
1999: runMapping(new MapVoidAction("setBounds") {
2000: public void map() {
2001: ((Component) getSource()).setBounds(rectangle);
2002: }
2003: });
2004: }
2005:
2006: /**Maps <code>Component.setComponentOrientation(ComponentOrientation)</code> through queue*/
2007: public void setComponentOrientation(
2008: final ComponentOrientation componentOrientation) {
2009: runMapping(new MapVoidAction("setComponentOrientation") {
2010: public void map() {
2011: ((Component) getSource())
2012: .setComponentOrientation(componentOrientation);
2013: }
2014: });
2015: }
2016:
2017: /**Maps <code>Component.setCursor(Cursor)</code> through queue*/
2018: public void setCursor(final Cursor cursor) {
2019: runMapping(new MapVoidAction("setCursor") {
2020: public void map() {
2021: ((Component) getSource()).setCursor(cursor);
2022: }
2023: });
2024: }
2025:
2026: /**Maps <code>Component.setDropTarget(DropTarget)</code> through queue*/
2027: public void setDropTarget(final DropTarget dropTarget) {
2028: runMapping(new MapVoidAction("setDropTarget") {
2029: public void map() {
2030: ((Component) getSource()).setDropTarget(dropTarget);
2031: }
2032: });
2033: }
2034:
2035: /**Maps <code>Component.setEnabled(boolean)</code> through queue*/
2036: public void setEnabled(final boolean b) {
2037: runMapping(new MapVoidAction("setEnabled") {
2038: public void map() {
2039: ((Component) getSource()).setEnabled(b);
2040: }
2041: });
2042: }
2043:
2044: /**Maps <code>Component.setFont(Font)</code> through queue*/
2045: public void setFont(final Font font) {
2046: runMapping(new MapVoidAction("setFont") {
2047: public void map() {
2048: ((Component) getSource()).setFont(font);
2049: }
2050: });
2051: }
2052:
2053: /**Maps <code>Component.setForeground(Color)</code> through queue*/
2054: public void setForeground(final Color color) {
2055: runMapping(new MapVoidAction("setForeground") {
2056: public void map() {
2057: ((Component) getSource()).setForeground(color);
2058: }
2059: });
2060: }
2061:
2062: /**Maps <code>Component.setLocale(Locale)</code> through queue*/
2063: public void setLocale(final Locale locale) {
2064: runMapping(new MapVoidAction("setLocale") {
2065: public void map() {
2066: ((Component) getSource()).setLocale(locale);
2067: }
2068: });
2069: }
2070:
2071: /**Maps <code>Component.setLocation(int, int)</code> through queue*/
2072: public void setLocation(final int i, final int i1) {
2073: runMapping(new MapVoidAction("setLocation") {
2074: public void map() {
2075: ((Component) getSource()).setLocation(i, i1);
2076: }
2077: });
2078: }
2079:
2080: /**Maps <code>Component.setLocation(Point)</code> through queue*/
2081: public void setLocation(final Point point) {
2082: runMapping(new MapVoidAction("setLocation") {
2083: public void map() {
2084: ((Component) getSource()).setLocation(point);
2085: }
2086: });
2087: }
2088:
2089: /**Maps <code>Component.setName(String)</code> through queue*/
2090: public void setName(final String string) {
2091: runMapping(new MapVoidAction("setName") {
2092: public void map() {
2093: ((Component) getSource()).setName(string);
2094: }
2095: });
2096: }
2097:
2098: /**Maps <code>Component.setSize(int, int)</code> through queue*/
2099: public void setSize(final int i, final int i1) {
2100: runMapping(new MapVoidAction("setSize") {
2101: public void map() {
2102: ((Component) getSource()).setSize(i, i1);
2103: }
2104: });
2105: }
2106:
2107: /**Maps <code>Component.setSize(Dimension)</code> through queue*/
2108: public void setSize(final Dimension dimension) {
2109: runMapping(new MapVoidAction("setSize") {
2110: public void map() {
2111: ((Component) getSource()).setSize(dimension);
2112: }
2113: });
2114: }
2115:
2116: /**Maps <code>Component.setVisible(boolean)</code> through queue*/
2117: public void setVisible(final boolean b) {
2118: runMapping(new MapVoidAction("setVisible") {
2119: public void map() {
2120: ((Component) getSource()).setVisible(b);
2121: }
2122: });
2123: }
2124:
2125: /**Maps <code>Component.transferFocus()</code> through queue*/
2126: public void transferFocus() {
2127: runMapping(new MapVoidAction("transferFocus") {
2128: public void map() {
2129: ((Component) getSource()).transferFocus();
2130: }
2131: });
2132: }
2133:
2134: /**Maps <code>Component.update(Graphics)</code> through queue*/
2135: public void update(final Graphics graphics) {
2136: runMapping(new MapVoidAction("update") {
2137: public void map() {
2138: ((Component) getSource()).update(graphics);
2139: }
2140: });
2141: }
2142:
2143: /**Maps <code>Component.validate()</code> through queue*/
2144: public void validate() {
2145: runMapping(new MapVoidAction("validate") {
2146: public void map() {
2147: ((Component) getSource()).validate();
2148: }
2149: });
2150: }
2151:
2152: //End of mapping //
2153: ////////////////////////////////////////////////////////
2154:
2155: private void setEventDispatcher(EventDispatcher dispatcher) {
2156: dispatcher.setOutput(getOutput().createErrorOutput());
2157: dispatcher.setTimeouts(getTimeouts());
2158: this .dispatcher = dispatcher;
2159: }
2160:
2161: static class VisibleComponentFinder implements ComponentChooser {
2162: ComponentChooser subFinder;
2163:
2164: public VisibleComponentFinder(ComponentChooser sf) {
2165: subFinder = sf;
2166: }
2167:
2168: public boolean checkComponent(Component comp) {
2169: if (comp.isShowing()) {
2170: return (subFinder.checkComponent(comp));
2171: }
2172: return (false);
2173: }
2174:
2175: public String getDescription() {
2176: return (subFinder.getDescription());
2177: }
2178: }
2179:
2180: }
|