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 WindowWaiter

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

All Implemented Interfaces:
  Outputable, Timeoutable, Waitable

Direct Known Subclasses:
  DialogWaiter, FrameWaiter

public class WindowWaiter
extends Waiter
implements Timeoutable

A WindowWaiter is a utility class used to look or wait for Windows. It contains methods to search for a Window among the currently showing Windows as well as methods that wait for a Window to show within an allotted time period. Searches and waits always involve search criteria applied by a ComponentChooser instance. Searches and waits can both be restricted to windows owned by a given window.
Timeouts used:
WindowWaiter.WaitWindowTimeout - time to wait window displayed
WindowWaiter.AfterWindowTimeout - time to sleep after window has been dispayed

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

Constructor Summary
`WindowWaiter()` Constructor.

Method Summary
`java.lang.Object` | `actionProduced(java.lang.Object obj)` Action producer--get a window.
`protected java.lang.String` | `getActionProducedMessage(long timeSpent, java.lang.Object result)` Overrides Waiter.getActionProducedMessage.
`protected ComponentChooser` | `getComponentChooser()` Method can be used by a subclass to define chooser.
`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.
`protected java.awt.Window` | `getOwner()` Method can be used by a subclass to define window owner.
`protected java.lang.String` | `getTimeoutExpiredMessage(long timeSpent)` Overrides Waiter.getTimeoutExpiredMessage.
`Timeouts` | `getTimeouts()` Return current timeouts.
`protected java.lang.String` | `getWaitingStartedMessage()` Returns message to be printed before waiting start.
`static java.awt.Window` | `getWindow(ComponentChooser cc)` Searches for a window.
`static java.awt.Window` | `getWindow(ComponentChooser cc, int index)` Searches for a window.
`static java.awt.Window` | `getWindow(java.awt.Window owner, ComponentChooser cc)` Searches for a window.
`static java.awt.Window` | `getWindow(java.awt.Window owner, ComponentChooser cc, int index)` Searches for a window.
`protected void` | `setComponentChooser(ComponentChooser ch)` Method can be used by a subclass to define chooser.
`protected void` | `setOwner(java.awt.Window owner)` Method can be used by a subclass to define window owner.
`void` | `setTimeouts(Timeouts timeouts)` Defines current timeouts.
`java.awt.Window` | `waitWindow(ComponentChooser ch)` Waits for a window to show.
`java.awt.Window` | `waitWindow(ComponentChooser ch, int index)` Waits for a window to show.
`java.awt.Window` | `waitWindow(java.awt.Window o, ComponentChooser ch)` Waits for a window to show.
`java.awt.Window` | `waitWindow(java.awt.Window o, ComponentChooser ch, int index)` Waits for a window to show.

Methods inherited from class org.netbeans.jemmy.Waiter
`getDescription, getOutput, setOutput, timeFromStart, waitAction`

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

Constructor Detail

### WindowWaiter

    public WindowWaiter()

  Constructor.

Method Detail

### getWindow

    public static java.awt.Window getWindow(java.awt.Window owner,
                                            ComponentChooser cc,
                                            int index)

  Searches for a window. The search proceeds among the currently showing windows for the `index+1`'th window that is both owned by the `java.awt.Window` `owner` and that meets the criteria defined and applied by the `ComponentChooser` parameter.
  Parameters:
    `owner` - The owner window of all the windows to be searched.
    `cc` - A component chooser used to define and apply the search criteria.
    `index` - The ordinal index of the window in the set of currently displayed windows with the proper window ownership and a suitable title. The first index is 0.
  Returns:
    a reference to the `index+1`'th window that is showing, has the proper window ownership, and that meets the search criteria. If there are fewer than `index+1` windows, a `null` reference is returned.

### getWindow

    public static java.awt.Window getWindow(java.awt.Window owner,
                                            ComponentChooser cc)

  Searches for a window. Search among the currently showing windows for the first that is both owned by the `java.awt.Window` `owner` and that meets the search criteria applied by the `ComponentChooser` parameter.
  Parameters:
    `owner` - The owner window of the windows to be searched.
    `cc` - A component chooser used to define and apply the search criteria.
  Returns:
    a reference to the first window that is showing, has a proper owner window, and that meets the search criteria. If no such window can be found, a `null` reference is returned.

### getWindow

    public static java.awt.Window getWindow(ComponentChooser cc,
                                            int index)

  Searches for a window. The search proceeds among the currently showing windows for the `index+1`'th window that meets the criteria defined and applied by the `ComonentChooser` parameter.
  Parameters:
    `cc` - A component chooser used to define and apply the search criteria.
    `index` - The ordinal index of the window in the set of currently displayed windows. The first index is 0.
  Returns:
    a reference to the `index+1`'th window that is showing and that meets the search criteria. If there are fewer than `index+1` windows, a `null` reference is returned.

### getWindow

    public static java.awt.Window getWindow(ComponentChooser cc)

  Searches for a window. Search among the currently showing windows for one that meets the search criteria applied by the `ComponentChooser` parameter.
  Parameters:
    `cc` - A component chooser used to define and apply the search criteria.
  Returns:
    a reference to the first window that is showing and that meets the search criteria. If no such window can be found, a `null` reference is returned.

### setTimeouts

    public void setTimeouts(Timeouts timeouts)

  Defines current timeouts.
  Specified by:
    `setTimeouts` in interface `Timeoutable`
  Overrides:
    `setTimeouts` in class `Waiter`
  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`
  Overrides:
    `getTimeouts` in class `Waiter`
  Returns:
    the collection of current timeout assignments.
  See Also:
    `Timeoutable`, `Timeouts`, `setTimeouts(org.netbeans.jemmy.Timeouts)`

