Class WindowWaiter
java.lang.Object
org.netbeans.jemmy.Waiter
org.netbeans.jemmy.WindowWaiter
- All Implemented Interfaces:
Outputable, Timeoutable, Waitable
- Direct Known Subclasses:
DialogWaiter, FrameWaiter
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
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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionactionProduced(Object obj) Action producer--get a window.protected StringgetActionProducedMessage(long timeSpent, Object result) Overrides Waiter.getActionProducedMessage.protected ComponentChooserMethod can be used by a subclass to define chooser.Returns description.protected StringReturns message to be printed int golden output when waiting has been successfully finished.protected StringReturns message to be printed int golden output when waiting timeout has been expired.protected StringReturns message to be printed int golden output before waiting start.protected WindowgetOwner()Method can be used by a subclass to define window owner.protected StringgetTimeoutExpiredMessage(long timeSpent) Overrides Waiter.getTimeoutExpiredMessage.Return current timeouts.protected StringReturns message to be printed before waiting start.static WindowgetWindow(Window owner, ComponentChooser cc) Searches for a window.static WindowgetWindow(Window owner, ComponentChooser cc, int index) Searches for a window.static WindowSearches for a window.static WindowgetWindow(ComponentChooser cc, int index) Searches for a window.protected voidMethod can be used by a subclass to define chooser.protected voidMethod can be used by a subclass to define window owner.voidsetTimeouts(Timeouts timeouts) Defines current timeouts.waitWindow(Window o, ComponentChooser ch) Waits for a window to show.waitWindow(Window o, ComponentChooser ch, int index) Waits for a window to show.Waits for a window to show.waitWindow(ComponentChooser ch, int index) Waits for a window to show.Methods inherited from class Waiter
getOutput, setOutput, timeFromStart, waitAction
-
Constructor Details
-
WindowWaiter
public WindowWaiter()Constructor.
-
-
Method Details
-
getWindow
Searches for a window. The search proceeds among the currently showing windows for theindex+1'th window that is both owned by thejava.awt.Windowownerand that meets the criteria defined and applied by theComponentChooserparameter.- 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 thanindex+1windows, anullreference is returned.
-
getWindow
Searches for a window. Search among the currently showing windows for the first that is both owned by thejava.awt.Windowownerand that meets the search criteria applied by theComponentChooserparameter.- 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
nullreference is returned.
-
getWindow
Searches for a window. The search proceeds among the currently showing windows for theindex+1'th window that meets the criteria defined and applied by theComonentChooserparameter.- 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 thanindex+1windows, anullreference is returned.
-
getWindow
Searches for a window. Search among the currently showing windows for one that meets the search criteria applied by theComponentChooserparameter.- 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
nullreference is returned.
-
setTimeouts
Defines current timeouts.- Specified by:
setTimeoutsin interfaceTimeoutable- Overrides:
setTimeoutsin classWaiter- Parameters:
timeouts- A collection of timeout assignments.- See Also:
-
getTimeouts
Return current timeouts.- Specified by:
getTimeoutsin interfaceTimeoutable- Overrides:
getTimeoutsin classWaiter- Returns:
- the collection of current timeout assignments.
- See Also:
-
actionProduced
Action producer--get a window. Get a window. The search uses constraints on window ownership, ordinal index, and search criteria defined by an instance oforg.netbeans.jemmy.ComponentChooser.- Specified by:
actionProducedin interfaceWaitable- Overrides:
actionProducedin classWaiter- Parameters:
obj- Not used.- Returns:
- the window waited upon. If a window cannot be found
then a
nullreference is returned. - See Also:
-
waitWindow
Waits for a window to show. Wait for theindex+1'th window that meets the criteria defined and applied by theComonentChooserparameter 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 thanindex+1windows show up in the allotted time period then anullreference is returned. - Throws:
TimeoutExpiredExceptionInterruptedException- See Also:
-
waitWindow
Waits for a window to show. Wait for a window that meets the search criteria applied by theComponentChooserparameter 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
nullreference is returned. - Throws:
TimeoutExpiredExceptionInterruptedException- See Also:
-
waitWindow
Waits for a window to show. Wait for theindex+1'th window to show that is both owned by thejava.awt.Windowoand that meets the criteria defined and applied by theComponentChooserparameter.- 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 thanindex+1windows, anullreference is returned. - Throws:
TimeoutExpiredExceptionInterruptedException- See Also:
-
waitWindow
Waits for a window to show. Wait for the first window to show that is both owned by thejava.awt.Windowoand that meets the criteria defined and applied by theComponentChooserparameter.- 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
nullreference is returned. - Throws:
TimeoutExpiredExceptionInterruptedException- See Also:
-
getDescription
Description copied from interface:WaitableReturns description.- Specified by:
getDescriptionin interfaceWaitable- Overrides:
getDescriptionin classWaiter- Returns:
- a description of the wait criteria.
- See Also:
-
setComponentChooser
Method can be used by a subclass to define chooser.- Parameters:
ch- a chooser specifying searching criteria.- See Also:
-
getComponentChooser
Method can be used by a subclass to define chooser.- Returns:
- a chooser specifying searching criteria.
- See Also:
-
setOwner
Method can be used by a subclass to define window owner.- Parameters:
owner- Window-owner of the set of windows.- See Also:
-
getOwner
Method can be used by a subclass to define window owner.- Returns:
- Window-owner of the set of windows.
- See Also:
-
getWaitingStartedMessage
Description copied from class:WaiterReturns message to be printed before waiting start.- Overrides:
getWaitingStartedMessagein classWaiter- Returns:
- a message.
- See Also:
-
getTimeoutExpiredMessage
Overrides Waiter.getTimeoutExpiredMessage.- Overrides:
getTimeoutExpiredMessagein classWaiter- Parameters:
timeSpent- time from waiting start (milliseconds)- Returns:
- a message.
- See Also:
-
getActionProducedMessage
Overrides Waiter.getActionProducedMessage.- Overrides:
getActionProducedMessagein classWaiter- Parameters:
timeSpent- time from waiting start (milliseconds)result- result of Waitable.actionproduced method.- Returns:
- a message.
- See Also:
-
getGoldenWaitingStartedMessage
Description copied from class:WaiterReturns message to be printed int golden output before waiting start.- Overrides:
getGoldenWaitingStartedMessagein classWaiter- Returns:
- a message.
- See Also:
-
getGoldenTimeoutExpiredMessage
Description copied from class:WaiterReturns message to be printed int golden output when waiting timeout has been expired.- Overrides:
getGoldenTimeoutExpiredMessagein classWaiter- Returns:
- a message.
- See Also:
-
getGoldenActionProducedMessage
Description copied from class:WaiterReturns message to be printed int golden output when waiting has been successfully finished.- Overrides:
getGoldenActionProducedMessagein classWaiter- Returns:
- a message.
- See Also:
-