Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.netbeans.jemmy
Class EventTool

    java.lang.Object
      |
      +--org.netbeans.jemmy.EventTool

All Implemented Interfaces:
  Outputable, Timeoutable

public class EventTool
extends java.lang.Object
implements Timeoutable, Outputable

Provides methods to check last dispatched events, to wait for events of specific types, or to guarantee that events of specific types are not dispatched during some time frame.
All possible listeners are added during this class initialization in case if "jemmy.event_listening" system property is not equal to "no", so, by default, all events are listened. Uses timeouts:
EventTool.WaitEventTimeout - time to wait for AWT events.
EventTool.WaitNoEventTimeout - when checking for the absence of incoming AWT events.
EventTool.EventCheckingDelta - time delta between checks for AWT events.

Author:
  Alexandre Iline (alexandre.iline@sun.com)

Constructor Summary
`EventTool()` Constructor.

Method Summary
`static void` | `addListeners()` Adds listeners to listen all types of events.
`static void` | `addListeners(long eventMask)` Adds listeners to listen events under mask.
`boolean` | `checkNoEvent(long waitTime)` Check that no event will be dispatched during time specified.
`boolean` | `checkNoEvent(long eventMask, long waitTime)` Check that no event under mask will be dispatched during time specified.
`static long` | `getCurrentEventMask()` Returns event mask last time used by `addListeners(long)` method.
`static java.awt.AWTEvent` | `getLastEvent()` Returns last dispatched event.
`static java.awt.AWTEvent` | `getLastEvent(long eventMask)` Returns last dispatched event under mask.
`static long` | `getLastEventTime()` Returns time of the last dispatched event.
`static long` | `getLastEventTime(long eventMask)` Returns time of the last dispatched event under mask.
`TestOut` | `getOutput()` Returns print output streams or writers.
`static long` | `getTheWholeEventMask()` Returns a combination of all `AWTEvent.*_EVENT_MASK` fields..
`Timeouts` | `getTimeouts()` Return current timeouts.
`static void` | `removeListeners()` Removes all listeners.
`void` | `setOutput(TestOut out)` Defines print output streams or writers.
`void` | `setTimeouts(Timeouts ts)` Defines current timeouts.
`java.awt.AWTEvent` | `waitEvent()` Waits for the first event.
`java.awt.AWTEvent` | `waitEvent(long eventMask)` Waits for the first event under mask.
`void` | `waitNoEvent(long waitTime)` During `EventTool.WaitNoEventTimeout` time waits for true result of `checkNoEvent(long)` method.
`void` | `waitNoEvent(long eventMask, long waitTime)` During `EventTool.WaitNoEventTimeout` time waits for true result of checkNoEvent(long, long) method.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EventTool

    public EventTool()

  Constructor.

Method Detail

### getLastEventTime

    public static long getLastEventTime(long eventMask)

  Returns time of the last dispatched event under mask.
  Parameters:
    `eventMask` - Events types to be searched. `AWTEvent.*_EVENT_MASK` fields combination.
  Returns:
    time in milliseconds
  See Also:
    `addListeners(long)`

### getLastEvent

    public static java.awt.AWTEvent getLastEvent(long eventMask)

  Returns last dispatched event under mask.
  Parameters:
    `eventMask` - Events types to be searched. `AWTEvent.*_EVENT_MASK` fields combination.
  Returns:
    AWTEvent
  See Also:
    `addListeners(long)`

### getLastEventTime

    public static long getLastEventTime()

  Returns time of the last dispatched event.
  Returns:
    time in milliseconds
  See Also:
    `addListeners(long)`

### getLastEvent

    public static java.awt.AWTEvent getLastEvent()

  Returns last dispatched event.
  Returns:
    AWTEvent
  See Also:
    `addListeners(long)`

### addListeners

    public static void addListeners(long eventMask)

  Adds listeners to listen events under mask. Invokes `removeListeners()` first, so any event history is lost.
  Parameters:
    `eventMask` - Mask to listen events under. `AWTEvent.*_EVENT_MASK` fields combination.
  See Also:
    `addListeners()`, `removeListeners()`

### addListeners

    public static void addListeners()

  Adds listeners to listen all types of events. Invokes `removeListeners()` first, so any event history is lost. This method is invoked during static section of this class.
  See Also:
    `addListeners(long)`, `removeListeners()`, `getTheWholeEventMask()`

