1 /* 2 * Copyright (c) 1997, 2016, 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. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.netbeans.jemmy.operators; 24 25 import java.awt.AWTEvent; 26 import java.awt.Color; 27 import java.awt.Component; 28 import java.awt.ComponentOrientation; 29 import java.awt.Container; 30 import java.awt.Cursor; 31 import java.awt.Dimension; 32 import java.awt.Font; 33 import java.awt.FontMetrics; 34 import java.awt.Graphics; 35 import java.awt.Image; 36 import java.awt.MenuComponent; 37 import java.awt.Point; 38 import java.awt.PopupMenu; 39 import java.awt.Rectangle; 40 import java.awt.Toolkit; 41 import java.awt.Window; 42 import java.awt.dnd.DropTarget; 43 import java.awt.event.ComponentListener; 44 import java.awt.event.FocusListener; 45 import java.awt.event.InputMethodListener; 46 import java.awt.event.KeyListener; 47 import java.awt.event.MouseListener; 48 import java.awt.event.MouseMotionListener; 49 import java.awt.im.InputContext; 50 import java.awt.im.InputMethodRequests; 51 import java.awt.image.ColorModel; 52 import java.awt.image.ImageObserver; 53 import java.awt.image.ImageProducer; 54 import java.beans.PropertyChangeListener; 55 import java.io.PrintStream; 56 import java.io.PrintWriter; 57 import java.util.Hashtable; 58 import java.util.Locale; 59 60 import static java.lang.Math.abs; 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 * Returns information about component. 1224 */ 1225 @Override 1226 public Hashtable<String, Object> getDump() { 1227 Hashtable<String, Object> result = super.getDump(); 1228 if (getSource().getName() != null) { 1229 result.put(NAME_DPROP, getSource().getName()); 1230 } 1231 result.put(IS_VISIBLE_DPROP, getSource().isVisible() ? "true" : "false"); 1232 result.put(IS_SHOWING_DPROP, getSource().isShowing() ? "true" : "false"); 1233 result.put(X_DPROP, Integer.toString(getSource().getX())); 1234 result.put(Y_DPROP, Integer.toString(getSource().getY())); 1235 result.put(WIDTH_DPROP, Integer.toString(getSource().getWidth())); 1236 result.put(HEIGHT_DPROP, Integer.toString(getSource().getHeight())); 1237 return result; 1238 } 1239 1240 //////////////////////////////////////////////////////// 1241 //Mapping // 1242 /** 1243 * Maps {@code Component.add(PopupMenu)} through queue 1244 */ 1245 public void add(final PopupMenu popupMenu) { 1246 runMapping(new MapVoidAction("add") { 1247 @Override 1248 public void map() { 1249 getSource().add(popupMenu); 1250 } 1251 }); 1252 } 1253 1254 /** 1255 * Maps {@code Component.addComponentListener(ComponentListener)} 1256 * through queue 1257 */ 1258 public void addComponentListener(final ComponentListener componentListener) { 1259 runMapping(new MapVoidAction("addComponentListener") { 1260 @Override 1261 public void map() { 1262 getSource().addComponentListener(componentListener); 1263 } 1264 }); 1265 } 1266 1267 /** 1268 * Maps {@code Component.addFocusListener(FocusListener)} through queue 1269 */ 1270 public void addFocusListener(final FocusListener focusListener) { 1271 runMapping(new MapVoidAction("addFocusListener") { 1272 @Override 1273 public void map() { 1274 getSource().addFocusListener(focusListener); 1275 } 1276 }); 1277 } 1278 1279 /** 1280 * Maps {@code Component.addInputMethodListener(InputMethodListener)} 1281 * through queue 1282 */ 1283 public void addInputMethodListener(final InputMethodListener inputMethodListener) { 1284 runMapping(new MapVoidAction("addInputMethodListener") { 1285 @Override 1286 public void map() { 1287 getSource().addInputMethodListener(inputMethodListener); 1288 } 1289 }); 1290 } 1291 1292 /** 1293 * Maps {@code Component.addKeyListener(KeyListener)} through queue 1294 */ 1295 public void addKeyListener(final KeyListener keyListener) { 1296 runMapping(new MapVoidAction("addKeyListener") { 1297 @Override 1298 public void map() { 1299 getSource().addKeyListener(keyListener); 1300 } 1301 }); 1302 } 1303 1304 /** 1305 * Maps {@code Component.addMouseListener(MouseListener)} through queue 1306 */ 1307 public void addMouseListener(final MouseListener mouseListener) { 1308 runMapping(new MapVoidAction("addMouseListener") { 1309 @Override 1310 public void map() { 1311 getSource().addMouseListener(mouseListener); 1312 } 1313 }); 1314 } 1315 1316 /** 1317 * Maps {@code Component.addMouseMotionListener(MouseMotionListener)} 1318 * through queue 1319 */ 1320 public void addMouseMotionListener(final MouseMotionListener mouseMotionListener) { 1321 runMapping(new MapVoidAction("addMouseMotionListener") { 1322 @Override 1323 public void map() { 1324 getSource().addMouseMotionListener(mouseMotionListener); 1325 } 1326 }); 1327 } 1328 1329 /** 1330 * Maps {@code Component.addNotify()} through queue 1331 */ 1332 public void addNotify() { 1333 runMapping(new MapVoidAction("addNotify") { 1334 @Override 1335 public void map() { 1336 getSource().addNotify(); 1337 } 1338 }); 1339 } 1340 1341 /** 1342 * Maps 1343 * {@code Component.addPropertyChangeListener(PropertyChangeListener)} 1344 * through queue 1345 */ 1346 public void addPropertyChangeListener(final PropertyChangeListener propertyChangeListener) { 1347 runMapping(new MapVoidAction("addPropertyChangeListener") { 1348 @Override 1349 public void map() { 1350 getSource().addPropertyChangeListener(propertyChangeListener); 1351 } 1352 }); 1353 } 1354 1355 /** 1356 * Maps 1357 * {@code Component.addPropertyChangeListener(String, PropertyChangeListener)} 1358 * through queue 1359 */ 1360 public void addPropertyChangeListener(final String string, final PropertyChangeListener propertyChangeListener) { 1361 runMapping(new MapVoidAction("addPropertyChangeListener") { 1362 @Override 1363 public void map() { 1364 getSource().addPropertyChangeListener(string, propertyChangeListener); 1365 } 1366 }); 1367 } 1368 1369 /** 1370 * Maps {@code Component.checkImage(Image, int, int, ImageObserver)} 1371 * through queue 1372 */ 1373 public int checkImage(final Image image, final int i, final int i1, final ImageObserver imageObserver) { 1374 return (runMapping(new MapIntegerAction("checkImage") { 1375 @Override 1376 public int map() { 1377 return getSource().checkImage(image, i, i1, imageObserver); 1378 } 1379 })); 1380 } 1381 1382 /** 1383 * Maps {@code Component.checkImage(Image, ImageObserver)} through queue 1384 */ 1385 public int checkImage(final Image image, final ImageObserver imageObserver) { 1386 return (runMapping(new MapIntegerAction("checkImage") { 1387 @Override 1388 public int map() { 1389 return getSource().checkImage(image, imageObserver); 1390 } 1391 })); 1392 } 1393 1394 /** 1395 * Maps {@code Component.contains(int, int)} through queue 1396 */ 1397 public boolean contains(final int i, final int i1) { 1398 return (runMapping(new MapBooleanAction("contains") { 1399 @Override 1400 public boolean map() { 1401 return getSource().contains(i, i1); 1402 } 1403 })); 1404 } 1405 1406 /** 1407 * Maps {@code Component.contains(Point)} through queue 1408 */ 1409 public boolean contains(final Point point) { 1410 return (runMapping(new MapBooleanAction("contains") { 1411 @Override 1412 public boolean map() { 1413 return getSource().contains(point); 1414 } 1415 })); 1416 } 1417 1418 /** 1419 * Maps {@code Component.createImage(int, int)} through queue 1420 */ 1421 public Image createImage(final int i, final int i1) { 1422 return (runMapping(new MapAction<Image>("createImage") { 1423 @Override 1424 public Image map() { 1425 return getSource().createImage(i, i1); 1426 } 1427 })); 1428 } 1429 1430 /** 1431 * Maps {@code Component.createImage(ImageProducer)} through queue 1432 */ 1433 public Image createImage(final ImageProducer imageProducer) { 1434 return (runMapping(new MapAction<Image>("createImage") { 1435 @Override 1436 public Image map() { 1437 return getSource().createImage(imageProducer); 1438 } 1439 })); 1440 } 1441 1442 /** 1443 * Maps {@code Component.dispatchEvent(AWTEvent)} through queue 1444 */ 1445 public void dispatchEvent(final AWTEvent aWTEvent) { 1446 runMapping(new MapVoidAction("dispatchEvent") { 1447 @Override 1448 public void map() { 1449 getSource().dispatchEvent(aWTEvent); 1450 } 1451 }); 1452 } 1453 1454 /** 1455 * Maps {@code Component.doLayout()} through queue 1456 */ 1457 public void doLayout() { 1458 runMapping(new MapVoidAction("doLayout") { 1459 @Override 1460 public void map() { 1461 getSource().doLayout(); 1462 } 1463 }); 1464 } 1465 1466 /** 1467 * Maps {@code Component.enableInputMethods(boolean)} through queue 1468 */ 1469 public void enableInputMethods(final boolean b) { 1470 runMapping(new MapVoidAction("enableInputMethods") { 1471 @Override 1472 public void map() { 1473 getSource().enableInputMethods(b); 1474 } 1475 }); 1476 } 1477 1478 /** 1479 * Maps {@code Component.getAlignmentX()} through queue 1480 */ 1481 public float getAlignmentX() { 1482 return (runMapping(new MapFloatAction("getAlignmentX") { 1483 @Override 1484 public float map() { 1485 return getSource().getAlignmentX(); 1486 } 1487 })); 1488 } 1489 1490 /** 1491 * Maps {@code Component.getAlignmentY()} through queue 1492 */ 1493 public float getAlignmentY() { 1494 return (runMapping(new MapFloatAction("getAlignmentY") { 1495 @Override 1496 public float map() { 1497 return getSource().getAlignmentY(); 1498 } 1499 })); 1500 } 1501 1502 /** 1503 * Maps {@code Component.getBackground()} through queue 1504 */ 1505 public Color getBackground() { 1506 return (runMapping(new MapAction<Color>("getBackground") { 1507 @Override 1508 public Color map() { 1509 return getSource().getBackground(); 1510 } 1511 })); 1512 } 1513 1514 /** 1515 * Maps {@code Component.getBounds()} through queue 1516 */ 1517 public Rectangle getBounds() { 1518 return (runMapping(new MapAction<Rectangle>("getBounds") { 1519 @Override 1520 public Rectangle map() { 1521 return getSource().getBounds(); 1522 } 1523 })); 1524 } 1525 1526 /** 1527 * Maps {@code Component.getBounds(Rectangle)} through queue 1528 */ 1529 public Rectangle getBounds(final Rectangle rectangle) { 1530 return (runMapping(new MapAction<Rectangle>("getBounds") { 1531 @Override 1532 public Rectangle map() { 1533 return getSource().getBounds(rectangle); 1534 } 1535 })); 1536 } 1537 1538 /** 1539 * Maps {@code Component.getColorModel()} through queue 1540 */ 1541 public ColorModel getColorModel() { 1542 return (runMapping(new MapAction<ColorModel>("getColorModel") { 1543 @Override 1544 public ColorModel map() { 1545 return getSource().getColorModel(); 1546 } 1547 })); 1548 } 1549 1550 /** 1551 * Maps {@code Component.getComponentAt(int, int)} through queue 1552 */ 1553 public Component getComponentAt(final int i, final int i1) { 1554 return (runMapping(new MapAction<Component>("getComponentAt") { 1555 @Override 1556 public Component map() { 1557 return getSource().getComponentAt(i, i1); 1558 } 1559 })); 1560 } 1561 1562 /** 1563 * Maps {@code Component.getComponentAt(Point)} through queue 1564 */ 1565 public Component getComponentAt(final Point point) { 1566 return (runMapping(new MapAction<Component>("getComponentAt") { 1567 @Override 1568 public Component map() { 1569 return getSource().getComponentAt(point); 1570 } 1571 })); 1572 } 1573 1574 /** 1575 * Maps {@code Component.getComponentOrientation()} through queue 1576 */ 1577 public ComponentOrientation getComponentOrientation() { 1578 return (runMapping(new MapAction<ComponentOrientation>("getComponentOrientation") { 1579 @Override 1580 public ComponentOrientation map() { 1581 return getSource().getComponentOrientation(); 1582 } 1583 })); 1584 } 1585 1586 /** 1587 * Maps {@code Component.getCursor()} through queue 1588 */ 1589 public Cursor getCursor() { 1590 return (runMapping(new MapAction<Cursor>("getCursor") { 1591 @Override 1592 public Cursor map() { 1593 return getSource().getCursor(); 1594 } 1595 })); 1596 } 1597 1598 /** 1599 * Maps {@code Component.getDropTarget()} through queue 1600 */ 1601 public DropTarget getDropTarget() { 1602 return (runMapping(new MapAction<DropTarget>("getDropTarget") { 1603 @Override 1604 public DropTarget map() { 1605 return getSource().getDropTarget(); 1606 } 1607 })); 1608 } 1609 1610 /** 1611 * Maps {@code Component.getFont()} through queue 1612 */ 1613 public Font getFont() { 1614 return (runMapping(new MapAction<Font>("getFont") { 1615 @Override 1616 public Font map() { 1617 return getSource().getFont(); 1618 } 1619 })); 1620 } 1621 1622 /** 1623 * Maps {@code Component.getFontMetrics(Font)} through queue 1624 */ 1625 public FontMetrics getFontMetrics(final Font font) { 1626 return (runMapping(new MapAction<FontMetrics>("getFontMetrics") { 1627 @Override 1628 public FontMetrics map() { 1629 return getSource().getFontMetrics(font); 1630 } 1631 })); 1632 } 1633 1634 /** 1635 * Maps {@code Component.getForeground()} through queue 1636 */ 1637 public Color getForeground() { 1638 return (runMapping(new MapAction<Color>("getForeground") { 1639 @Override 1640 public Color map() { 1641 return getSource().getForeground(); 1642 } 1643 })); 1644 } 1645 1646 /** 1647 * Maps {@code Component.getGraphics()} through queue 1648 */ 1649 public Graphics getGraphics() { 1650 return (runMapping(new MapAction<Graphics>("getGraphics") { 1651 @Override 1652 public Graphics map() { 1653 return getSource().getGraphics(); 1654 } 1655 })); 1656 } 1657 1658 /** 1659 * Maps {@code Component.getHeight()} through queue 1660 */ 1661 public int getHeight() { 1662 return (runMapping(new MapIntegerAction("getHeight") { 1663 @Override 1664 public int map() { 1665 return getSource().getHeight(); 1666 } 1667 })); 1668 } 1669 1670 /** 1671 * Maps {@code Component.getInputContext()} through queue 1672 */ 1673 public InputContext getInputContext() { 1674 return (runMapping(new MapAction<InputContext>("getInputContext") { 1675 @Override 1676 public InputContext map() { 1677 return getSource().getInputContext(); 1678 } 1679 })); 1680 } 1681 1682 /** 1683 * Maps {@code Component.getInputMethodRequests()} through queue 1684 */ 1685 public InputMethodRequests getInputMethodRequests() { 1686 return (runMapping(new MapAction<InputMethodRequests>("getInputMethodRequests") { 1687 @Override 1688 public InputMethodRequests map() { 1689 return getSource().getInputMethodRequests(); 1690 } 1691 })); 1692 } 1693 1694 /** 1695 * Maps {@code Component.getLocale()} through queue 1696 */ 1697 public Locale getLocale() { 1698 return (runMapping(new MapAction<Locale>("getLocale") { 1699 @Override 1700 public Locale map() { 1701 return getSource().getLocale(); 1702 } 1703 })); 1704 } 1705 1706 /** 1707 * Maps {@code Component.getLocation()} through queue 1708 */ 1709 public Point getLocation() { 1710 return (runMapping(new MapAction<Point>("getLocation") { 1711 @Override 1712 public Point map() { 1713 return getSource().getLocation(); 1714 } 1715 })); 1716 } 1717 1718 /** 1719 * Maps {@code Component.getLocation(Point)} through queue 1720 */ 1721 public Point getLocation(final Point point) { 1722 return (runMapping(new MapAction<Point>("getLocation") { 1723 @Override 1724 public Point map() { 1725 return getSource().getLocation(point); 1726 } 1727 })); 1728 } 1729 1730 /** 1731 * Maps {@code Component.getLocationOnScreen()} through queue 1732 */ 1733 public Point getLocationOnScreen() { 1734 return (runMapping(new MapAction<Point>("getLocationOnScreen") { 1735 @Override 1736 public Point map() { 1737 return getSource().getLocationOnScreen(); 1738 } 1739 })); 1740 } 1741 1742 /** 1743 * Maps {@code Component.getMaximumSize()} through queue 1744 */ 1745 public Dimension getMaximumSize() { 1746 return (runMapping(new MapAction<Dimension>("getMaximumSize") { 1747 @Override 1748 public Dimension map() { 1749 return getSource().getMaximumSize(); 1750 } 1751 })); 1752 } 1753 1754 /** 1755 * Maps {@code Component.getMinimumSize()} through queue 1756 */ 1757 public Dimension getMinimumSize() { 1758 return (runMapping(new MapAction<Dimension>("getMinimumSize") { 1759 @Override 1760 public Dimension map() { 1761 return getSource().getMinimumSize(); 1762 } 1763 })); 1764 } 1765 1766 /** 1767 * Maps {@code Component.getName()} through queue 1768 */ 1769 public String getName() { 1770 return (runMapping(new MapAction<String>("getName") { 1771 @Override 1772 public String map() { 1773 return getSource().getName(); 1774 } 1775 })); 1776 } 1777 1778 /** 1779 * Maps {@code Component.getParent()} through queue 1780 */ 1781 public Container getParent() { 1782 return (runMapping(new MapAction<Container>("getParent") { 1783 @Override 1784 public Container map() { 1785 return getSource().getParent(); 1786 } 1787 })); 1788 } 1789 1790 /** 1791 * Maps {@code Component.getPreferredSize()} through queue 1792 */ 1793 public Dimension getPreferredSize() { 1794 return (runMapping(new MapAction<Dimension>("getPreferredSize") { 1795 @Override 1796 public Dimension map() { 1797 return getSource().getPreferredSize(); 1798 } 1799 })); 1800 } 1801 1802 /** 1803 * Maps {@code Component.getSize()} through queue 1804 */ 1805 public Dimension getSize() { 1806 return (runMapping(new MapAction<Dimension>("getSize") { 1807 @Override 1808 public Dimension map() { 1809 return getSource().getSize(); 1810 } 1811 })); 1812 } 1813 1814 /** 1815 * Maps {@code Component.getSize(Dimension)} through queue 1816 */ 1817 public Dimension getSize(final Dimension dimension) { 1818 return (runMapping(new MapAction<Dimension>("getSize") { 1819 @Override 1820 public Dimension map() { 1821 return getSource().getSize(dimension); 1822 } 1823 })); 1824 } 1825 1826 /** 1827 * Maps {@code Component.getToolkit()} through queue 1828 */ 1829 public Toolkit getToolkit() { 1830 return (runMapping(new MapAction<Toolkit>("getToolkit") { 1831 @Override 1832 public Toolkit map() { 1833 return getSource().getToolkit(); 1834 } 1835 })); 1836 } 1837 1838 /** 1839 * Maps {@code Component.getTreeLock()} through queue 1840 */ 1841 public Object getTreeLock() { 1842 return (runMapping(new MapAction<Object>("getTreeLock") { 1843 @Override 1844 public Object map() { 1845 return getSource().getTreeLock(); 1846 } 1847 })); 1848 } 1849 1850 /** 1851 * Maps {@code Component.getWidth()} through queue 1852 */ 1853 public int getWidth() { 1854 return (runMapping(new MapIntegerAction("getWidth") { 1855 @Override 1856 public int map() { 1857 return getSource().getWidth(); 1858 } 1859 })); 1860 } 1861 1862 /** 1863 * Maps {@code Component.getX()} through queue 1864 */ 1865 public int getX() { 1866 return (runMapping(new MapIntegerAction("getX") { 1867 @Override 1868 public int map() { 1869 return getSource().getX(); 1870 } 1871 })); 1872 } 1873 1874 /** 1875 * Maps {@code Component.getY()} through queue 1876 */ 1877 public int getY() { 1878 return (runMapping(new MapIntegerAction("getY") { 1879 @Override 1880 public int map() { 1881 return getSource().getY(); 1882 } 1883 })); 1884 } 1885 1886 /** 1887 * Maps {@code Component.hasFocus()} through queue 1888 */ 1889 public boolean hasFocus() { 1890 return (runMapping(new MapBooleanAction("hasFocus") { 1891 @Override 1892 public boolean map() { 1893 return getSource().hasFocus(); 1894 } 1895 })); 1896 } 1897 1898 /** 1899 * Maps {@code Component.imageUpdate(Image, int, int, int, int, int)} 1900 * through queue 1901 */ 1902 public boolean imageUpdate(final Image image, final int i, final int i1, final int i2, final int i3, final int i4) { 1903 return (runMapping(new MapBooleanAction("imageUpdate") { 1904 @Override 1905 public boolean map() { 1906 return getSource().imageUpdate(image, i, i1, i2, i3, i4); 1907 } 1908 })); 1909 } 1910 1911 /** 1912 * Maps {@code Component.invalidate()} through queue 1913 */ 1914 public void invalidate() { 1915 runMapping(new MapVoidAction("invalidate") { 1916 @Override 1917 public void map() { 1918 getSource().invalidate(); 1919 } 1920 }); 1921 } 1922 1923 /** 1924 * Maps {@code Component.isDisplayable()} through queue 1925 */ 1926 public boolean isDisplayable() { 1927 return (runMapping(new MapBooleanAction("isDisplayable") { 1928 @Override 1929 public boolean map() { 1930 return getSource().isDisplayable(); 1931 } 1932 })); 1933 } 1934 1935 /** 1936 * Maps {@code Component.isDoubleBuffered()} through queue 1937 */ 1938 public boolean isDoubleBuffered() { 1939 return (runMapping(new MapBooleanAction("isDoubleBuffered") { 1940 @Override 1941 public boolean map() { 1942 return getSource().isDoubleBuffered(); 1943 } 1944 })); 1945 } 1946 1947 /** 1948 * Maps {@code Component.isEnabled()} through queue 1949 */ 1950 public boolean isEnabled() { 1951 return (runMapping(new MapBooleanAction("isEnabled") { 1952 @Override 1953 public boolean map() { 1954 return getSource().isEnabled(); 1955 } 1956 })); 1957 } 1958 1959 /** 1960 * Maps {@code Component.isFocusTraversable()} through queue 1961 */ 1962 @Deprecated 1963 public boolean isFocusTraversable() { 1964 return (runMapping(new MapBooleanAction("isFocusTraversable") { 1965 @Override 1966 public boolean map() { 1967 return getSource().isFocusTraversable(); 1968 } 1969 })); 1970 } 1971 1972 /** 1973 * Maps {@code Component.isLightweight()} through queue 1974 */ 1975 public boolean isLightweight() { 1976 return (runMapping(new MapBooleanAction("isLightweight") { 1977 @Override 1978 public boolean map() { 1979 return getSource().isLightweight(); 1980 } 1981 })); 1982 } 1983 1984 /** 1985 * Maps {@code Component.isOpaque()} through queue 1986 */ 1987 public boolean isOpaque() { 1988 return (runMapping(new MapBooleanAction("isOpaque") { 1989 @Override 1990 public boolean map() { 1991 return getSource().isOpaque(); 1992 } 1993 })); 1994 } 1995 1996 /** 1997 * Maps {@code Component.isShowing()} through queue 1998 */ 1999 public boolean isShowing() { 2000 return (runMapping(new MapBooleanAction("isShowing") { 2001 @Override 2002 public boolean map() { 2003 return getSource().isShowing(); 2004 } 2005 })); 2006 } 2007 2008 /** 2009 * Maps {@code Component.isValid()} through queue 2010 */ 2011 public boolean isValid() { 2012 return (runMapping(new MapBooleanAction("isValid") { 2013 @Override 2014 public boolean map() { 2015 return getSource().isValid(); 2016 } 2017 })); 2018 } 2019 2020 /** 2021 * Maps {@code Component.isVisible()} through queue 2022 */ 2023 public boolean isVisible() { 2024 return (runMapping(new MapBooleanAction("isVisible") { 2025 @Override 2026 public boolean map() { 2027 return getSource().isVisible(); 2028 } 2029 })); 2030 } 2031 2032 /** 2033 * Maps {@code Component.list()} through queue 2034 */ 2035 public void list() { 2036 runMapping(new MapVoidAction("list") { 2037 @Override 2038 public void map() { 2039 getSource().list(); 2040 } 2041 }); 2042 } 2043 2044 /** 2045 * Maps {@code Component.list(PrintStream)} through queue 2046 */ 2047 public void list(final PrintStream printStream) { 2048 runMapping(new MapVoidAction("list") { 2049 @Override 2050 public void map() { 2051 getSource().list(printStream); 2052 } 2053 }); 2054 } 2055 2056 /** 2057 * Maps {@code Component.list(PrintStream, int)} through queue 2058 */ 2059 public void list(final PrintStream printStream, final int i) { 2060 runMapping(new MapVoidAction("list") { 2061 @Override 2062 public void map() { 2063 getSource().list(printStream, i); 2064 } 2065 }); 2066 } 2067 2068 /** 2069 * Maps {@code Component.list(PrintWriter)} through queue 2070 */ 2071 public void list(final PrintWriter printWriter) { 2072 runMapping(new MapVoidAction("list") { 2073 @Override 2074 public void map() { 2075 getSource().list(printWriter); 2076 } 2077 }); 2078 } 2079 2080 /** 2081 * Maps {@code Component.list(PrintWriter, int)} through queue 2082 */ 2083 public void list(final PrintWriter printWriter, final int i) { 2084 runMapping(new MapVoidAction("list") { 2085 @Override 2086 public void map() { 2087 getSource().list(printWriter, i); 2088 } 2089 }); 2090 } 2091 2092 /** 2093 * Maps {@code Component.paint(Graphics)} through queue 2094 */ 2095 public void paint(final Graphics graphics) { 2096 runMapping(new MapVoidAction("paint") { 2097 @Override 2098 public void map() { 2099 getSource().paint(graphics); 2100 } 2101 }); 2102 } 2103 2104 /** 2105 * Maps {@code Component.paintAll(Graphics)} through queue 2106 */ 2107 public void paintAll(final Graphics graphics) { 2108 runMapping(new MapVoidAction("paintAll") { 2109 @Override 2110 public void map() { 2111 getSource().paintAll(graphics); 2112 } 2113 }); 2114 } 2115 2116 /** 2117 * Maps {@code Component.prepareImage(Image, int, int, ImageObserver)} 2118 * through queue 2119 */ 2120 public boolean prepareImage(final Image image, final int i, final int i1, final ImageObserver imageObserver) { 2121 return (runMapping(new MapBooleanAction("prepareImage") { 2122 @Override 2123 public boolean map() { 2124 return getSource().prepareImage(image, i, i1, imageObserver); 2125 } 2126 })); 2127 } 2128 2129 /** 2130 * Maps {@code Component.prepareImage(Image, ImageObserver)} through queue 2131 */ 2132 public boolean prepareImage(final Image image, final ImageObserver imageObserver) { 2133 return (runMapping(new MapBooleanAction("prepareImage") { 2134 @Override 2135 public boolean map() { 2136 return getSource().prepareImage(image, imageObserver); 2137 } 2138 })); 2139 } 2140 2141 /** 2142 * Maps {@code Component.print(Graphics)} through queue 2143 */ 2144 public void print(final Graphics graphics) { 2145 runMapping(new MapVoidAction("print") { 2146 @Override 2147 public void map() { 2148 getSource().print(graphics); 2149 } 2150 }); 2151 } 2152 2153 /** 2154 * Maps {@code Component.printAll(Graphics)} through queue 2155 */ 2156 public void printAll(final Graphics graphics) { 2157 runMapping(new MapVoidAction("printAll") { 2158 @Override 2159 public void map() { 2160 getSource().printAll(graphics); 2161 } 2162 }); 2163 } 2164 2165 /** 2166 * Maps {@code Component.remove(MenuComponent)} through queue 2167 */ 2168 public void remove(final MenuComponent menuComponent) { 2169 runMapping(new MapVoidAction("remove") { 2170 @Override 2171 public void map() { 2172 getSource().remove(menuComponent); 2173 } 2174 }); 2175 } 2176 2177 /** 2178 * Maps {@code Component.removeComponentListener(ComponentListener)} 2179 * through queue 2180 */ 2181 public void removeComponentListener(final ComponentListener componentListener) { 2182 runMapping(new MapVoidAction("removeComponentListener") { 2183 @Override 2184 public void map() { 2185 getSource().removeComponentListener(componentListener); 2186 } 2187 }); 2188 } 2189 2190 /** 2191 * Maps {@code Component.removeFocusListener(FocusListener)} through queue 2192 */ 2193 public void removeFocusListener(final FocusListener focusListener) { 2194 runMapping(new MapVoidAction("removeFocusListener") { 2195 @Override 2196 public void map() { 2197 getSource().removeFocusListener(focusListener); 2198 } 2199 }); 2200 } 2201 2202 /** 2203 * Maps 2204 * {@code Component.removeInputMethodListener(InputMethodListener)} 2205 * through queue 2206 */ 2207 public void removeInputMethodListener(final InputMethodListener inputMethodListener) { 2208 runMapping(new MapVoidAction("removeInputMethodListener") { 2209 @Override 2210 public void map() { 2211 getSource().removeInputMethodListener(inputMethodListener); 2212 } 2213 }); 2214 } 2215 2216 /** 2217 * Maps {@code Component.removeKeyListener(KeyListener)} through queue 2218 */ 2219 public void removeKeyListener(final KeyListener keyListener) { 2220 runMapping(new MapVoidAction("removeKeyListener") { 2221 @Override 2222 public void map() { 2223 getSource().removeKeyListener(keyListener); 2224 } 2225 }); 2226 } 2227 2228 /** 2229 * Maps {@code Component.removeMouseListener(MouseListener)} through queue 2230 */ 2231 public void removeMouseListener(final MouseListener mouseListener) { 2232 runMapping(new MapVoidAction("removeMouseListener") { 2233 @Override 2234 public void map() { 2235 getSource().removeMouseListener(mouseListener); 2236 } 2237 }); 2238 } 2239 2240 /** 2241 * Maps 2242 * {@code Component.removeMouseMotionListener(MouseMotionListener)} 2243 * through queue 2244 */ 2245 public void removeMouseMotionListener(final MouseMotionListener mouseMotionListener) { 2246 runMapping(new MapVoidAction("removeMouseMotionListener") { 2247 @Override 2248 public void map() { 2249 getSource().removeMouseMotionListener(mouseMotionListener); 2250 } 2251 }); 2252 } 2253 2254 /** 2255 * Maps {@code Component.removeNotify()} through queue 2256 */ 2257 public void removeNotify() { 2258 runMapping(new MapVoidAction("removeNotify") { 2259 @Override 2260 public void map() { 2261 getSource().removeNotify(); 2262 } 2263 }); 2264 } 2265 2266 /** 2267 * Maps 2268 * {@code Component.removePropertyChangeListener(PropertyChangeListener)} 2269 * through queue 2270 */ 2271 public void removePropertyChangeListener(final PropertyChangeListener propertyChangeListener) { 2272 runMapping(new MapVoidAction("removePropertyChangeListener") { 2273 @Override 2274 public void map() { 2275 getSource().removePropertyChangeListener(propertyChangeListener); 2276 } 2277 }); 2278 } 2279 2280 /** 2281 * Maps 2282 * {@code Component.removePropertyChangeListener(String, PropertyChangeListener)} 2283 * through queue 2284 */ 2285 public void removePropertyChangeListener(final String string, final PropertyChangeListener propertyChangeListener) { 2286 runMapping(new MapVoidAction("removePropertyChangeListener") { 2287 @Override 2288 public void map() { 2289 getSource().removePropertyChangeListener(string, propertyChangeListener); 2290 } 2291 }); 2292 } 2293 2294 /** 2295 * Maps {@code Component.repaint()} through queue 2296 */ 2297 public void repaint() { 2298 runMapping(new MapVoidAction("repaint") { 2299 @Override 2300 public void map() { 2301 getSource().repaint(); 2302 } 2303 }); 2304 } 2305 2306 /** 2307 * Maps {@code Component.repaint(int, int, int, int)} through queue 2308 */ 2309 public void repaint(final int i, final int i1, final int i2, final int i3) { 2310 runMapping(new MapVoidAction("repaint") { 2311 @Override 2312 public void map() { 2313 getSource().repaint(i, i1, i2, i3); 2314 } 2315 }); 2316 } 2317 2318 /** 2319 * Maps {@code Component.repaint(long)} through queue 2320 */ 2321 public void repaint(final long l) { 2322 runMapping(new MapVoidAction("repaint") { 2323 @Override 2324 public void map() { 2325 getSource().repaint(l); 2326 } 2327 }); 2328 } 2329 2330 /** 2331 * Maps {@code Component.repaint(long, int, int, int, int)} through queue 2332 */ 2333 public void repaint(final long l, final int i, final int i1, final int i2, final int i3) { 2334 runMapping(new MapVoidAction("repaint") { 2335 @Override 2336 public void map() { 2337 getSource().repaint(l, i, i1, i2, i3); 2338 } 2339 }); 2340 } 2341 2342 /** 2343 * Maps {@code Component.requestFocus()} through queue 2344 */ 2345 public void requestFocus() { 2346 runMapping(new MapVoidAction("requestFocus") { 2347 @Override 2348 public void map() { 2349 getSource().requestFocus(); 2350 } 2351 }); 2352 } 2353 2354 /** 2355 * Maps {@code Component.setBackground(Color)} through queue 2356 */ 2357 public void setBackground(final Color color) { 2358 runMapping(new MapVoidAction("setBackground") { 2359 @Override 2360 public void map() { 2361 getSource().setBackground(color); 2362 } 2363 }); 2364 } 2365 2366 /** 2367 * Maps {@code Component.setBounds(int, int, int, int)} through queue 2368 */ 2369 public void setBounds(final int i, final int i1, final int i2, final int i3) { 2370 runMapping(new MapVoidAction("setBounds") { 2371 @Override 2372 public void map() { 2373 getSource().setBounds(i, i1, i2, i3); 2374 } 2375 }); 2376 } 2377 2378 /** 2379 * Maps {@code Component.setBounds(Rectangle)} through queue 2380 */ 2381 public void setBounds(final Rectangle rectangle) { 2382 runMapping(new MapVoidAction("setBounds") { 2383 @Override 2384 public void map() { 2385 getSource().setBounds(rectangle); 2386 } 2387 }); 2388 } 2389 2390 /** 2391 * Maps {@code Component.setComponentOrientation(ComponentOrientation)} 2392 * through queue 2393 */ 2394 public void setComponentOrientation(final ComponentOrientation componentOrientation) { 2395 runMapping(new MapVoidAction("setComponentOrientation") { 2396 @Override 2397 public void map() { 2398 getSource().setComponentOrientation(componentOrientation); 2399 } 2400 }); 2401 } 2402 2403 /** 2404 * Maps {@code Component.setCursor(Cursor)} through queue 2405 */ 2406 public void setCursor(final Cursor cursor) { 2407 runMapping(new MapVoidAction("setCursor") { 2408 @Override 2409 public void map() { 2410 getSource().setCursor(cursor); 2411 } 2412 }); 2413 } 2414 2415 /** 2416 * Maps {@code Component.setDropTarget(DropTarget)} through queue 2417 */ 2418 public void setDropTarget(final DropTarget dropTarget) { 2419 runMapping(new MapVoidAction("setDropTarget") { 2420 @Override 2421 public void map() { 2422 getSource().setDropTarget(dropTarget); 2423 } 2424 }); 2425 } 2426 2427 /** 2428 * Maps {@code Component.setEnabled(boolean)} through queue 2429 */ 2430 public void setEnabled(final boolean b) { 2431 runMapping(new MapVoidAction("setEnabled") { 2432 @Override 2433 public void map() { 2434 getSource().setEnabled(b); 2435 } 2436 }); 2437 } 2438 2439 /** 2440 * Maps {@code Component.setFont(Font)} through queue 2441 */ 2442 public void setFont(final Font font) { 2443 runMapping(new MapVoidAction("setFont") { 2444 @Override 2445 public void map() { 2446 getSource().setFont(font); 2447 } 2448 }); 2449 } 2450 2451 /** 2452 * Maps {@code Component.setForeground(Color)} through queue 2453 */ 2454 public void setForeground(final Color color) { 2455 runMapping(new MapVoidAction("setForeground") { 2456 @Override 2457 public void map() { 2458 getSource().setForeground(color); 2459 } 2460 }); 2461 } 2462 2463 /** 2464 * Maps {@code Component.setLocale(Locale)} through queue 2465 */ 2466 public void setLocale(final Locale locale) { 2467 runMapping(new MapVoidAction("setLocale") { 2468 @Override 2469 public void map() { 2470 getSource().setLocale(locale); 2471 } 2472 }); 2473 } 2474 2475 /** 2476 * Maps {@code Component.setLocation(int, int)} through queue 2477 */ 2478 public void setLocation(final int i, final int i1) { 2479 runMapping(new MapVoidAction("setLocation") { 2480 @Override 2481 public void map() { 2482 getSource().setLocation(i, i1); 2483 } 2484 }); 2485 } 2486 2487 /** 2488 * Maps {@code Component.setLocation(Point)} through queue 2489 */ 2490 public void setLocation(final Point point) { 2491 runMapping(new MapVoidAction("setLocation") { 2492 @Override 2493 public void map() { 2494 getSource().setLocation(point); 2495 } 2496 }); 2497 } 2498 2499 /** 2500 * Maps {@code Component.setName(String)} through queue 2501 */ 2502 public void setName(final String string) { 2503 runMapping(new MapVoidAction("setName") { 2504 @Override 2505 public void map() { 2506 getSource().setName(string); 2507 } 2508 }); 2509 } 2510 2511 /** 2512 * Maps {@code Component.setSize(int, int)} through queue 2513 */ 2514 public void setSize(final int i, final int i1) { 2515 runMapping(new MapVoidAction("setSize") { 2516 @Override 2517 public void map() { 2518 getSource().setSize(i, i1); 2519 } 2520 }); 2521 } 2522 2523 /** 2524 * Maps {@code Component.setSize(Dimension)} through queue 2525 */ 2526 public void setSize(final Dimension dimension) { 2527 runMapping(new MapVoidAction("setSize") { 2528 @Override 2529 public void map() { 2530 getSource().setSize(dimension); 2531 } 2532 }); 2533 } 2534 2535 /** 2536 * Maps {@code Component.setVisible(boolean)} through queue 2537 */ 2538 public void setVisible(final boolean b) { 2539 runMapping(new MapVoidAction("setVisible") { 2540 @Override 2541 public void map() { 2542 getSource().setVisible(b); 2543 } 2544 }); 2545 } 2546 2547 /** 2548 * Maps {@code Component.transferFocus()} through queue 2549 */ 2550 public void transferFocus() { 2551 runMapping(new MapVoidAction("transferFocus") { 2552 @Override 2553 public void map() { 2554 getSource().transferFocus(); 2555 } 2556 }); 2557 } 2558 2559 /** 2560 * Maps {@code Component.update(Graphics)} through queue 2561 */ 2562 public void update(final Graphics graphics) { 2563 runMapping(new MapVoidAction("update") { 2564 @Override 2565 public void map() { 2566 getSource().update(graphics); 2567 } 2568 }); 2569 } 2570 2571 /** 2572 * Maps {@code Component.validate()} through queue 2573 */ 2574 public void validate() { 2575 runMapping(new MapVoidAction("validate") { 2576 @Override 2577 public void map() { 2578 getSource().validate(); 2579 } 2580 }); 2581 } 2582 2583 //End of mapping // 2584 //////////////////////////////////////////////////////// 2585 private void setEventDispatcher(EventDispatcher dispatcher) { 2586 dispatcher.setOutput(getOutput().createErrorOutput()); 2587 dispatcher.setTimeouts(getTimeouts()); 2588 this.dispatcher = dispatcher; 2589 } 2590 2591 static class VisibleComponentFinder implements ComponentChooser { 2592 2593 ComponentChooser subFinder; 2594 2595 public VisibleComponentFinder(ComponentChooser sf) { 2596 subFinder = sf; 2597 } 2598 2599 @Override 2600 public boolean checkComponent(Component comp) { 2601 if (comp.isShowing()) { 2602 return subFinder.checkComponent(comp); 2603 } 2604 return false; 2605 } 2606 2607 @Override 2608 public String getDescription() { 2609 return subFinder.getDescription(); 2610 } 2611 2612 @Override 2613 public String toString() { 2614 return "VisibleComponentFinder{" + "subFinder=" + subFinder + '}'; 2615 } 2616 } 2617 2618 }