1 /*
   2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation. Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package org.netbeans.jemmy.operators;
  26 
  27 import java.awt.AWTEvent;
  28 import java.awt.Color;
  29 import java.awt.Component;
  30 import java.awt.ComponentOrientation;
  31 import java.awt.Container;
  32 import java.awt.Cursor;
  33 import java.awt.Dimension;
  34 import java.awt.Font;
  35 import java.awt.FontMetrics;
  36 import java.awt.Graphics;
  37 import java.awt.Image;
  38 import java.awt.MenuComponent;
  39 import java.awt.Point;
  40 import java.awt.PopupMenu;
  41 import java.awt.Rectangle;
  42 import java.awt.Toolkit;
  43 import java.awt.Window;
  44 import java.awt.dnd.DropTarget;
  45 import java.awt.event.ComponentListener;
  46 import java.awt.event.FocusListener;
  47 import java.awt.event.InputMethodListener;
  48 import java.awt.event.KeyListener;
  49 import java.awt.event.MouseListener;
  50 import java.awt.event.MouseMotionListener;
  51 import java.awt.im.InputContext;
  52 import java.awt.im.InputMethodRequests;
  53 import java.awt.image.ColorModel;
  54 import java.awt.image.ImageObserver;
  55 import java.awt.image.ImageProducer;
  56 import java.beans.PropertyChangeListener;
  57 import java.io.PrintStream;
  58 import java.io.PrintWriter;
  59 import java.util.Hashtable;
  60 import java.util.Locale;
  61 
  62 import org.netbeans.jemmy.CharBindingMap;
  63 import org.netbeans.jemmy.ComponentChooser;
  64 import org.netbeans.jemmy.ComponentSearcher;
  65 import org.netbeans.jemmy.EventDispatcher;
  66 import org.netbeans.jemmy.JemmyException;
  67 import org.netbeans.jemmy.JemmyProperties;
  68 import org.netbeans.jemmy.Outputable;
  69 import org.netbeans.jemmy.QueueTool;
  70 import org.netbeans.jemmy.TestOut;
  71 import org.netbeans.jemmy.TimeoutExpiredException;
  72 import org.netbeans.jemmy.Timeoutable;
  73 import org.netbeans.jemmy.Timeouts;
  74 import org.netbeans.jemmy.Waitable;
  75 import org.netbeans.jemmy.Waiter;
  76 import org.netbeans.jemmy.drivers.DriverManager;
  77 import org.netbeans.jemmy.drivers.FocusDriver;
  78 import org.netbeans.jemmy.drivers.KeyDriver;
  79 import org.netbeans.jemmy.drivers.MouseDriver;
  80 
  81 /**
  82  * Root class for all component operators.
  83  *
  84  * Provides basic methods to operate with mouse and keyboard.<BR>
  85  * <BR>
  86  * Almost all input methods can throw JemmyInputException or its subclass.<BR>
  87  *
  88  * ComponentOperator and its subclasses has a lot of methods which name and
  89  * parameters just like consistent component has. In this case operator class
  90  * just invokes consistent component method through AWT Event Queue
  91  * (invokeAndWait method).
  92  *
  93  * <BR><BR>Timeouts used: <BR>
  94  * ComponentOperator.PushKeyTimeout - time between key pressing and releasing
  95  * <BR>
  96  * ComponentOperator.MouseClickTimeout - time between mouse pressing and
  97  * releasing <BR>
  98  * ComponentOperator.WaitComponentTimeout - time to wait component displayed
  99  * <BR>
 100  * ComponentOperator.WaitComponentEnabledTimeout - time to wait component
 101  * enabled <BR>
 102  * ComponentOperator.BeforeDragTimeout - time to sleep before grag'n'drop
 103  * operations <BR>
 104  * ComponentOperator.AfterDragTimeout - time to sleep after grag'n'drop
 105  * operations <BR>
 106  * ComponentOperator.WaitFocusTimeout - time to wait component focus <BR>
 107  * ComponentOperator.WaitStateTimeout- time to wait component to be in some
 108  * state. Typically used from methods like
 109  * {@code Operator.wait"something happened"(*)}<br>.
 110  *
 111  * @see org.netbeans.jemmy.Timeouts
 112  *
 113  * @author Alexandre Iline (alexandre.iline@oracle.com)
 114  */
 115 public class ComponentOperator extends Operator
 116         implements Timeoutable, Outputable {
 117 
 118     /**
 119      * Identifier for a name property.
 120      *
 121      * @see #getDump
 122      */
 123     public static final String NAME_DPROP = "Name:";
 124 
 125     /**
 126      * Identifier for a visible property.
 127      *
 128      * @see #getDump
 129      */
 130     public static final String IS_VISIBLE_DPROP = "Visible";
 131 
 132     /**
 133      * Identifier for a showing property.
 134      *
 135      * @see #getDump
 136      */
 137     public static final String IS_SHOWING_DPROP = "Showing";
 138 
 139     /**
 140      * Identifier for a x coordinate property.
 141      *
 142      * @see #getDump
 143      */
 144     public static final String X_DPROP = "X";
 145 
 146     /**
 147      * Identifier for a y coordinate property.
 148      *
 149      * @see #getDump
 150      */
 151     public static final String Y_DPROP = "Y";
 152 
 153     /**
 154      * Identifier for a width property.
 155      *
 156      * @see #getDump
 157      */
 158     public static final String WIDTH_DPROP = "Width";
 159 
 160     /**
 161      * Identifier for a height property.
 162      *
 163      * @see #getDump
 164      */
 165     public static final String HEIGHT_DPROP = "Height";
 166 
 167     private static final long PUSH_KEY_TIMEOUT = 0;
 168     private static final long MOUSE_CLICK_TIMEOUT = 0;
 169     private static final long BEFORE_DRAG_TIMEOUT = 0;
 170     private static final long AFTER_DRAG_TIMEOUT = 0;
 171     private static final long WAIT_COMPONENT_TIMEOUT = 60000;
 172     private static final long WAIT_COMPONENT_ENABLED_TIMEOUT = 60000;
 173     private static final long WAIT_FOCUS_TIMEOUT = 60000;
 174     private static final long WAIT_STATE_TIMEOUT = 60000;
 175 
 176     private final Component source;
 177     private volatile Timeouts timeouts; // used in invokeSmoothly in clickMouse
 178     private volatile TestOut output; // used in QueueTool.Locker
 179     private volatile EventDispatcher dispatcher; // used in JInternalFrameByTitleFinder.checkComponent
 180     private KeyDriver kDriver;
 181     private MouseDriver mDriver;
 182     private FocusDriver fDriver;
 183 
 184     /**
 185      * Constructor.
 186      *
 187      * @param comp a component
 188      */
 189     public ComponentOperator(Component comp) {
 190         super();
 191         source = comp;
 192         kDriver = DriverManager.getKeyDriver(getClass());
 193         mDriver = DriverManager.getMouseDriver(getClass());
 194         fDriver = DriverManager.getFocusDriver(getClass());
 195         setEventDispatcher(new EventDispatcher(comp));
 196     }
 197 
 198     /**
 199      * Constructs a ComponentOperator object.
 200      *
 201      * @param cont container
 202      * @param chooser a component chooser specifying searching criteria.
 203      * @param index an index between appropriate ones.
 204      */
 205     public ComponentOperator(ContainerOperator<?> cont, ComponentChooser chooser, int index) {
 206         this(waitComponent((Container) cont.getSource(),
 207                 chooser,
 208                 index, cont.getTimeouts(), cont.getOutput()));
 209         copyEnvironment(cont);
 210     }
 211 
 212     /**
 213      * Constructs a ComponentOperator object.
 214      *
 215      * @param cont container
 216      * @param chooser a component chooser specifying searching criteria.
 217      */
 218     public ComponentOperator(ContainerOperator<?> cont, ComponentChooser chooser) {
 219         this(cont, chooser, 0);
 220     }
 221 
 222     /**
 223      * Constructor. Waits for a component in a container to show. The component
 224      * is iis the {@code index+1}'th {@code java.awt.Component} that
 225      * shows and that lies below the container in the display containment
 226      * hierarchy. Uses cont's timeout and output for waiting and to init
 227      * operator.
 228      *
 229      * @param cont Operator for a java.awt.Container.
 230      * @param index an index between appropriate ones.
 231      * @throws TimeoutExpiredException
 232      */
 233     public ComponentOperator(ContainerOperator<?> cont, int index) {
 234         this(cont, ComponentSearcher.getTrueChooser("Any component"), index);
 235     }
 236 
 237     /**
 238      * Constructor. Waits for a component in a container to show. The component
 239      * is is the first {@code java.awt.Component} that shows and that lies
 240      * below the container in the display containment hierarchy. Uses cont's
 241      * timeout and output for waiting and to init operator.
 242      *
 243      * @param cont Operator for a java.awt.Container.
 244      * @throws TimeoutExpiredException
 245      */
 246     public ComponentOperator(ContainerOperator<?> cont) {
 247         this(cont, 0);
 248     }
 249 
 250     /**
 251      * Searches Component in container.
 252      *
 253      * @param cont Container to search component in.
 254      * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
 255      * @param index Ordinal component index.
 256      * @return Component instance or null if component was not found.
 257      */
 258     public static Component findComponent(Container cont, ComponentChooser chooser, int index) {
 259         return findComponent(cont, chooser, index, false);
 260     }
 261 
 262     /**
 263      * Searches Component in container.
 264      *
 265      * @param cont Container to search component in.
 266      * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
 267      * @return Component instance or null if component was not found.
 268      */
 269     public static Component findComponent(Container cont, ComponentChooser chooser) {
 270         return findComponent(cont, chooser, 0);
 271     }
 272 
 273     /**
 274      * Waits Component in container.
 275      *
 276      * @param cont Container to search component in.
 277      * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
 278      * @param index Ordinal component index.
 279      * @return Component instance or null if component was not found.
 280      * @throws TimeoutExpiredException
 281      */
 282     public static Component waitComponent(Container cont, ComponentChooser chooser, int index) {
 283         return (waitComponent(cont, chooser, index,
 284                 JemmyProperties.getCurrentTimeouts(),
 285                 JemmyProperties.getCurrentOutput()));
 286     }
 287 
 288     /**
 289      * Waits Component in container.
 290      *
 291      * @param cont Container to search component in.
 292      * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
 293      * @return Component instance or null if component was not found.
 294      * @throws TimeoutExpiredException
 295      */
 296     public static Component waitComponent(Container cont, ComponentChooser chooser) {
 297         return waitComponent(cont, chooser, 0);
 298     }
 299 
 300     /**
 301      * A method to be used from subclasses. Uses {@code contOper}'s
 302      * timeouts and output during the waiting.
 303      *
 304      * @param contOper Container to search component in.
 305      * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
 306      * @param index Ordinal component index.
 307      * @return Component instance or null if component was not found.
 308      * @throws TimeoutExpiredException
 309      */
 310     protected static Component waitComponent(ContainerOperator<?> contOper,
 311             ComponentChooser chooser, int index) {
 312         return (waitComponent((Container) contOper.getSource(),
 313                 chooser, index,
 314                 contOper.getTimeouts(),
 315                 contOper.getOutput()));
 316     }
 317 
 318     /**
 319      * A method to be used from subclasses. Uses timeouts and output passed as
 320      * parameters during the waiting.
 321      *
 322      * @param cont Container to search component in.
 323      * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
 324      * @param index Ordinal component index.
 325      * @param timeouts timeouts to be used during the waiting.
 326      * @param output an output to be used during the waiting.
 327      * @return Component instance or null if component was not found.
 328      * @throws TimeoutExpiredException
 329      */
 330     protected static Component waitComponent(final Container cont,
 331             final ComponentChooser chooser,
 332             final int index,
 333             Timeouts timeouts, final TestOut output) {
 334         try {
 335             Waiter<Component, Void> waiter = new Waiter<>(new Waitable<Component, Void>() {
 336                 @Override
 337                 public Component actionProduced(Void obj) {
 338                     return findComponent(cont, new VisibleComponentFinder(chooser), index,
 339                             output.createErrorOutput());
 340                 }
 341 
 342                 @Override
 343                 public String getDescription() {
 344                     return "Wait " + chooser.getDescription() + " loaded";
 345                 }
 346 
 347                 @Override
 348                 public String toString() {
 349                     return "ComponentOperator.waitComponent.Waitable{description = " + getDescription() + '}';
 350                 }
 351             });
 352             waiter.setTimeoutsToCloneOf(timeouts, "ComponentOperator.WaitComponentTimeout");
 353             waiter.setOutput(output);
 354             return waiter.waitAction(null);
 355         } catch (InterruptedException e) {
 356             return null;
 357         }
 358     }
 359 
 360     /**
 361      * Searches Components in container.
 362      *
 363      * @param cont Container to search components in.
 364      * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
 365      * @return Component array or empty array if component was not found.
 366      */
 367     public static Component[] findComponents(Container cont, ComponentChooser chooser) {
 368         ComponentSearcher searcher = new ComponentSearcher(cont);
 369         return searcher.findComponents(new VisibleComponentFinder(chooser));
 370     }
 371 
 372     private static Component findComponent(Container cont, ComponentChooser chooser, int index, TestOut output) {
 373         ComponentSearcher searcher = new ComponentSearcher(cont);
 374         searcher.setOutput(output);
 375         return searcher.findComponent(new VisibleComponentFinder(chooser), index);
 376     }
 377 
 378     private static Component findComponent(Container cont, ComponentChooser chooser, int index, boolean supressOutout) {
 379         return findComponent(cont, chooser, index, JemmyProperties.getCurrentOutput().createErrorOutput());
 380     }
 381 
 382     static {
 383         Timeouts.initDefault("ComponentOperator.PushKeyTimeout", PUSH_KEY_TIMEOUT);
 384         Timeouts.initDefault("ComponentOperator.MouseClickTimeout", MOUSE_CLICK_TIMEOUT);
 385         Timeouts.initDefault("ComponentOperator.BeforeDragTimeout", BEFORE_DRAG_TIMEOUT);
 386         Timeouts.initDefault("ComponentOperator.AfterDragTimeout", AFTER_DRAG_TIMEOUT);
 387         Timeouts.initDefault("ComponentOperator.WaitComponentTimeout", WAIT_COMPONENT_TIMEOUT);
 388         Timeouts.initDefault("ComponentOperator.WaitComponentEnabledTimeout", WAIT_COMPONENT_ENABLED_TIMEOUT);
 389         Timeouts.initDefault("ComponentOperator.WaitStateTimeout", WAIT_STATE_TIMEOUT);
 390         Timeouts.initDefault("ComponentOperator.WaitFocusTimeout", WAIT_FOCUS_TIMEOUT);
 391     }
 392 
 393     /**
 394      * Returns component.
 395      */
 396     @Override
 397     public Component getSource() {
 398         return source;
 399     }
 400 
 401     /**
 402      * Returns org.netbeans.jemmy.EventDispatcher instance which is used to
 403      * dispatch events.
 404      *
 405      * @return the dispatcher.
 406      * @see org.netbeans.jemmy.EventDispatcher
 407      */
 408     public EventDispatcher getEventDispatcher() {
 409         return dispatcher;
 410     }
 411 
 412     ////////////////////////////////////////////////////////
 413     //Environment                                         //
 414     ////////////////////////////////////////////////////////
 415     @Override
 416     public void setOutput(TestOut out) {
 417         super.setOutput(out);
 418         this.output = out;
 419         if (dispatcher != null) {
 420             dispatcher.setOutput(output.createErrorOutput());
 421         }
 422     }
 423 
 424     @Override
 425     public TestOut getOutput() {
 426         return output;
 427     }
 428 
 429     @Override
 430     public void setTimeouts(Timeouts timeouts) {
 431         super.setTimeouts(timeouts);
 432         this.timeouts = timeouts;
 433         if (dispatcher != null) {
 434             dispatcher.setTimeouts(getTimeouts());
 435         }
 436     }
 437 
 438     @Override
 439     public Timeouts getTimeouts() {
 440         return timeouts;
 441     }
 442 
 443     @Override
 444     public void copyEnvironment(Operator anotherOperator) {
 445         super.copyEnvironment(anotherOperator);
 446         kDriver = (KeyDriver) DriverManager.
 447                 getDriver(DriverManager.KEY_DRIVER_ID,
 448                         getClass(),
 449                         anotherOperator.getProperties());
 450         mDriver = (MouseDriver) DriverManager.
 451                 getDriver(DriverManager.MOUSE_DRIVER_ID,
 452                         getClass(),
 453                         anotherOperator.getProperties());
 454         fDriver = (FocusDriver) DriverManager.
 455                 getDriver(DriverManager.FOCUS_DRIVER_ID,
 456                         getClass(),
 457                         anotherOperator.getProperties());
 458     }
 459 
 460     ////////////////////////////////////////////////////////
 461     //Mouse operations
 462     ////////////////////////////////////////////////////////
 463     /**
 464      * Makes mouse click.
 465      *
 466      * @param x Horizontal click coordinate
 467      * @param y Vertical click coordinate
 468      * @param clickCount Click count
 469      * @param mouseButton Mouse button (InputEvent.BUTTON1/2/3_MASK value)
 470      * @param modifiers Modifiers (combination of InputEvent.*_MASK values)
 471      * @param forPopup signals that click is intended to call popup.
 472      */
 473     public void clickMouse(final int x, final int y, final int clickCount, final int mouseButton,
 474             final int modifiers, final boolean forPopup) {
 475         getQueueTool().invokeSmoothly(new QueueTool.QueueAction<Void>("Path selecting") {
 476             @Override
 477             public Void launch() {
 478                 mDriver.clickMouse(ComponentOperator.this, x, y, clickCount, mouseButton, modifiers,
 479                         timeouts.create("ComponentOperator.MouseClickTimeout"));
 480                 return null;
 481             }
 482         });
 483     }
 484 
 485     /**
 486      * Makes mouse click.
 487      *
 488      * @param x Horizontal click coordinate
 489      * @param y Vertical click coordinate
 490      * @param clickCount Click count
 491      * @param mouseButton Mouse button (InputEvent.BUTTON1/2/3_MASK value)
 492      * @param modifiers Modifiers (combination of InputEvent.*_MASK values)
 493      * @see #clickMouse(int, int, int, int, int, boolean)
 494      */
 495     public void clickMouse(int x, int y, int clickCount, int mouseButton, int modifiers) {
 496         clickMouse(x, y, clickCount, mouseButton, modifiers, false);
 497     }
 498 
 499     /**
 500      * Makes mouse click with 0 modifiers.
 501      *
 502      * @param x Horizontal click coordinate
 503      * @param y Vertical click coordinate
 504      * @param clickCount Click count
 505      * @param mouseButton Mouse button (InputEvent.BUTTON1/2/3_MASK value)
 506      * @see #clickMouse(int, int, int, int, int)
 507      */
 508     public void clickMouse(int x, int y, int clickCount, int mouseButton) {
 509         clickMouse(x, y, clickCount, mouseButton, 0);
 510     }
 511 
 512     /**
 513      * Makes mouse click by default mouse button with 0 modifiers.
 514      *
 515      * @param x Horizontal click coordinate
 516      * @param y Vertical click coordinate
 517      * @param clickCount Click count
 518      * @see #clickMouse(int, int, int, int)
 519      * @see #getDefaultMouseButton()
 520      */
 521     public void clickMouse(int x, int y, int clickCount) {
 522         clickMouse(x, y, clickCount, getDefaultMouseButton());
 523     }
 524 
 525     /**
 526      * Press mouse.
 527      *
 528      * @param x Horizontal click coordinate
 529      * @param y Vertical click coordinate
 530      */
 531     public void pressMouse(int x, int y) {
 532         mDriver.pressMouse(this, x, y, getDefaultMouseButton(), 0);
 533     }
 534 
 535     /**
 536      * Releases mouse.
 537      *
 538      * @param x Horizontal click coordinate
 539      * @param y Vertical click coordinate
 540      */
 541     public void releaseMouse(int x, int y) {
 542         mDriver.releaseMouse(this, x, y, getDefaultMouseButton(), 0);
 543     }
 544 
 545     /**
 546      * Move mouse over the component.
 547      *
 548      * @param x Horisontal destination coordinate.
 549      * @param y Vertical destination coordinate.
 550      */
 551     public void moveMouse(int x, int y) {
 552         mDriver.moveMouse(this, x, y);
 553     }
 554 
 555     /**
 556      * Drag mouse over the component.
 557      *
 558      * @param x Horisontal destination coordinate.
 559      * @param y Vertical destination coordinate.
 560      * @param mouseButton Mouse button
 561      * @param modifiers Modifiers
 562      */
 563     public void dragMouse(int x, int y, int mouseButton, int modifiers) {
 564         mDriver.dragMouse(this, x, y, getDefaultMouseButton(), 0);
 565     }
 566 
 567     /**
 568      * Drag mouse over the component with 0 modifiers.
 569      *
 570      * @param x Horisontal destination coordinate.
 571      * @param y Vertical destination coordinate.
 572      * @param mouseButton Mouse button
 573      * @see #dragMouse(int, int, int, int)
 574      */
 575     public void dragMouse(int x, int y, int mouseButton) {
 576         dragMouse(x, y, mouseButton, 0);
 577     }
 578 
 579     /**
 580      * Drag mouse over the component with 0 modifiers and default mose button
 581      * pressed.
 582      *
 583      * @param x Horisontal destination coordinate.
 584      * @param y Vertical destination coordinate.
 585      * @see #dragMouse(int, int, int)
 586      * @see #getDefaultMouseButton()
 587      */
 588     public void dragMouse(int x, int y) {
 589         dragMouse(x, y, getDefaultMouseButton());
 590     }
 591 
 592     /**
 593      * Makes drag'n'drop operation.
 594      *
 595      * @param start_x Start horizontal coordinate
 596      * @param start_y Start vertical coordinate
 597      * @param end_x End horizontal coordinate
 598      * @param end_y End vertical coordinate
 599      * @param mouseButton Mouse button
 600      * @param modifiers Modifiers
 601      */
 602     public void dragNDrop(int start_x, int start_y, int end_x, int end_y, int mouseButton, int modifiers) {
 603         mDriver.dragNDrop(this, start_x, start_y, end_x, end_y, mouseButton, modifiers,
 604                 timeouts.create("ComponentOperator.BeforeDragTimeout"),
 605                 timeouts.create("ComponentOperator.AfterDragTimeout"));
 606     }
 607 
 608     /**
 609      * Makes drag'n'drop operation with 0 modifiers.
 610      *
 611      * @param start_x Start horizontal coordinate
 612      * @param start_y Start vertical coordinate
 613      * @param end_x End horizontal coordinate
 614      * @param end_y End vertical coordinate
 615      * @param mouseButton Mouse button
 616      * @see #dragNDrop(int, int, int, int, int, int)
 617      */
 618     public void dragNDrop(int start_x, int start_y, int end_x, int end_y, int mouseButton) {
 619         dragNDrop(start_x, start_y, end_x, end_y, mouseButton, 0);
 620     }
 621 
 622     /**
 623      * Makes drag'n'drop operation by default mouse buttons with 0 modifiers.
 624      *
 625      * @param start_x Start horizontal coordinate
 626      * @param start_y Start vertical coordinate
 627      * @param end_x End horizontal coordinate
 628      * @param end_y End vertical coordinate
 629      * @see #dragNDrop(int, int, int, int, int)
 630      * @see #getDefaultMouseButton()
 631      */
 632     public void dragNDrop(int start_x, int start_y, int end_x, int end_y) {
 633         dragNDrop(start_x, start_y, end_x, end_y, getDefaultMouseButton(), 0);
 634     }
 635 
 636     /**
 637      * Clicks for popup.
 638      *
 639      * @param x Horizontal click coordinate.
 640      * @param y Vertical click coordinate.
 641      * @param mouseButton Mouse button.
 642      * @see #clickMouse(int, int, int, int, int, boolean)
 643      */
 644     public void clickForPopup(int x, int y, int mouseButton) {
 645         makeComponentVisible();
 646         clickMouse(x, y, 1, mouseButton, 0, true);
 647     }
 648 
 649     /**
 650      * Clicks for popup by popup mouse button.
 651      *
 652      * @param x Horizontal click coordinate.
 653      * @param y Vertical click coordinate.
 654      * @see #clickForPopup(int, int, int)
 655      * @see #getPopupMouseButton()
 656      */
 657     public void clickForPopup(int x, int y) {
 658         clickForPopup(x, y, getPopupMouseButton());
 659     }
 660 
 661     /**
 662      * Makes mouse click on the component center with 0 modifiers.
 663      *
 664      * @param clickCount Click count
 665      * @param mouseButton Mouse button (InputEvent.BUTTON1/2/3_MASK value)
 666      * @see #clickMouse(int, int, int, int)
 667      */
 668     public void clickMouse(final int clickCount, final int mouseButton) {
 669         getQueueTool().invokeSmoothly(new QueueTool.QueueAction<Void>("Clicking the mouse button") {
 670             @Override
 671             public Void launch() {
 672                 clickMouse(getCenterXForClick(), getCenterYForClick(), clickCount, mouseButton);
 673                 return null;
 674             }
 675         });
 676     }
 677 
 678     /**
 679      * Makes mouse click on the component center by default mouse button with 0
 680      * modifiers.
 681      *
 682      * @param clickCount Click count
 683      * @see #clickMouse(int, int)
 684      * @see #getDefaultMouseButton()
 685      */
 686     public void clickMouse(int clickCount) {
 687         clickMouse(clickCount, getDefaultMouseButton());
 688     }
 689 
 690     /**
 691      * Makes siple mouse click on the component center by default mouse button
 692      * with 0 modifiers.
 693      *
 694      * @see #clickMouse(int)
 695      * @see #getDefaultMouseButton()
 696      */
 697     public void clickMouse() {
 698         clickMouse(1);
 699     }
 700 
 701     /**
 702      * Move mouse inside the component.
 703      */
 704     public void enterMouse() {
 705         mDriver.enterMouse(this);
 706     }
 707 
 708     /**
 709      * Move mouse outside the component.
 710      */
 711     public void exitMouse() {
 712         mDriver.exitMouse(this);
 713     }
 714 
 715     /**
 716      * Press mouse.
 717      */
 718     public void pressMouse() {
 719         getQueueTool().invokeSmoothly(new QueueTool.QueueAction<Void>("Pressing the mouse button") {
 720             @Override
 721             public Void launch() {
 722                 pressMouse(getCenterXForClick(), getCenterYForClick());
 723                 return null;
 724             }
 725         });
 726     }
 727 
 728     /**
 729      * Releases mouse.
 730      */
 731     public void releaseMouse() {
 732         getQueueTool().invokeSmoothly(new QueueTool.QueueAction<Void>("Releasing the mouse button") {
 733             @Override
 734             public Void launch() {
 735                 releaseMouse(getCenterXForClick(), getCenterYForClick());
 736                 return null;
 737             }
 738         });
 739     }
 740 
 741     /**
 742      * Clicks for popup at the component center.
 743      *
 744      * @param mouseButton Mouse button.
 745      * @see #clickForPopup(int, int)
 746      */
 747     public void clickForPopup(int mouseButton) {
 748         clickForPopup(getCenterXForClick(), getCenterYForClick(), mouseButton);
 749     }
 750 
 751     /**
 752      * Clicks for popup by popup mouse button at the component center.
 753      *
 754      * @see #clickForPopup(int)
 755      * @see #getPopupMouseButton()
 756      */
 757     public void clickForPopup() {
 758         clickForPopup(getPopupMouseButton());
 759     }
 760 
 761     ////////////////////////////////////////////////////////
 762     //Keyboard operations
 763     ////////////////////////////////////////////////////////
 764     /**
 765      * Press key.
 766      *
 767      * @param keyCode Key code (KeyEvent.VK_* value)
 768      * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
 769      */
 770     public void pressKey(int keyCode, int modifiers) {
 771         kDriver.pressKey(this, keyCode, modifiers);
 772     }
 773 
 774     /**
 775      * Press key with no modifiers.
 776      *
 777      * @param keyCode Key code (KeyEvent.VK_* value)
 778      */
 779     public void pressKey(int keyCode) {
 780         pressKey(keyCode, 0);
 781     }
 782 
 783     /**
 784      * Typed key.
 785      *
 786      * @param keyChar Char to be typed.
 787      * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
 788      */
 789     public void typedKey(char keyChar, int modifiers) {
 790         kDriver.typedKey(this, getCharBindingMap().getCharKey(keyChar), keyChar, modifiers);
 791     }
 792 
 793     /**
 794      * Releases key.
 795      *
 796      * @param keyCode Key code (KeyEvent.VK_* value)
 797      * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
 798      */
 799     public void releaseKey(int keyCode, int modifiers) {
 800         kDriver.releaseKey(this, keyCode, modifiers);
 801     }
 802 
 803     /**
 804      * Releases key with no modifiers.
 805      *
 806      * @param keyCode Key code (KeyEvent.VK_* value)
 807      */
 808     public void releaseKey(int keyCode) {
 809         releaseKey(keyCode, 0);
 810     }
 811 
 812     /**
 813      * Pushs key.
 814      *
 815      * @param keyCode Key code (KeyEvent.VK_* value)
 816      * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
 817      */
 818     public void pushKey(int keyCode, int modifiers) {
 819         kDriver.pushKey(this, keyCode, modifiers, timeouts.create("ComponentOperator.PushKeyTimeout"));
 820     }
 821 
 822     /**
 823      * Pushs key.
 824      *
 825      * @param keyCode Key code (KeyEvent.VK_* value)
 826      */
 827     public void pushKey(int keyCode) {
 828         pushKey(keyCode, 0);
 829     }
 830 
 831     /**
 832      * Types one char.
 833      *
 834      * @param keyCode Key code (KeyEvent.VK_* value)
 835      * @param keyChar Char to be typed.
 836      * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
 837      */
 838     public void typeKey(int keyCode, char keyChar, int modifiers) {
 839         kDriver.typeKey(this, keyCode, keyChar, modifiers, timeouts.create("ComponentOperator.PushKeyTimeout"));
 840     }
 841 
 842     /**
 843      * Types one char. Uses map defined by setCharBindingMap(CharBindingMap)
 844      * method to find a key should be pressed.
 845      *
 846      * @param keyChar Char to be typed.
 847      * @param modifiers Modifiers (combination of InputEvent.*_MASK fields)
 848      * @see org.netbeans.jemmy.CharBindingMap
 849      * @see #setCharBindingMap(CharBindingMap)
 850      * @see #typeKey(int, char, int)
 851      */
 852     public void typeKey(char keyChar, int modifiers) {
 853         typeKey(getCharKey(keyChar), keyChar, modifiers | getCharModifiers(keyChar));
 854     }
 855 
 856     /**
 857      * Types one char. Uses map defined by setCharBindingMap(CharBindingMap)
 858      * method to find a key and modifiers should be pressed.
 859      *
 860      * @param keyChar Char to be typed.
 861      * @see #setCharBindingMap(CharBindingMap)
 862      * @see #typeKey(char, int)
 863      */
 864     public void typeKey(char keyChar) {
 865         typeKey(keyChar, 0);
 866     }
 867 
 868     ////////////////////////////////////////////////////////
 869     //Util
 870     ////////////////////////////////////////////////////////
 871     /**
 872      * Activates component's window.
 873      *
 874      * @deprecated Use makeComponentVisible() instead.
 875      * @see #makeComponentVisible()
 876      */
 877     @Deprecated
 878     public void activateWindow() {
 879         getVisualizer().makeVisible(this);
 880     }
 881 
 882     /**
 883      * Prepares component for user input. Uses visualizer defined by
 884      * setVisualiser() method.
 885      */
 886     public void makeComponentVisible() {
 887         getVisualizer().makeVisible(this);
 888         /*
 889         final ComponentOperator compOper = (ComponentOperator)this;
 890         runMapping(new MapVoidAction("add") {
 891                 public void map() {
 892                     getVisualizer().makeVisible(compOper);
 893                 }
 894             });
 895          */
 896     }
 897 
 898     /**
 899      * Gives input focus to the component.
 900      */
 901     public void getFocus() {
 902         fDriver.giveFocus(this);
 903     }
 904 
 905     /**
 906      * Return the center x coordinate.
 907      *
 908      * @return the center x coordinate.
 909      */
 910     public int getCenterX() {
 911         return getWidth() / 2;
 912     }
 913 
 914     /**
 915      * Return the center y coordinate.
 916      *
 917      * @return the center y coordinate.
 918      */
 919     public int getCenterY() {
 920         return getHeight() / 2;
 921     }
 922 
 923     /**
 924      * Return the x coordinate which should be used for mouse operations by
 925      * default.
 926      *
 927      * @return the center x coordinate of the visible component part.
 928      */
 929     public int getCenterXForClick() {
 930         return getCenterX();
 931     }
 932 
 933     /**
 934      * Return the y coordinate which should be used for mouse operations by
 935      * default.
 936      *
 937      * @return the center y coordinate of the visible component part.
 938      */
 939     public int getCenterYForClick() {
 940         return getCenterY();
 941     }
 942 
 943     /**
 944      * Waits for the component to be enabled.
 945      *
 946      * @throws TimeoutExpiredException
 947      * @throws InterruptedException
 948      */
 949     public void waitComponentEnabled() throws InterruptedException {
 950         Waiter<Component, Component> waiter = new Waiter<>(new Waitable<Component, Component>() {
 951             @Override
 952             public Component actionProduced(Component obj) {
 953                 if (obj.isEnabled()) {
 954                     return obj;
 955                 } else {
 956                     return null;
 957                 }
 958             }
 959 
 960             @Override
 961             public String getDescription() {
 962                 return ("Component enabled: "
 963                         + getSource().getClass().toString());
 964             }
 965 
 966             @Override
 967             public String toString() {
 968                 return "ComponentOperator.waitComponentEnabled.Waitable{description = " + getDescription() + '}';
 969             }
 970         });
 971         waiter.setOutput(output);
 972         waiter.setTimeoutsToCloneOf(timeouts, "ComponentOperator.WaitComponentEnabledTimeout");
 973         waiter.waitAction(getSource());
 974     }
 975 
 976     /**
 977      * Waits for the component to be enabled. per request: 37831
 978      *
 979      * @throws TimeoutExpiredException
 980      */
 981     public void wtComponentEnabled() {
 982         try {
 983             waitComponentEnabled();
 984         } catch (InterruptedException e) {
 985             throw (new JemmyException("Interrupted!", e));
 986         }
 987     }
 988 
 989     /**
 990      * Returns an array of containers for this component.
 991      *
 992      * @return an array of containers
 993      */
 994     public Container[] getContainers() {
 995         int counter = 0;
 996         Container cont = getSource().getParent();
 997         if (cont == null) {
 998             return new Container[0];
 999         }
1000         do {
1001             counter++;
1002         } while ((cont = cont.getParent()) != null);
1003         Container[] res = new Container[counter];
1004         cont = getSource().getParent();
1005         counter = 0;
1006         do {
1007             counter++;
1008             res[counter - 1] = cont;
1009         } while ((cont = cont.getParent()) != null);
1010         return res;
1011     }
1012 
1013     /**
1014      * Searches a container.
1015      *
1016      * @param chooser a chooser specifying the searching criteria.
1017      * @return a containers specified by searching criteria.
1018      */
1019     public Container getContainer(ComponentChooser chooser) {
1020         int counter = 0;
1021         Container cont = getSource().getParent();
1022         if (cont == null) {
1023             return null;
1024         }
1025         do {
1026             if (chooser.checkComponent(cont)) {
1027                 return cont;
1028             }
1029             counter++;
1030         } while ((cont = cont.getParent()) != null);
1031         return null;
1032     }
1033 
1034     /**
1035      * Searches the window under component.
1036      *
1037      * @return the component window.
1038      */
1039     public Window getWindow() {
1040         if (getSource() instanceof Window) {
1041             return (Window) getSource();
1042         }
1043         Window window = (Window) getContainer(new ComponentChooser() {
1044             @Override
1045             public boolean checkComponent(Component comp) {
1046                 return comp instanceof Window;
1047             }
1048 
1049             @Override
1050             public String getDescription() {
1051                 return "";
1052             }
1053 
1054             @Override
1055             public String toString() {
1056                 return "ComponentOperator.getWindow.ComponentChooser{description = " + getDescription() + '}';
1057             }
1058         });
1059         if (window == null && getSource() instanceof Window) {
1060             return (Window) getSource();
1061         } else {
1062             return window;
1063         }
1064     }
1065 
1066     /**
1067      * Waits for this Component has the keyboard focus.
1068      *
1069      * @throws TimeoutExpiredException
1070      */
1071     public void waitHasFocus() {
1072         Waiter<String, Void> focusWaiter = new Waiter<>(new Waitable<String, Void>() {
1073             @Override
1074             public String actionProduced(Void obj) {
1075                 return hasFocus() ? "" : null;
1076             }
1077 
1078             @Override
1079             public String getDescription() {
1080                 return "Wait component has focus";
1081             }
1082 
1083             @Override
1084             public String toString() {
1085                 return "ComponentOperator.waitHasFocus.Waitable{description = " + getDescription() + '}';
1086             }
1087         });
1088         focusWaiter.setTimeoutsToCloneOf(timeouts, "ComponentOperator.WaitFocusTimeout");
1089         focusWaiter.setOutput(output.createErrorOutput());
1090         try {
1091             focusWaiter.waitAction(null);
1092         } catch (InterruptedException e) {
1093             output.printStackTrace(e);
1094         }
1095     }
1096 
1097     /**
1098      * Waits for the component to be visible or unvisible.
1099      *
1100      * @param visibility required visiblity.
1101      * @throws TimeoutExpiredException
1102      */
1103     public void waitComponentVisible(final boolean visibility) {
1104         waitState(new ComponentChooser() {
1105             @Override
1106             public boolean checkComponent(Component comp) {
1107                 return isVisible() == visibility;
1108             }
1109 
1110             @Override
1111             public String getDescription() {
1112                 return "Component is " + (visibility ? "" : " not ") + "visible";
1113             }
1114 
1115             @Override
1116             public String toString() {
1117                 return "ComponentOperator.waitComponentVisible.ComponentChooser{description = " + getDescription() + '}';
1118             }
1119         });
1120     }
1121 
1122     public void waitComponentShowing(final boolean visibility) {
1123         waitState(new ComponentChooser() {
1124             @Override
1125             public boolean checkComponent(Component comp) {
1126                 return isShowing() == visibility;
1127             }
1128 
1129             @Override
1130             public String getDescription() {
1131                 return "Component is " + (visibility ? "" : " not ") + "showing";
1132             }
1133 
1134             @Override
1135             public String toString() {
1136                 return "ComponentOperator.waitComponentShowing.ComponentChooser{description = " + getDescription() + '}';
1137             }
1138         });
1139     }
1140 
1141     /**
1142      * Wait till the Size of the component becomes as expected.
1143      *
1144      * @param exactSize the exact expected size.
1145      */
1146     public void waitComponentSize(Dimension exactSize) {
1147         waitComponentSize(exactSize, exactSize);
1148     }
1149 
1150     /**
1151      * Wait till the Size of the component becomes between minSize and maxSize.
1152      *
1153      * @param minSize the minimum allowed size.
1154      * @param maxSize the maximum allowed size.
1155      */
1156     public void waitComponentSize(Dimension minSize, Dimension maxSize) {
1157         waitState(new ComponentChooser() {
1158             @Override
1159             public boolean checkComponent(Component comp) {
1160                 Dimension componentSize = comp.getSize();
1161                 return componentSize.height >= minSize.height
1162                         && componentSize.height <= maxSize.height
1163                         && componentSize.width >= minSize.width
1164                         && componentSize.width <= maxSize.width;
1165             }
1166 
1167             @Override
1168             public String getDescription() {
1169                 return "Component Size becomes between: " + minSize
1170                         + "and " + maxSize;
1171             }
1172 
1173             @Override
1174             public String toString() {
1175                 return "ComponentOperator.waitComponentSize"
1176                         + ".Waitable{description = " + getDescription() + '}';
1177             }
1178         });
1179     }
1180 
1181     /**
1182      * Wait till the component reaches exact location.
1183      *
1184      * @param exactlocation exact expected location.
1185      */
1186     public void waitComponentLocation(Point exactlocation) {
1187         waitComponentLocation(exactlocation, exactlocation);
1188     }
1189 
1190     /**
1191      * Wait till the component reaches location between minLocation and
1192      * maxLocation
1193      *
1194      * @param minLocation minimum expected location.
1195      * @param maxLocation maximum expected location.
1196      */
1197     public void waitComponentLocation(Point minLocation, Point maxLocation) {
1198         waitState(new ComponentChooser() {
1199             @Override
1200             public boolean checkComponent(Component comp) {
1201                 Point componentLocation = comp.getLocation();
1202                 return componentLocation.x >= minLocation.x
1203                         && componentLocation.x <= maxLocation.x
1204                         && componentLocation.y >= minLocation.y
1205                         && componentLocation.y <= maxLocation.y;
1206             }
1207 
1208             @Override
1209             public String getDescription() {
1210                 return "Component reaches location between :" + minLocation
1211                         + "and " + maxLocation;
1212             }
1213 
1214             @Override
1215             public String toString() {
1216                 return "ComponentOperator.waitComponentLocation"
1217                         + ".Waitable{description = " + getDescription() + '}';
1218             }
1219         });
1220     }
1221 
1222     /**
1223      * Wait till the component reaches exact location on screen.
1224      *
1225      * @param exactLocation exact expected screen location.
1226      */
1227     public void waitComponentLocationOnScreen(Point exactlocation) {
1228         waitComponentLocationOnScreen(exactlocation, exactlocation);
1229     }
1230 
1231     /**
1232      * Wait till the component location on screen reaches between minLocation
1233      * and maxLocation
1234      *
1235      * @param minLocation minimum expected location on screen.
1236      * @param maxLocation maximum expected location on screen.
1237      */
1238     public void waitComponentLocationOnScreen(
1239             final Point minLocation, final Point maxLocation) {
1240         waitState(new ComponentChooser() {
1241             @Override
1242             public boolean checkComponent(Component comp) {
1243                 Point location = comp.getLocationOnScreen();
1244                 return location.x >= minLocation.x
1245                         && location.x <= maxLocation.x
1246                         && location.y >= minLocation.y
1247                         && location.y <= maxLocation.y;
1248             }
1249 
1250             @Override
1251             public String getDescription() {
1252                 return "Component location on screen reaches between :"
1253                         + minLocation + "and " + maxLocation;
1254             }
1255 
1256             @Override
1257             public String toString() {
1258                 return "ComponentOperator.waitComponentLocationOnScreen"
1259                         + ".Waitable{description = " + getDescription() + '}';
1260             }
1261         });
1262     }
1263 
1264     /**
1265      * Returns information about component.
1266      */
1267     @Override
1268     public Hashtable<String, Object> getDump() {
1269         Hashtable<String, Object> result = super.getDump();
1270         if (getSource().getName() != null) {
1271             result.put(NAME_DPROP, getSource().getName());
1272         }
1273         result.put(IS_VISIBLE_DPROP, getSource().isVisible() ? "true" : "false");
1274         result.put(IS_SHOWING_DPROP, getSource().isShowing() ? "true" : "false");
1275         result.put(X_DPROP, Integer.toString(getSource().getX()));
1276         result.put(Y_DPROP, Integer.toString(getSource().getY()));
1277         result.put(WIDTH_DPROP, Integer.toString(getSource().getWidth()));
1278         result.put(HEIGHT_DPROP, Integer.toString(getSource().getHeight()));
1279         return result;
1280     }
1281 
1282     ////////////////////////////////////////////////////////
1283     //Mapping                                             //
1284     /**
1285      * Maps {@code Component.add(PopupMenu)} through queue
1286      */
1287     public void add(final PopupMenu popupMenu) {
1288         runMapping(new MapVoidAction("add") {
1289             @Override
1290             public void map() {
1291                 getSource().add(popupMenu);
1292             }
1293         });
1294     }
1295 
1296     /**
1297      * Maps {@code Component.addComponentListener(ComponentListener)}
1298      * through queue
1299      */
1300     public void addComponentListener(final ComponentListener componentListener) {
1301         runMapping(new MapVoidAction("addComponentListener") {
1302             @Override
1303             public void map() {
1304                 getSource().addComponentListener(componentListener);
1305             }
1306         });
1307     }
1308 
1309     /**
1310      * Maps {@code Component.addFocusListener(FocusListener)} through queue
1311      */
1312     public void addFocusListener(final FocusListener focusListener) {
1313         runMapping(new MapVoidAction("addFocusListener") {
1314             @Override
1315             public void map() {
1316                 getSource().addFocusListener(focusListener);
1317             }
1318         });
1319     }
1320 
1321     /**
1322      * Maps {@code Component.addInputMethodListener(InputMethodListener)}
1323      * through queue
1324      */
1325     public void addInputMethodListener(final InputMethodListener inputMethodListener) {
1326         runMapping(new MapVoidAction("addInputMethodListener") {
1327             @Override
1328             public void map() {
1329                 getSource().addInputMethodListener(inputMethodListener);
1330             }
1331         });
1332     }
1333 
1334     /**
1335      * Maps {@code Component.addKeyListener(KeyListener)} through queue
1336      */
1337     public void addKeyListener(final KeyListener keyListener) {
1338         runMapping(new MapVoidAction("addKeyListener") {
1339             @Override
1340             public void map() {
1341                 getSource().addKeyListener(keyListener);
1342             }
1343         });
1344     }
1345 
1346     /**
1347      * Maps {@code Component.addMouseListener(MouseListener)} through queue
1348      */
1349     public void addMouseListener(final MouseListener mouseListener) {
1350         runMapping(new MapVoidAction("addMouseListener") {
1351             @Override
1352             public void map() {
1353                 getSource().addMouseListener(mouseListener);
1354             }
1355         });
1356     }
1357 
1358     /**
1359      * Maps {@code Component.addMouseMotionListener(MouseMotionListener)}
1360      * through queue
1361      */
1362     public void addMouseMotionListener(final MouseMotionListener mouseMotionListener) {
1363         runMapping(new MapVoidAction("addMouseMotionListener") {
1364             @Override
1365             public void map() {
1366                 getSource().addMouseMotionListener(mouseMotionListener);
1367             }
1368         });
1369     }
1370 
1371     /**
1372      * Maps {@code Component.addNotify()} through queue
1373      */
1374     public void addNotify() {
1375         runMapping(new MapVoidAction("addNotify") {
1376             @Override
1377             public void map() {
1378                 getSource().addNotify();
1379             }
1380         });
1381     }
1382 
1383     /**
1384      * Maps
1385      * {@code Component.addPropertyChangeListener(PropertyChangeListener)}
1386      * through queue
1387      */
1388     public void addPropertyChangeListener(final PropertyChangeListener propertyChangeListener) {
1389         runMapping(new MapVoidAction("addPropertyChangeListener") {
1390             @Override
1391             public void map() {
1392                 getSource().addPropertyChangeListener(propertyChangeListener);
1393             }
1394         });
1395     }
1396 
1397     /**
1398      * Maps
1399      * {@code Component.addPropertyChangeListener(String, PropertyChangeListener)}
1400      * through queue
1401      */
1402     public void addPropertyChangeListener(final String string, final PropertyChangeListener propertyChangeListener) {
1403         runMapping(new MapVoidAction("addPropertyChangeListener") {
1404             @Override
1405             public void map() {
1406                 getSource().addPropertyChangeListener(string, propertyChangeListener);
1407             }
1408         });
1409     }
1410 
1411     /**
1412      * Maps {@code Component.checkImage(Image, int, int, ImageObserver)}
1413      * through queue
1414      */
1415     public int checkImage(final Image image, final int i, final int i1, final ImageObserver imageObserver) {
1416         return (runMapping(new MapIntegerAction("checkImage") {
1417             @Override
1418             public int map() {
1419                 return getSource().checkImage(image, i, i1, imageObserver);
1420             }
1421         }));
1422     }
1423 
1424     /**
1425      * Maps {@code Component.checkImage(Image, ImageObserver)} through queue
1426      */
1427     public int checkImage(final Image image, final ImageObserver imageObserver) {
1428         return (runMapping(new MapIntegerAction("checkImage") {
1429             @Override
1430             public int map() {
1431                 return getSource().checkImage(image, imageObserver);
1432             }
1433         }));
1434     }
1435 
1436     /**
1437      * Maps {@code Component.contains(int, int)} through queue
1438      */
1439     public boolean contains(final int i, final int i1) {
1440         return (runMapping(new MapBooleanAction("contains") {
1441             @Override
1442             public boolean map() {
1443                 return getSource().contains(i, i1);
1444             }
1445         }));
1446     }
1447 
1448     /**
1449      * Maps {@code Component.contains(Point)} through queue
1450      */
1451     public boolean contains(final Point point) {
1452         return (runMapping(new MapBooleanAction("contains") {
1453             @Override
1454             public boolean map() {
1455                 return getSource().contains(point);
1456             }
1457         }));
1458     }
1459 
1460     /**
1461      * Maps {@code Component.createImage(int, int)} through queue
1462      */
1463     public Image createImage(final int i, final int i1) {
1464         return (runMapping(new MapAction<Image>("createImage") {
1465             @Override
1466             public Image map() {
1467                 return getSource().createImage(i, i1);
1468             }
1469         }));
1470     }
1471 
1472     /**
1473      * Maps {@code Component.createImage(ImageProducer)} through queue
1474      */
1475     public Image createImage(final ImageProducer imageProducer) {
1476         return (runMapping(new MapAction<Image>("createImage") {
1477             @Override
1478             public Image map() {
1479                 return getSource().createImage(imageProducer);
1480             }
1481         }));
1482     }
1483 
1484     /**
1485      * Maps {@code Component.dispatchEvent(AWTEvent)} through queue
1486      */
1487     public void dispatchEvent(final AWTEvent aWTEvent) {
1488         runMapping(new MapVoidAction("dispatchEvent") {
1489             @Override
1490             public void map() {
1491                 getSource().dispatchEvent(aWTEvent);
1492             }
1493         });
1494     }
1495 
1496     /**
1497      * Maps {@code Component.doLayout()} through queue
1498      */
1499     public void doLayout() {
1500         runMapping(new MapVoidAction("doLayout") {
1501             @Override
1502             public void map() {
1503                 getSource().doLayout();
1504             }
1505         });
1506     }
1507 
1508     /**
1509      * Maps {@code Component.enableInputMethods(boolean)} through queue
1510      */
1511     public void enableInputMethods(final boolean b) {
1512         runMapping(new MapVoidAction("enableInputMethods") {
1513             @Override
1514             public void map() {
1515                 getSource().enableInputMethods(b);
1516             }
1517         });
1518     }
1519 
1520     /**
1521      * Maps {@code Component.getAlignmentX()} through queue
1522      */
1523     public float getAlignmentX() {
1524         return (runMapping(new MapFloatAction("getAlignmentX") {
1525             @Override
1526             public float map() {
1527                 return getSource().getAlignmentX();
1528             }
1529         }));
1530     }
1531 
1532     /**
1533      * Maps {@code Component.getAlignmentY()} through queue
1534      */
1535     public float getAlignmentY() {
1536         return (runMapping(new MapFloatAction("getAlignmentY") {
1537             @Override
1538             public float map() {
1539                 return getSource().getAlignmentY();
1540             }
1541         }));
1542     }
1543 
1544     /**
1545      * Maps {@code Component.getBackground()} through queue
1546      */
1547     public Color getBackground() {
1548         return (runMapping(new MapAction<Color>("getBackground") {
1549             @Override
1550             public Color map() {
1551                 return getSource().getBackground();
1552             }
1553         }));
1554     }
1555 
1556     /**
1557      * Maps {@code Component.getBounds()} through queue
1558      */
1559     public Rectangle getBounds() {
1560         return (runMapping(new MapAction<Rectangle>("getBounds") {
1561             @Override
1562             public Rectangle map() {
1563                 return getSource().getBounds();
1564             }
1565         }));
1566     }
1567 
1568     /**
1569      * Maps {@code Component.getBounds(Rectangle)} through queue
1570      */
1571     public Rectangle getBounds(final Rectangle rectangle) {
1572         return (runMapping(new MapAction<Rectangle>("getBounds") {
1573             @Override
1574             public Rectangle map() {
1575                 return getSource().getBounds(rectangle);
1576             }
1577         }));
1578     }
1579 
1580     /**
1581      * Maps {@code Component.getColorModel()} through queue
1582      */
1583     public ColorModel getColorModel() {
1584         return (runMapping(new MapAction<ColorModel>("getColorModel") {
1585             @Override
1586             public ColorModel map() {
1587                 return getSource().getColorModel();
1588             }
1589         }));
1590     }
1591 
1592     /**
1593      * Maps {@code Component.getComponentAt(int, int)} through queue
1594      */
1595     public Component getComponentAt(final int i, final int i1) {
1596         return (runMapping(new MapAction<Component>("getComponentAt") {
1597             @Override
1598             public Component map() {
1599                 return getSource().getComponentAt(i, i1);
1600             }
1601         }));
1602     }
1603 
1604     /**
1605      * Maps {@code Component.getComponentAt(Point)} through queue
1606      */
1607     public Component getComponentAt(final Point point) {
1608         return (runMapping(new MapAction<Component>("getComponentAt") {
1609             @Override
1610             public Component map() {
1611                 return getSource().getComponentAt(point);
1612             }
1613         }));
1614     }
1615 
1616     /**
1617      * Maps {@code Component.getComponentOrientation()} through queue
1618      */
1619     public ComponentOrientation getComponentOrientation() {
1620         return (runMapping(new MapAction<ComponentOrientation>("getComponentOrientation") {
1621             @Override
1622             public ComponentOrientation map() {
1623                 return getSource().getComponentOrientation();
1624             }
1625         }));
1626     }
1627 
1628     /**
1629      * Maps {@code Component.getCursor()} through queue
1630      */
1631     public Cursor getCursor() {
1632         return (runMapping(new MapAction<Cursor>("getCursor") {
1633             @Override
1634             public Cursor map() {
1635                 return getSource().getCursor();
1636             }
1637         }));
1638     }
1639 
1640     /**
1641      * Maps {@code Component.getDropTarget()} through queue
1642      */
1643     public DropTarget getDropTarget() {
1644         return (runMapping(new MapAction<DropTarget>("getDropTarget") {
1645             @Override
1646             public DropTarget map() {
1647                 return getSource().getDropTarget();
1648             }
1649         }));
1650     }
1651 
1652     /**
1653      * Maps {@code Component.getFont()} through queue
1654      */
1655     public Font getFont() {
1656         return (runMapping(new MapAction<Font>("getFont") {
1657             @Override
1658             public Font map() {
1659                 return getSource().getFont();
1660             }
1661         }));
1662     }
1663 
1664     /**
1665      * Maps {@code Component.getFontMetrics(Font)} through queue
1666      */
1667     public FontMetrics getFontMetrics(final Font font) {
1668         return (runMapping(new MapAction<FontMetrics>("getFontMetrics") {
1669             @Override
1670             public FontMetrics map() {
1671                 return getSource().getFontMetrics(font);
1672             }
1673         }));
1674     }
1675 
1676     /**
1677      * Maps {@code Component.getForeground()} through queue
1678      */
1679     public Color getForeground() {
1680         return (runMapping(new MapAction<Color>("getForeground") {
1681             @Override
1682             public Color map() {
1683                 return getSource().getForeground();
1684             }
1685         }));
1686     }
1687 
1688     /**
1689      * Maps {@code Component.getGraphics()} through queue
1690      */
1691     public Graphics getGraphics() {
1692         return (runMapping(new MapAction<Graphics>("getGraphics") {
1693             @Override
1694             public Graphics map() {
1695                 return getSource().getGraphics();
1696             }
1697         }));
1698     }
1699 
1700     /**
1701      * Maps {@code Component.getHeight()} through queue
1702      */
1703     public int getHeight() {
1704         return (runMapping(new MapIntegerAction("getHeight") {
1705             @Override
1706             public int map() {
1707                 return getSource().getHeight();
1708             }
1709         }));
1710     }
1711 
1712     /**
1713      * Maps {@code Component.getInputContext()} through queue
1714      */
1715     public InputContext getInputContext() {
1716         return (runMapping(new MapAction<InputContext>("getInputContext") {
1717             @Override
1718             public InputContext map() {
1719                 return getSource().getInputContext();
1720             }
1721         }));
1722     }
1723 
1724     /**
1725      * Maps {@code Component.getInputMethodRequests()} through queue
1726      */
1727     public InputMethodRequests getInputMethodRequests() {
1728         return (runMapping(new MapAction<InputMethodRequests>("getInputMethodRequests") {
1729             @Override
1730             public InputMethodRequests map() {
1731                 return getSource().getInputMethodRequests();
1732             }
1733         }));
1734     }
1735 
1736     /**
1737      * Maps {@code Component.getLocale()} through queue
1738      */
1739     public Locale getLocale() {
1740         return (runMapping(new MapAction<Locale>("getLocale") {
1741             @Override
1742             public Locale map() {
1743                 return getSource().getLocale();
1744             }
1745         }));
1746     }
1747 
1748     /**
1749      * Maps {@code Component.getLocation()} through queue
1750      */
1751     public Point getLocation() {
1752         return (runMapping(new MapAction<Point>("getLocation") {
1753             @Override
1754             public Point map() {
1755                 return getSource().getLocation();
1756             }
1757         }));
1758     }
1759 
1760     /**
1761      * Maps {@code Component.getLocation(Point)} through queue
1762      */
1763     public Point getLocation(final Point point) {
1764         return (runMapping(new MapAction<Point>("getLocation") {
1765             @Override
1766             public Point map() {
1767                 return getSource().getLocation(point);
1768             }
1769         }));
1770     }
1771 
1772     /**
1773      * Maps {@code Component.getLocationOnScreen()} through queue
1774      */
1775     public Point getLocationOnScreen() {
1776         return (runMapping(new MapAction<Point>("getLocationOnScreen") {
1777             @Override
1778             public Point map() {
1779                 return getSource().getLocationOnScreen();
1780             }
1781         }));
1782     }
1783 
1784     /**
1785      * Maps {@code Component.getMaximumSize()} through queue
1786      */
1787     public Dimension getMaximumSize() {
1788         return (runMapping(new MapAction<Dimension>("getMaximumSize") {
1789             @Override
1790             public Dimension map() {
1791                 return getSource().getMaximumSize();
1792             }
1793         }));
1794     }
1795 
1796     /**
1797      * Maps {@code Component.getMinimumSize()} through queue
1798      */
1799     public Dimension getMinimumSize() {
1800         return (runMapping(new MapAction<Dimension>("getMinimumSize") {
1801             @Override
1802             public Dimension map() {
1803                 return getSource().getMinimumSize();
1804             }
1805         }));
1806     }
1807 
1808     /**
1809      * Maps {@code Component.getName()} through queue
1810      */
1811     public String getName() {
1812         return (runMapping(new MapAction<String>("getName") {
1813             @Override
1814             public String map() {
1815                 return getSource().getName();
1816             }
1817         }));
1818     }
1819 
1820     /**
1821      * Maps {@code Component.getParent()} through queue
1822      */
1823     public Container getParent() {
1824         return (runMapping(new MapAction<Container>("getParent") {
1825             @Override
1826             public Container map() {
1827                 return getSource().getParent();
1828             }
1829         }));
1830     }
1831 
1832     /**
1833      * Maps {@code Component.getPreferredSize()} through queue
1834      */
1835     public Dimension getPreferredSize() {
1836         return (runMapping(new MapAction<Dimension>("getPreferredSize") {
1837             @Override
1838             public Dimension map() {
1839                 return getSource().getPreferredSize();
1840             }
1841         }));
1842     }
1843 
1844     /**
1845      * Maps {@code Component.getSize()} through queue
1846      */
1847     public Dimension getSize() {
1848         return (runMapping(new MapAction<Dimension>("getSize") {
1849             @Override
1850             public Dimension map() {
1851                 return getSource().getSize();
1852             }
1853         }));
1854     }
1855 
1856     /**
1857      * Maps {@code Component.getSize(Dimension)} through queue
1858      */
1859     public Dimension getSize(final Dimension dimension) {
1860         return (runMapping(new MapAction<Dimension>("getSize") {
1861             @Override
1862             public Dimension map() {
1863                 return getSource().getSize(dimension);
1864             }
1865         }));
1866     }
1867 
1868     /**
1869      * Maps {@code Component.getToolkit()} through queue
1870      */
1871     public Toolkit getToolkit() {
1872         return (runMapping(new MapAction<Toolkit>("getToolkit") {
1873             @Override
1874             public Toolkit map() {
1875                 return getSource().getToolkit();
1876             }
1877         }));
1878     }
1879 
1880     /**
1881      * Maps {@code Component.getTreeLock()} through queue
1882      */
1883     public Object getTreeLock() {
1884         return (runMapping(new MapAction<Object>("getTreeLock") {
1885             @Override
1886             public Object map() {
1887                 return getSource().getTreeLock();
1888             }
1889         }));
1890     }
1891 
1892     /**
1893      * Maps {@code Component.getWidth()} through queue
1894      */
1895     public int getWidth() {
1896         return (runMapping(new MapIntegerAction("getWidth") {
1897             @Override
1898             public int map() {
1899                 return getSource().getWidth();
1900             }
1901         }));
1902     }
1903 
1904     /**
1905      * Maps {@code Component.getX()} through queue
1906      */
1907     public int getX() {
1908         return (runMapping(new MapIntegerAction("getX") {
1909             @Override
1910             public int map() {
1911                 return getSource().getX();
1912             }
1913         }));
1914     }
1915 
1916     /**
1917      * Maps {@code Component.getY()} through queue
1918      */
1919     public int getY() {
1920         return (runMapping(new MapIntegerAction("getY") {
1921             @Override
1922             public int map() {
1923                 return getSource().getY();
1924             }
1925         }));
1926     }
1927 
1928     /**
1929      * Maps {@code Component.hasFocus()} through queue
1930      */
1931     public boolean hasFocus() {
1932         return (runMapping(new MapBooleanAction("hasFocus") {
1933             @Override
1934             public boolean map() {
1935                 return getSource().hasFocus();
1936             }
1937         }));
1938     }
1939 
1940     /**
1941      * Maps {@code Component.imageUpdate(Image, int, int, int, int, int)}
1942      * through queue
1943      */
1944     public boolean imageUpdate(final Image image, final int i, final int i1, final int i2, final int i3, final int i4) {
1945         return (runMapping(new MapBooleanAction("imageUpdate") {
1946             @Override
1947             public boolean map() {
1948                 return getSource().imageUpdate(image, i, i1, i2, i3, i4);
1949             }
1950         }));
1951     }
1952 
1953     /**
1954      * Maps {@code Component.invalidate()} through queue
1955      */
1956     public void invalidate() {
1957         runMapping(new MapVoidAction("invalidate") {
1958             @Override
1959             public void map() {
1960                 getSource().invalidate();
1961             }
1962         });
1963     }
1964 
1965     /**
1966      * Maps {@code Component.isDisplayable()} through queue
1967      */
1968     public boolean isDisplayable() {
1969         return (runMapping(new MapBooleanAction("isDisplayable") {
1970             @Override
1971             public boolean map() {
1972                 return getSource().isDisplayable();
1973             }
1974         }));
1975     }
1976 
1977     /**
1978      * Maps {@code Component.isDoubleBuffered()} through queue
1979      */
1980     public boolean isDoubleBuffered() {
1981         return (runMapping(new MapBooleanAction("isDoubleBuffered") {
1982             @Override
1983             public boolean map() {
1984                 return getSource().isDoubleBuffered();
1985             }
1986         }));
1987     }
1988 
1989     /**
1990      * Maps {@code Component.isEnabled()} through queue
1991      */
1992     public boolean isEnabled() {
1993         return (runMapping(new MapBooleanAction("isEnabled") {
1994             @Override
1995             public boolean map() {
1996                 return getSource().isEnabled();
1997             }
1998         }));
1999     }
2000 
2001     /**
2002      * Maps {@code Component.isFocusTraversable()} through queue
2003      */
2004     @Deprecated
2005     public boolean isFocusTraversable() {
2006         return (runMapping(new MapBooleanAction("isFocusTraversable") {
2007             @Override
2008             public boolean map() {
2009                 return getSource().isFocusTraversable();
2010             }
2011         }));
2012     }
2013 
2014     /**
2015      * Maps {@code Component.isLightweight()} through queue
2016      */
2017     public boolean isLightweight() {
2018         return (runMapping(new MapBooleanAction("isLightweight") {
2019             @Override
2020             public boolean map() {
2021                 return getSource().isLightweight();
2022             }
2023         }));
2024     }
2025 
2026     /**
2027      * Maps {@code Component.isOpaque()} through queue
2028      */
2029     public boolean isOpaque() {
2030         return (runMapping(new MapBooleanAction("isOpaque") {
2031             @Override
2032             public boolean map() {
2033                 return getSource().isOpaque();
2034             }
2035         }));
2036     }
2037 
2038     /**
2039      * Maps {@code Component.isShowing()} through queue
2040      */
2041     public boolean isShowing() {
2042         return (runMapping(new MapBooleanAction("isShowing") {
2043             @Override
2044             public boolean map() {
2045                 return getSource().isShowing();
2046             }
2047         }));
2048     }
2049 
2050     /**
2051      * Maps {@code Component.isValid()} through queue
2052      */
2053     public boolean isValid() {
2054         return (runMapping(new MapBooleanAction("isValid") {
2055             @Override
2056             public boolean map() {
2057                 return getSource().isValid();
2058             }
2059         }));
2060     }
2061 
2062     /**
2063      * Maps {@code Component.isVisible()} through queue
2064      */
2065     public boolean isVisible() {
2066         return (runMapping(new MapBooleanAction("isVisible") {
2067             @Override
2068             public boolean map() {
2069                 return getSource().isVisible();
2070             }
2071         }));
2072     }
2073 
2074     /**
2075      * Maps {@code Component.list()} through queue
2076      */
2077     public void list() {
2078         runMapping(new MapVoidAction("list") {
2079             @Override
2080             public void map() {
2081                 getSource().list();
2082             }
2083         });
2084     }
2085 
2086     /**
2087      * Maps {@code Component.list(PrintStream)} through queue
2088      */
2089     public void list(final PrintStream printStream) {
2090         runMapping(new MapVoidAction("list") {
2091             @Override
2092             public void map() {
2093                 getSource().list(printStream);
2094             }
2095         });
2096     }
2097 
2098     /**
2099      * Maps {@code Component.list(PrintStream, int)} through queue
2100      */
2101     public void list(final PrintStream printStream, final int i) {
2102         runMapping(new MapVoidAction("list") {
2103             @Override
2104             public void map() {
2105                 getSource().list(printStream, i);
2106             }
2107         });
2108     }
2109 
2110     /**
2111      * Maps {@code Component.list(PrintWriter)} through queue
2112      */
2113     public void list(final PrintWriter printWriter) {
2114         runMapping(new MapVoidAction("list") {
2115             @Override
2116             public void map() {
2117                 getSource().list(printWriter);
2118             }
2119         });
2120     }
2121 
2122     /**
2123      * Maps {@code Component.list(PrintWriter, int)} through queue
2124      */
2125     public void list(final PrintWriter printWriter, final int i) {
2126         runMapping(new MapVoidAction("list") {
2127             @Override
2128             public void map() {
2129                 getSource().list(printWriter, i);
2130             }
2131         });
2132     }
2133 
2134     /**
2135      * Maps {@code Component.paint(Graphics)} through queue
2136      */
2137     public void paint(final Graphics graphics) {
2138         runMapping(new MapVoidAction("paint") {
2139             @Override
2140             public void map() {
2141                 getSource().paint(graphics);
2142             }
2143         });
2144     }
2145 
2146     /**
2147      * Maps {@code Component.paintAll(Graphics)} through queue
2148      */
2149     public void paintAll(final Graphics graphics) {
2150         runMapping(new MapVoidAction("paintAll") {
2151             @Override
2152             public void map() {
2153                 getSource().paintAll(graphics);
2154             }
2155         });
2156     }
2157 
2158     /**
2159      * Maps {@code Component.prepareImage(Image, int, int, ImageObserver)}
2160      * through queue
2161      */
2162     public boolean prepareImage(final Image image, final int i, final int i1, final ImageObserver imageObserver) {
2163         return (runMapping(new MapBooleanAction("prepareImage") {
2164             @Override
2165             public boolean map() {
2166                 return getSource().prepareImage(image, i, i1, imageObserver);
2167             }
2168         }));
2169     }
2170 
2171     /**
2172      * Maps {@code Component.prepareImage(Image, ImageObserver)} through queue
2173      */
2174     public boolean prepareImage(final Image image, final ImageObserver imageObserver) {
2175         return (runMapping(new MapBooleanAction("prepareImage") {
2176             @Override
2177             public boolean map() {
2178                 return getSource().prepareImage(image, imageObserver);
2179             }
2180         }));
2181     }
2182 
2183     /**
2184      * Maps {@code Component.print(Graphics)} through queue
2185      */
2186     public void print(final Graphics graphics) {
2187         runMapping(new MapVoidAction("print") {
2188             @Override
2189             public void map() {
2190                 getSource().print(graphics);
2191             }
2192         });
2193     }
2194 
2195     /**
2196      * Maps {@code Component.printAll(Graphics)} through queue
2197      */
2198     public void printAll(final Graphics graphics) {
2199         runMapping(new MapVoidAction("printAll") {
2200             @Override
2201             public void map() {
2202                 getSource().printAll(graphics);
2203             }
2204         });
2205     }
2206 
2207     /**
2208      * Maps {@code Component.remove(MenuComponent)} through queue
2209      */
2210     public void remove(final MenuComponent menuComponent) {
2211         runMapping(new MapVoidAction("remove") {
2212             @Override
2213             public void map() {
2214                 getSource().remove(menuComponent);
2215             }
2216         });
2217     }
2218 
2219     /**
2220      * Maps {@code Component.removeComponentListener(ComponentListener)}
2221      * through queue
2222      */
2223     public void removeComponentListener(final ComponentListener componentListener) {
2224         runMapping(new MapVoidAction("removeComponentListener") {
2225             @Override
2226             public void map() {
2227                 getSource().removeComponentListener(componentListener);
2228             }
2229         });
2230     }
2231 
2232     /**
2233      * Maps {@code Component.removeFocusListener(FocusListener)} through queue
2234      */
2235     public void removeFocusListener(final FocusListener focusListener) {
2236         runMapping(new MapVoidAction("removeFocusListener") {
2237             @Override
2238             public void map() {
2239                 getSource().removeFocusListener(focusListener);
2240             }
2241         });
2242     }
2243 
2244     /**
2245      * Maps
2246      * {@code Component.removeInputMethodListener(InputMethodListener)}
2247      * through queue
2248      */
2249     public void removeInputMethodListener(final InputMethodListener inputMethodListener) {
2250         runMapping(new MapVoidAction("removeInputMethodListener") {
2251             @Override
2252             public void map() {
2253                 getSource().removeInputMethodListener(inputMethodListener);
2254             }
2255         });
2256     }
2257 
2258     /**
2259      * Maps {@code Component.removeKeyListener(KeyListener)} through queue
2260      */
2261     public void removeKeyListener(final KeyListener keyListener) {
2262         runMapping(new MapVoidAction("removeKeyListener") {
2263             @Override
2264             public void map() {
2265                 getSource().removeKeyListener(keyListener);
2266             }
2267         });
2268     }
2269 
2270     /**
2271      * Maps {@code Component.removeMouseListener(MouseListener)} through queue
2272      */
2273     public void removeMouseListener(final MouseListener mouseListener) {
2274         runMapping(new MapVoidAction("removeMouseListener") {
2275             @Override
2276             public void map() {
2277                 getSource().removeMouseListener(mouseListener);
2278             }
2279         });
2280     }
2281 
2282     /**
2283      * Maps
2284      * {@code Component.removeMouseMotionListener(MouseMotionListener)}
2285      * through queue
2286      */
2287     public void removeMouseMotionListener(final MouseMotionListener mouseMotionListener) {
2288         runMapping(new MapVoidAction("removeMouseMotionListener") {
2289             @Override
2290             public void map() {
2291                 getSource().removeMouseMotionListener(mouseMotionListener);
2292             }
2293         });
2294     }
2295 
2296     /**
2297      * Maps {@code Component.removeNotify()} through queue
2298      */
2299     public void removeNotify() {
2300         runMapping(new MapVoidAction("removeNotify") {
2301             @Override
2302             public void map() {
2303                 getSource().removeNotify();
2304             }
2305         });
2306     }
2307 
2308     /**
2309      * Maps
2310      * {@code Component.removePropertyChangeListener(PropertyChangeListener)}
2311      * through queue
2312      */
2313     public void removePropertyChangeListener(final PropertyChangeListener propertyChangeListener) {
2314         runMapping(new MapVoidAction("removePropertyChangeListener") {
2315             @Override
2316             public void map() {
2317                 getSource().removePropertyChangeListener(propertyChangeListener);
2318             }
2319         });
2320     }
2321 
2322     /**
2323      * Maps
2324      * {@code Component.removePropertyChangeListener(String, PropertyChangeListener)}
2325      * through queue
2326      */
2327     public void removePropertyChangeListener(final String string, final PropertyChangeListener propertyChangeListener) {
2328         runMapping(new MapVoidAction("removePropertyChangeListener") {
2329             @Override
2330             public void map() {
2331                 getSource().removePropertyChangeListener(string, propertyChangeListener);
2332             }
2333         });
2334     }
2335 
2336     /**
2337      * Maps {@code Component.repaint()} through queue
2338      */
2339     public void repaint() {
2340         runMapping(new MapVoidAction("repaint") {
2341             @Override
2342             public void map() {
2343                 getSource().repaint();
2344             }
2345         });
2346     }
2347 
2348     /**
2349      * Maps {@code Component.repaint(int, int, int, int)} through queue
2350      */
2351     public void repaint(final int i, final int i1, final int i2, final int i3) {
2352         runMapping(new MapVoidAction("repaint") {
2353             @Override
2354             public void map() {
2355                 getSource().repaint(i, i1, i2, i3);
2356             }
2357         });
2358     }
2359 
2360     /**
2361      * Maps {@code Component.repaint(long)} through queue
2362      */
2363     public void repaint(final long l) {
2364         runMapping(new MapVoidAction("repaint") {
2365             @Override
2366             public void map() {
2367                 getSource().repaint(l);
2368             }
2369         });
2370     }
2371 
2372     /**
2373      * Maps {@code Component.repaint(long, int, int, int, int)} through queue
2374      */
2375     public void repaint(final long l, final int i, final int i1, final int i2, final int i3) {
2376         runMapping(new MapVoidAction("repaint") {
2377             @Override
2378             public void map() {
2379                 getSource().repaint(l, i, i1, i2, i3);
2380             }
2381         });
2382     }
2383 
2384     /**
2385      * Maps {@code Component.requestFocus()} through queue
2386      */
2387     public void requestFocus() {
2388         runMapping(new MapVoidAction("requestFocus") {
2389             @Override
2390             public void map() {
2391                 getSource().requestFocus();
2392             }
2393         });
2394     }
2395 
2396     /**
2397      * Maps {@code Component.setBackground(Color)} through queue
2398      */
2399     public void setBackground(final Color color) {
2400         runMapping(new MapVoidAction("setBackground") {
2401             @Override
2402             public void map() {
2403                 getSource().setBackground(color);
2404             }
2405         });
2406     }
2407 
2408     /**
2409      * Maps {@code Component.setBounds(int, int, int, int)} through queue
2410      */
2411     public void setBounds(final int i, final int i1, final int i2, final int i3) {
2412         runMapping(new MapVoidAction("setBounds") {
2413             @Override
2414             public void map() {
2415                 getSource().setBounds(i, i1, i2, i3);
2416             }
2417         });
2418     }
2419 
2420     /**
2421      * Maps {@code Component.setBounds(Rectangle)} through queue
2422      */
2423     public void setBounds(final Rectangle rectangle) {
2424         runMapping(new MapVoidAction("setBounds") {
2425             @Override
2426             public void map() {
2427                 getSource().setBounds(rectangle);
2428             }
2429         });
2430     }
2431 
2432     /**
2433      * Maps {@code Component.setComponentOrientation(ComponentOrientation)}
2434      * through queue
2435      */
2436     public void setComponentOrientation(final ComponentOrientation componentOrientation) {
2437         runMapping(new MapVoidAction("setComponentOrientation") {
2438             @Override
2439             public void map() {
2440                 getSource().setComponentOrientation(componentOrientation);
2441             }
2442         });
2443     }
2444 
2445     /**
2446      * Maps {@code Component.setCursor(Cursor)} through queue
2447      */
2448     public void setCursor(final Cursor cursor) {
2449         runMapping(new MapVoidAction("setCursor") {
2450             @Override
2451             public void map() {
2452                 getSource().setCursor(cursor);
2453             }
2454         });
2455     }
2456 
2457     /**
2458      * Maps {@code Component.setDropTarget(DropTarget)} through queue
2459      */
2460     public void setDropTarget(final DropTarget dropTarget) {
2461         runMapping(new MapVoidAction("setDropTarget") {
2462             @Override
2463             public void map() {
2464                 getSource().setDropTarget(dropTarget);
2465             }
2466         });
2467     }
2468 
2469     /**
2470      * Maps {@code Component.setEnabled(boolean)} through queue
2471      */
2472     public void setEnabled(final boolean b) {
2473         runMapping(new MapVoidAction("setEnabled") {
2474             @Override
2475             public void map() {
2476                 getSource().setEnabled(b);
2477             }
2478         });
2479     }
2480 
2481     /**
2482      * Maps {@code Component.setFont(Font)} through queue
2483      */
2484     public void setFont(final Font font) {
2485         runMapping(new MapVoidAction("setFont") {
2486             @Override
2487             public void map() {
2488                 getSource().setFont(font);
2489             }
2490         });
2491     }
2492 
2493     /**
2494      * Maps {@code Component.setForeground(Color)} through queue
2495      */
2496     public void setForeground(final Color color) {
2497         runMapping(new MapVoidAction("setForeground") {
2498             @Override
2499             public void map() {
2500                 getSource().setForeground(color);
2501             }
2502         });
2503     }
2504 
2505     /**
2506      * Maps {@code Component.setLocale(Locale)} through queue
2507      */
2508     public void setLocale(final Locale locale) {
2509         runMapping(new MapVoidAction("setLocale") {
2510             @Override
2511             public void map() {
2512                 getSource().setLocale(locale);
2513             }
2514         });
2515     }
2516 
2517     /**
2518      * Maps {@code Component.setLocation(int, int)} through queue
2519      */
2520     public void setLocation(final int i, final int i1) {
2521         runMapping(new MapVoidAction("setLocation") {
2522             @Override
2523             public void map() {
2524                 getSource().setLocation(i, i1);
2525             }
2526         });
2527     }
2528 
2529     /**
2530      * Maps {@code Component.setLocation(Point)} through queue
2531      */
2532     public void setLocation(final Point point) {
2533         runMapping(new MapVoidAction("setLocation") {
2534             @Override
2535             public void map() {
2536                 getSource().setLocation(point);
2537             }
2538         });
2539     }
2540 
2541     /**
2542      * Maps {@code Component.setName(String)} through queue
2543      */
2544     public void setName(final String string) {
2545         runMapping(new MapVoidAction("setName") {
2546             @Override
2547             public void map() {
2548                 getSource().setName(string);
2549             }
2550         });
2551     }
2552 
2553     /**
2554      * Maps {@code Component.setSize(int, int)} through queue
2555      */
2556     public void setSize(final int i, final int i1) {
2557         runMapping(new MapVoidAction("setSize") {
2558             @Override
2559             public void map() {
2560                 getSource().setSize(i, i1);
2561             }
2562         });
2563     }
2564 
2565     /**
2566      * Maps {@code Component.setSize(Dimension)} through queue
2567      */
2568     public void setSize(final Dimension dimension) {
2569         runMapping(new MapVoidAction("setSize") {
2570             @Override
2571             public void map() {
2572                 getSource().setSize(dimension);
2573             }
2574         });
2575     }
2576 
2577     /**
2578      * Maps {@code Component.setVisible(boolean)} through queue
2579      */
2580     public void setVisible(final boolean b) {
2581         runMapping(new MapVoidAction("setVisible") {
2582             @Override
2583             public void map() {
2584                 getSource().setVisible(b);
2585             }
2586         });
2587     }
2588 
2589     /**
2590      * Maps {@code Component.transferFocus()} through queue
2591      */
2592     public void transferFocus() {
2593         runMapping(new MapVoidAction("transferFocus") {
2594             @Override
2595             public void map() {
2596                 getSource().transferFocus();
2597             }
2598         });
2599     }
2600 
2601     /**
2602      * Maps {@code Component.update(Graphics)} through queue
2603      */
2604     public void update(final Graphics graphics) {
2605         runMapping(new MapVoidAction("update") {
2606             @Override
2607             public void map() {
2608                 getSource().update(graphics);
2609             }
2610         });
2611     }
2612 
2613     /**
2614      * Maps {@code Component.validate()} through queue
2615      */
2616     public void validate() {
2617         runMapping(new MapVoidAction("validate") {
2618             @Override
2619             public void map() {
2620                 getSource().validate();
2621             }
2622         });
2623     }
2624 
2625     //End of mapping                                      //
2626     ////////////////////////////////////////////////////////
2627     private void setEventDispatcher(EventDispatcher dispatcher) {
2628         dispatcher.setOutput(getOutput().createErrorOutput());
2629         dispatcher.setTimeouts(getTimeouts());
2630         this.dispatcher = dispatcher;
2631     }
2632 
2633     static class VisibleComponentFinder implements ComponentChooser {
2634 
2635         ComponentChooser subFinder;
2636 
2637         public VisibleComponentFinder(ComponentChooser sf) {
2638             subFinder = sf;
2639         }
2640 
2641         @Override
2642         public boolean checkComponent(Component comp) {
2643             if (comp.isShowing()) {
2644                 return subFinder.checkComponent(comp);
2645             }
2646             return false;
2647         }
2648 
2649         @Override
2650         public String getDescription() {
2651             return subFinder.getDescription();
2652         }
2653 
2654         @Override
2655         public String toString() {
2656             return "VisibleComponentFinder{" + "subFinder=" + subFinder + '}';
2657         }
2658     }
2659 
2660 }