### actionProduced

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

  Action producer--get a window. Get a window. The search uses constraints on window ownership, ordinal index, and search criteria defined by an instance of `org.netbeans.jemmy.ComponentChooser`.
  Overrides:
    `actionProduced` in class `Waiter`
  Parameters:
    `obj` - Not used.
  Returns:
    the window waited upon. If a window cannot be found then a `null` reference is returned.
  See Also:
    `Action`

### waitWindow

    public java.awt.Window waitWindow(ComponentChooser ch,
                                      int index)
                               throws java.lang.InterruptedException

  Waits for a window to show. Wait for the `index+1`'th window that meets the criteria defined and applied by the `ComonentChooser` parameter to show up.
  Parameters:
    `ch` - A component chooser used to define and apply the search criteria.
    `index` - The ordinal index of the window in the set of currently displayed windows. The first index is 0.
  Returns:
    a reference to the `index+1`'th window that shows and that meets the search criteria. If fewer than `index+1` windows show up in the allotted time period then a `null` reference is returned.
  Throws:
    `TimeoutExpiredException` -
    `java.lang.InterruptedException` -
  See Also:
    `actionProduced(Object)`

### waitWindow

    public java.awt.Window waitWindow(ComponentChooser ch)
                               throws java.lang.InterruptedException

  Waits for a window to show. Wait for a window that meets the search criteria applied by the `ComponentChooser` parameter to show up.
  Parameters:
    `ch` - A component chooser used to define and apply the search criteria.
  Returns:
    a reference to the first window that shows and that meets the search criteria. If no such window can be found within the time period allotted, a `null` reference is returned.
  Throws:
    `TimeoutExpiredException` -
    `java.lang.InterruptedException` -
  See Also:
    `actionProduced(Object)`

### waitWindow

    public java.awt.Window waitWindow(java.awt.Window o,
                                      ComponentChooser ch,
                                      int index)
                               throws java.lang.InterruptedException

  Waits for a window to show. Wait for the `index+1`'th window to show that is both owned by the `java.awt.Window` `o` and that meets the criteria defined and applied by the `ComponentChooser` parameter.
  Parameters:
    `o` - The owner window of all the windows to be searched.
    `ch` - A component chooser used to define and apply the search criteria.
    `index` - The ordinal index of the window in the set of currently displayed windows with the proper window ownership and a suitable title. The first index is 0.
  Returns:
    a reference to the `index+1`'th window to show that has the proper window ownership, and that meets the search criteria. If there are fewer than `index+1` windows, a `null` reference is returned.
  Throws:
    `TimeoutExpiredException` -
    `java.lang.InterruptedException` -
  See Also:
    `actionProduced(Object)`

