| java.lang.Object org.netbeans.jemmy.EventDispatcher
EventDispatcher | public class EventDispatcher implements Outputable,Timeoutable(Code) | | Provides low level functions for reproducing user actions.
One dispatch model uses the managed component's event queue to dispatch
events. The other dispatch model uses java.awt.Robot to
generate native events. It is an option in the Robot dispatch model
to wait for the managed component's event queue to empty before dispatching
events.
Timeouts used:
EventDispatcher.WaitQueueEmptyTimeout - to wait event queue empty.
EventDispatcher.RobotAutoDelay - param for java.awt.Robot.setAutoDelay method.
EventDispatcher.WaitComponentUnderMouseTimeout - time to wait component under mouse.
See Also: org.netbeans.jemmy.Timeouts author: Alexandre Iline (alexandre.iline@sun.com) |
Method Summary | |
public void | checkComponentUnderMouse(boolean yesOrNo) Wait (or not) for the mouse to move over a Java component before pressing.
This option is relevant when using java.awt.Robot to generate
mouse events. | public void | delayRobot(long time) Delays robot. | public void | dispatchEvent(AWTEvent event) Dispatches AWTEvent to component passed in constructor. | public void | dispatchKeyEvent(int id, int mods, int keyCode) Dispatches KeyEvent. | public void | dispatchKeyEvent(int id, int mods, int keyCode, char keyChar) Dispatches KeyEvent. | public void | dispatchMouseEvent(int id, int mods, int clickCount, int x, int y, boolean popup) Dispatches a MouseEvent. | public void | dispatchMouseEvent(int id, int mods, int clickCount, boolean popup) Dispatches MouseEvent at the center of component. | public void | dispatchWindowEvent(int id) Dispatches WindowEvent. | protected int | getAbsoluteX(int x) Bind horizontal relative cursor coordinate to screen coordinate. | protected int | getAbsoluteY(int y) Bind vertical relative cursor coordinate to screen coordinate. | public int | getDispatchingModel() Gets the dispatching model value. | public Object | getExistingField(String field_name, TestOut out) Gets component field value through SwingUtilities.invokeAndWait(Runnable) .
and catch all exceptions.
Parameters: field_name - Name of a field Parameters: out - TestOut instance to print exceptions stack trace to. | public Object | getExistingField(String field_name) Gets component field value through SwingUtilities.invokeAndWait(Runnable) . | public Object | getField(String field_name) Gets component field value through SwingUtilities.invokeAndWait(Runnable) . | public static String | getKeyDescription(int keyCode) Returns a string representation for a keyboard event. | public static String | getModifiersString(int modifiers) Get a string representation for key modifiers.
Used to print trace.
Parameters: modifiers - Bit mask of keyboard event modifiers. | public static String | getMouseButtonDescription(int button) Returns a mouse button string representation.
Used to print trace.
Parameters: button - Mouse button (InputEvent.BUTTON1/2/3_MASK value). | public TestOut | getOutput() Returns print output streams or writers. | public Timeouts | getTimeouts() Return current timeouts. | public Object | invokeExistingMethod(String method_name, Object[] params, Class[] params_classes, TestOut out) Invokes component method through SwingUtilities.invokeAndWait(Runnable) .
and catch all exceptions.
Parameters: method_name - Name of a method to be invoked Parameters: params - Method params Parameters: params_classes - Method params' classes Parameters: out - TestOut instance to print exceptions stack trace to. | public Object | invokeExistingMethod(String method_name, Object[] params, Class[] params_classes) Invokes component method through SwingUtilities.invokeAndWait(Runnable) . | public Object | invokeMethod(String method_name, Object[] params, Class[] params_classes) Invokes component method through SwingUtilities.invokeAndWait(Runnable) . | public void | robotMoveMouse(int x, int y) Moves mouse by robot. | public void | robotPressKey(int keyCode, int modifiers) Press a key using java.awt.Robot . | public void | robotPressKey(int keyCode) Press key with no modifiers using java.awt.Robot . | public void | robotPressMouse(int button, int modifiers) Press mouse button by robot. | public void | robotPressMouse(int button) Press mouse button with 0 modifiers. | public void | robotReleaseKey(int keyCode, int modifiers) Releases key by robot. | public void | robotReleaseKey(int keyCode) Releases key with 0 modifiers. | public void | robotReleaseMouse(int button, int modifiers) Releases mouse button by robot. | public void | robotReleaseMouse(int button) Releases mouse button with 0 modifiers. | public void | setDispatchingModel(int m) Defines dispatching model. | public void | setExistingField(String field_name, Object newValue, TestOut out) Sets component field value through SwingUtilities.invokeAndWait(Runnable) . | public void | setExistingField(String field_name, Object newValue) Sets component field value through SwingUtilities.invokeAndWait(Runnable) . | public void | setField(String field_name, Object newValue) Sets component field value through SwingUtilities.invokeAndWait(Runnable) . | public void | setOutput(TestOut out) Defines print output streams or writers. | public void | setTimeouts(Timeouts timeouts) Defines current timeouts. | public void | waitForIdle() Waits until all events currently on the event queue have been processed. | public static void | waitQueueEmpty(TestOut output, Timeouts timeouts) Waits for the managed component's java.awt.EventQueue to empty. | public static void | waitQueueEmpty() Waits for the managed component's java.awt.EventQueue to empty.
Uses default output and timeouts. | public static void | waitQueueEmpty(long emptyTime, TestOut output, Timeouts timeouts) Waits for the managed component's java.awt.EventQueue to stay empty. | public static void | waitQueueEmpty(long emptyTime) Waits for the managed component's java.awt.EventQueue to stay empty.
Uses default output and timeouts. |
component | protected Component component(Code) | | Component to dispatch events to.
|
EventDispatcher | public EventDispatcher(Component comp)(Code) | | Constructor.
Parameters: comp - Component to operate with. |
checkComponentUnderMouse | public void checkComponentUnderMouse(boolean yesOrNo)(Code) | | Wait (or not) for the mouse to move over a Java component before pressing.
This option is relevant when using java.awt.Robot to generate
mouse events. If a mouse press occurs at a position not occupied by a
known Java component then a NoComponentUnderMouseException
will be thrown.
Parameters: yesOrNo - if true then the test system will wait forthe mouse to move over a Java component before pressing.therwise, mouse presses can take place anywhere on the screen. |
delayRobot | public void delayRobot(long time)(Code) | | Delays robot.
Parameters: time - Time to dalay robot for. |
dispatchEvent | public void dispatchEvent(AWTEvent event)(Code) | | Dispatches AWTEvent to component passed in constructor.
If (getDispatchingModel & JemmyProperties.QUEUE_MODEL_MASK) == 0
dispatched event directly, otherwise uses
javax.swing.SwingUtilities.invokeAndWait(Runnable)
Parameters: event - AWTEvent instance to be dispatched. throws: ComponentIsNotVisibleException - throws: ComponentIsNotFocusedException - |
dispatchKeyEvent | public void dispatchKeyEvent(int id, int mods, int keyCode)(Code) | | Dispatches KeyEvent.
See Also: EventDispatcher.dispatchEvent(AWTEvent) Parameters: id - KeyEvent.KEY_PRESSED or KeyEvent.KEY_RELEASED value. Parameters: mods - Modifiers. Parameters: keyCode - Key code, |
dispatchKeyEvent | public void dispatchKeyEvent(int id, int mods, int keyCode, char keyChar)(Code) | | Dispatches KeyEvent.
See Also: EventDispatcher.dispatchEvent(AWTEvent) Parameters: id - KeyEvent.KEY_TYPED value. Parameters: mods - Modifiers. Parameters: keyCode - Key code, Parameters: keyChar - Char to be tiped |
dispatchMouseEvent | public void dispatchMouseEvent(int id, int mods, int clickCount, int x, int y, boolean popup)(Code) | | Dispatches a MouseEvent.
See Also: EventDispatcher.dispatchEvent(AWTEvent) Parameters: id - MouseEvent.MOUSE_* value Parameters: mods - InputEvent.MOUSE1/2/3_BUTTON | (modiviers value) Parameters: clickCount - Click count Parameters: x - Horizontal click point coordinate. Parameters: y - vertical click point coordinate. Parameters: popup - Difines if mouse event is popup event. |
dispatchMouseEvent | public void dispatchMouseEvent(int id, int mods, int clickCount, boolean popup)(Code) | | Dispatches MouseEvent at the center of component.
See Also: EventDispatcher.dispatchEvent(AWTEvent) Parameters: id - MouseEvent.MOUSE_* value Parameters: mods - InputEvent.MOUSE1/2/3_BUTTON | (modiviers value) Parameters: clickCount - Click count Parameters: popup - Difines if mouse event is popup event. |
getAbsoluteX | protected int getAbsoluteX(int x)(Code) | | Bind horizontal relative cursor coordinate to screen coordinate.
Parameters: x - Relative coordinate Absolute coordinate |
getAbsoluteY | protected int getAbsoluteY(int y)(Code) | | Bind vertical relative cursor coordinate to screen coordinate.
Parameters: y - Relative coordinate Absolute coordinate |
getKeyDescription | public static String getKeyDescription(int keyCode)(Code) | | Returns a string representation for a keyboard event.
Used to print trace.
Parameters: keyCode - Key code (KeyEvent.VK_* value) the KeyEvent field name. |
getModifiersString | public static String getModifiersString(int modifiers)(Code) | | Get a string representation for key modifiers.
Used to print trace.
Parameters: modifiers - Bit mask of keyboard event modifiers. a string representation for the keyboard event modifiers. |
getMouseButtonDescription | public static String getMouseButtonDescription(int button)(Code) | | Returns a mouse button string representation.
Used to print trace.
Parameters: button - Mouse button (InputEvent.BUTTON1/2/3_MASK value). InputEvent field name. |
robotMoveMouse | public void robotMoveMouse(int x, int y)(Code) | | Moves mouse by robot.
Parameters: x - Component relative horizontal coordinate. Parameters: y - Component relative vertical coordinate. throws: ComponentIsNotVisibleException - |
robotPressMouse | public void robotPressMouse(int button, int modifiers)(Code) | | Press mouse button by robot.
Parameters: button - Mouse button (InputEvent.MOUSE1/2/3_BUTTON value) Parameters: modifiers - Modifiers throws: ComponentIsNotVisibleException - |
robotReleaseMouse | public void robotReleaseMouse(int button, int modifiers)(Code) | | Releases mouse button by robot.
Parameters: button - Mouse button (InputEvent.MOUSE1/2/3_BUTTON value) Parameters: modifiers - Modifiers throws: ComponentIsNotVisibleException - |
waitForIdle | public void waitForIdle()(Code) | | Waits until all events currently on the event queue have been processed.
|
waitQueueEmpty | public static void waitQueueEmpty(TestOut output, Timeouts timeouts)(Code) | | Waits for the managed component's java.awt.EventQueue to empty.
The timeout for this wait is EventDispatcher.WaitQueueEmptyTimeout.
Parameters: output - Output to print exception into. Parameters: timeouts - A collection of timeout assignments. throws: TimeoutExpiredException - See Also: org.netbeans.jemmy.QueueTool |
waitQueueEmpty | public static void waitQueueEmpty()(Code) | | Waits for the managed component's java.awt.EventQueue to empty.
Uses default output and timeouts. The timeout for this wait is
EventDispatcher.WaitQueueEmptyTimeout.
See Also: QueueTool throws: TimeoutExpiredException - |
waitQueueEmpty | public static void waitQueueEmpty(long emptyTime, TestOut output, Timeouts timeouts)(Code) | | Waits for the managed component's java.awt.EventQueue to stay empty.
The timeout for this wait is EventDispatcher.WaitQueueEmptyTimeout.
Parameters: emptyTime - The time that the event queue has to stay empty to avoida TimeoutExpiredException. Parameters: output - Output to print exception into Parameters: timeouts - A collection of timeout assignments. throws: TimeoutExpiredException - See Also: org.netbeans.jemmy.QueueTool |
waitQueueEmpty | public static void waitQueueEmpty(long emptyTime)(Code) | | Waits for the managed component's java.awt.EventQueue to stay empty.
Uses default output and timeouts. The timeout for this wait is
EventDispatcher.WaitQueueEmptyTimeout.
Parameters: emptyTime - The time that the event queue has to stay empty to avoida TimeoutExpiredException. throws: TimeoutExpiredException - See Also: org.netbeans.jemmy.QueueTool |
|
|