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 Waiter

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

All Implemented Interfaces:
  Outputable, Timeoutable, Waitable

Direct Known Subclasses:
  WindowWaiter

public class Waiter
extends java.lang.Object
implements Waitable, Timeoutable, Outputable

Waits for something defined by Waitable interface to be happened.
Timeouts used:
Waiter.TimeDelta - time delta to check actionProduced result.
Waiter.WaitingTime - maximal waiting time
Waiter.AfterWaitingTime - time to sleep after waiting has been finished.

Author:
  Alexandre Iline (alexandre.iline@sun.com)
See Also:
  `Timeouts`, `Waitable`

Constructor Summary
`protected` | `Waiter()` Can be used from subclass.
`` | `Waiter(Waitable w)` Constructor.

Method Summary
`java.lang.Object` | `actionProduced(java.lang.Object obj)` Checks if wait criteria have been met.
`protected java.lang.String` | `getActionProducedMessage(long timeSpent, java.lang.Object result)` Returns message to be printed when waiting has been successfully finished.
`java.lang.String` | `getDescription()` Returns description.
`protected java.lang.String` | `getGoldenActionProducedMessage()` Returns message to be printed int golden output when waiting has been successfully finished.
`protected java.lang.String` | `getGoldenTimeoutExpiredMessage()` Returns message to be printed int golden output when waiting timeout has been expired.
`protected java.lang.String` | `getGoldenWaitingStartedMessage()` Returns message to be printed int golden output before waiting start.
`TestOut` | `getOutput()` Returns print output streams or writers.
`protected java.lang.String` | `getTimeoutExpiredMessage(long timeSpent)` Returns message to be printed when waiting timeout has been expired.
`Timeouts` | `getTimeouts()` Return current timeouts.
`protected java.lang.String` | `getWaitingStartedMessage()` Returns message to be printed before waiting start.
`void` | `setOutput(TestOut out)` Defines print output streams or writers.
`void` | `setTimeouts(Timeouts timeouts)` Defines current timeouts.
`protected long` | `timeFromStart()` Returns time from waiting start.
`java.lang.Object` | `waitAction(java.lang.Object waitableObject)` Waits for not null result of actionProduced method of Waitable implementation passed into constructor.

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

Constructor Detail

### Waiter

    public Waiter(Waitable w)

  Constructor.
  Parameters:
    `w` - Waitable object defining waiting criteria.

### Waiter

    protected Waiter()

  Can be used from subclass.

Method Detail

### setTimeouts

    public void setTimeouts(Timeouts timeouts)

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

### getTimeouts

    public Timeouts getTimeouts()

  Return current timeouts.
  Specified by:
    `getTimeouts` in interface `Timeoutable`
  Returns:
    the collection of current timeout assignments.
  See Also:
    `Timeoutable`, `Timeouts`, `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)`

### waitAction

    public java.lang.Object waitAction(java.lang.Object waitableObject)
                                throws java.lang.InterruptedException

  Waits for not null result of actionProduced method of Waitable implementation passed into constructor.
  Parameters:
    `waitableObject` - Object to be passed into actionProduced method.
  Returns:
    non null result of action.
  Throws:
    `TimeoutExpiredException` -
    `java.lang.InterruptedException` -

### actionProduced

    public java.lang.Object actionProduced(java.lang.Object obj)

  Description copied from interface: `Waitable`
  Checks if wait criteria have been met.
  Specified by:
    `actionProduced` in interface `Waitable`
  Parameters:
    `obj` -
  See Also:
    `Waitable`

### getDescription

    public java.lang.String getDescription()

  Description copied from interface: `Waitable`
  Returns description.
  Specified by:
    `getDescription` in interface `Waitable`
  See Also:
    `Waitable`

### getWaitingStartedMessage

    protected java.lang.String getWaitingStartedMessage()

  Returns message to be printed before waiting start.
  Returns:
    a message.

### getTimeoutExpiredMessage

    protected java.lang.String getTimeoutExpiredMessage(long timeSpent)

  Returns message to be printed when waiting timeout has been expired.
  Parameters:
    `timeSpent` - time from waiting start (milliseconds)
  Returns:
    a message.

### getActionProducedMessage

    protected java.lang.String getActionProducedMessage(long timeSpent,
                                                        java.lang.Object result)

  Returns message to be printed when waiting has been successfully finished.
  Parameters:
    `timeSpent` - time from waiting start (milliseconds)
    `result` - result of Waitable.actionproduced method.
  Returns:
    a message.

### getGoldenWaitingStartedMessage

    protected java.lang.String getGoldenWaitingStartedMessage()

  Returns message to be printed int golden output before waiting start.
  Returns:
    a message.

### getGoldenTimeoutExpiredMessage

    protected java.lang.String getGoldenTimeoutExpiredMessage()

  Returns message to be printed int golden output when waiting timeout has been expired.
  Returns:
    a message.

### getGoldenActionProducedMessage

    protected java.lang.String getGoldenActionProducedMessage()

  Returns message to be printed int golden output when waiting has been successfully finished.
  Returns:
    a message.

### timeFromStart

    protected long timeFromStart()

  Returns time from waiting start.
  Returns:
    Time spent for waiting already.

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