### waitWindow

    public java.awt.Window waitWindow(java.awt.Window o,
                                      ComponentChooser ch)
                               throws java.lang.InterruptedException

  Waits for a window to show. Wait for the first window to show that is both owned by the `java.awt.Window` `o` and that meets the criteria defined and applied by the `ComponentChooser` parameter.
  Parameters:
    `o` - The owner window of all the windows to be searched.
    `ch` - A component chooser used to define and apply the search criteria.
  Returns:
    a reference to the first window to show that has the proper window ownership, and that meets the search criteria. If there is no such window, a `null` reference is returned.
  Throws:
    `TimeoutExpiredException` -
    `java.lang.InterruptedException` -
  See Also:
    `actionProduced(Object)`

### setComponentChooser

    protected void setComponentChooser(ComponentChooser ch)

  Method can be used by a subclass to define chooser.
  Parameters:
    `ch` - a chooser specifying searching criteria.
  See Also:
    `getComponentChooser()`

### getComponentChooser

    protected ComponentChooser getComponentChooser()

  Method can be used by a subclass to define chooser.
  Returns:
    a chooser specifying searching criteria.
  See Also:
    `setComponentChooser(org.netbeans.jemmy.ComponentChooser)`

### setOwner

    protected void setOwner(java.awt.Window owner)

  Method can be used by a subclass to define window owner.
  Parameters:
    `owner` - Window-owner of the set of windows.
  See Also:
    `getOwner()`

### getOwner

    protected java.awt.Window getOwner()

  Method can be used by a subclass to define window owner.
  Returns:
    Window-owner of the set of windows.
  See Also:
    `setOwner(java.awt.Window)`

### getWaitingStartedMessage

    protected java.lang.String getWaitingStartedMessage()

  Description copied from class: `Waiter`
  Returns message to be printed before waiting start.
  Overrides:
    `getWaitingStartedMessage` in class `Waiter`
  See Also:
    `Waiter.getWaitingStartedMessage()`

### getTimeoutExpiredMessage

    protected java.lang.String getTimeoutExpiredMessage(long timeSpent)

  Overrides Waiter.getTimeoutExpiredMessage.
  Overrides:
    `getTimeoutExpiredMessage` in class `Waiter`
  Parameters:
    `timeSpent` - time from waiting start (milliseconds)
  Returns:
    a message.
  See Also:
    `Waiter.getTimeoutExpiredMessage(long)`

### getActionProducedMessage

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

  Overrides Waiter.getActionProducedMessage.
  Overrides:
    `getActionProducedMessage` in class `Waiter`
  Parameters:
    `timeSpent` - time from waiting start (milliseconds)
    `result` - result of Waitable.actionproduced method.
  Returns:
    a message.
  See Also:
    `Waiter.getActionProducedMessage(long, Object)`

### getGoldenWaitingStartedMessage

    protected java.lang.String getGoldenWaitingStartedMessage()

  Description copied from class: `Waiter`
  Returns message to be printed int golden output before waiting start.
  Overrides:
    `getGoldenWaitingStartedMessage` in class `Waiter`
  Returns:
    a message.
  See Also:
    `Waiter.getGoldenWaitingStartedMessage()`

### getGoldenTimeoutExpiredMessage

    protected java.lang.String getGoldenTimeoutExpiredMessage()

  Description copied from class: `Waiter`
  Returns message to be printed int golden output when waiting timeout has been expired.
  Overrides:
    `getGoldenTimeoutExpiredMessage` in class `Waiter`
  Returns:
    a message.
  See Also:
    `Waiter.getGoldenTimeoutExpiredMessage()`

### getGoldenActionProducedMessage

    protected java.lang.String getGoldenActionProducedMessage()

  Description copied from class: `Waiter`
  Returns message to be printed int golden output when waiting has been successfully finished.
  Overrides:
    `getGoldenActionProducedMessage` in class `Waiter`
  Returns:
    a message.
  See Also:
    `Waiter.getGoldenActionProducedMessage()`

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