### removeListeners

    public static void removeListeners()

  Removes all listeners.
  See Also:
    `addListeners(long)`, `addListeners()`

### getCurrentEventMask

    public static long getCurrentEventMask()

  Returns event mask last time used by `addListeners(long)` method. In case if `addListeners()` method was used last, `getTheWholeEventMask()` result is returned.
  Returns:
    a long representing the current event mask value
  See Also:
    `getTheWholeEventMask()`

### getTheWholeEventMask

    public static long getTheWholeEventMask()

  Returns a combination of all `AWTEvent.*_EVENT_MASK` fields..
  Returns:
    a combination of all `AWTEvent.*_EVENT_MASK` fields.

### setTimeouts

    public void setTimeouts(Timeouts ts)

  Defines current timeouts.
  Specified by:
    `setTimeouts` in interface `Timeoutable`
  Parameters:
    `ts` - ?t? A collection of timeout assignments.
  See Also:
    `Timeouts`, `Timeoutable`, `getTimeouts()`

### getTimeouts

    public Timeouts getTimeouts()

  Return current timeouts.
  Specified by:
    `getTimeouts` in interface `Timeoutable`
  Returns:
    the collection of current timeout assignments.
  See Also:
    `Timeouts`, `Timeoutable`, `setTimeouts(org.netbeans.jemmy.Timeouts)`

### setOutput

    public void setOutput(TestOut out)

  Defines print output streams or writers.
  Specified by:
    `setOutput` in interface `Outputable`
  Parameters:
    `out` - Identify the streams or writers used for print output.
  See Also:
    `Outputable`, `TestOut`, `getOutput()`

### getOutput

    public TestOut getOutput()

  Returns print output streams or writers.
  Specified by:
    `getOutput` in interface `Outputable`
  Returns:
    an object that contains references to objects for printing to output and err streams.
  See Also:
    `Outputable`, `TestOut`, `setOutput(org.netbeans.jemmy.TestOut)`

### waitEvent

    public java.awt.AWTEvent waitEvent(long eventMask)

  Waits for the first event under mask. Waits during `EventTool.WaitEventTimeout` milliseconds.
  Parameters:
    `eventMask` - Mask to wait events under. `AWTEvent.*_EVENT_MASK` fields combination.
  Returns:
    an AWTEvent object
  Throws:
    `TimeoutExpiredException` -
  See Also:
    `waitEvent()`

### waitEvent

    public java.awt.AWTEvent waitEvent()

  Waits for the first event. Waits during `EventTool.WaitEventTimeout` milliseconds.
  Returns:
    an AWTEvent object
  Throws:
    `TimeoutExpiredException` -
  See Also:
    `waitEvent(long)`, `getTheWholeEventMask()`

### checkNoEvent

    public boolean checkNoEvent(long eventMask,
                                long waitTime)

  Check that no event under mask will be dispatched during time specified.
  Parameters:
    `eventMask` - Mask to wait events under. `AWTEvent.*_EVENT_MASK` fields combination.
    `waitTime` - Quiet time (millisecons).
  Returns:
    true if no event ahs found.
  See Also:
    `checkNoEvent(long)`

### checkNoEvent

    public boolean checkNoEvent(long waitTime)

  Check that no event will be dispatched during time specified.
  Parameters:
    `waitTime` - Quiet time (millisecons).
  Returns:
    true if no event ahs found.
  See Also:
    `checkNoEvent(long, long)`, `getTheWholeEventMask()`

### waitNoEvent

    public void waitNoEvent(long eventMask,
                            long waitTime)

  During `EventTool.WaitNoEventTimeout` time waits for true result of checkNoEvent(long, long) method.
  Parameters:
    `eventMask` - Mask to wait events under. `AWTEvent.*_EVENT_MASK` fields combination.
    `waitTime` - Quiet time (millisecons).
  Throws:
    `TimeoutExpiredException` -
  See Also:
    `checkNoEvent(long, long)`, `waitNoEvent(long)`

### waitNoEvent

    public void waitNoEvent(long waitTime)

  During `EventTool.WaitNoEventTimeout` time waits for true result of `checkNoEvent(long)` method.
  Parameters:
    `waitTime` - Quiet time (millisecons).
  Throws:
    `TimeoutExpiredException` -
  See Also:
    `checkNoEvent(long)`, `waitNoEvent(long, long)`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD