Package org.netbeans.jemmy
Class FrameWaiter
- java.lang.Object
-
- org.netbeans.jemmy.Waiter
-
- org.netbeans.jemmy.WindowWaiter
-
- org.netbeans.jemmy.FrameWaiter
-
- All Implemented Interfaces:
Outputable,Timeoutable,Waitable
public class FrameWaiter extends WindowWaiter implements Timeoutable, Outputable
Contains methods to search and wait Frame. A FrameWaiter is a utility class used to look or wait for Frames. It contains methods to search for a Frame among the currently showing Frames as well as methods that wait for a Frame to show within an allotted time period.
Timeouts used:
FrameWaiter.WaitFrameTimeout - time to wait frame displayed.
FrameWaiter.AfterFrameTimeout - time to sleep after frame has been displayed.- Author:
- Alexandre Iline (alexandre.iline@sun.com)
- See Also:
Timeouts
-
-
Constructor Summary
Constructors Constructor Description FrameWaiter()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringgetActionProducedMessage(long timeSpent, java.lang.Object result)Overrides WindowWaiter.getActionProducedMessage.static java.awt.FramegetFrame(java.lang.String title, boolean ce, boolean cc)Searches for a Frame by title.static java.awt.FramegetFrame(java.lang.String title, boolean ce, boolean cc, int index)Searches for a Frame by title.static java.awt.FramegetFrame(ComponentChooser cc)Searches for a Frame.static java.awt.FramegetFrame(ComponentChooser cc, int index)Searches for a Frame.protected java.lang.StringgetGoldenActionProducedMessage()Returns message to be printed int golden output when waiting has been successfully finished.protected java.lang.StringgetGoldenTimeoutExpiredMessage()Returns message to be printed int golden output when waiting timeout has been expired.protected java.lang.StringgetGoldenWaitingStartedMessage()Returns message to be printed int golden output before waiting start.TestOutgetOutput()Returns print output streams or writers.protected java.lang.StringgetTimeoutExpiredMessage(long timeSpent)Overrides WindowWaiter.getTimeoutExpiredMessage.TimeoutsgetTimeouts()Return current timeouts.protected java.lang.StringgetWaitingStartedMessage()Returns message to be printed before waiting start.voidsetOutput(TestOut output)Defines print output streams or writers.voidsetTimeouts(Timeouts timeouts)Defines current timeouts.java.awt.FramewaitFrame(java.lang.String title, boolean compareExactly, boolean compareCaseSensitive)Waits for a Frame to show.java.awt.FramewaitFrame(java.lang.String title, boolean compareExactly, boolean compareCaseSensitive, int index)Waits for a Frame to show.java.awt.FramewaitFrame(ComponentChooser ch)Waits for a Frame to show.java.awt.FramewaitFrame(ComponentChooser ch, int index)Waits for a Frame to show.-
Methods inherited from class org.netbeans.jemmy.WindowWaiter
actionProduced, getComponentChooser, getDescription, getOwner, getWindow, getWindow, getWindow, getWindow, setComponentChooser, setOwner, waitWindow, waitWindow, waitWindow, waitWindow
-
Methods inherited from class org.netbeans.jemmy.Waiter
timeFromStart, waitAction
-
-
-
-
Method Detail
-
getFrame
public static java.awt.Frame getFrame(ComponentChooser cc)
Searches for a Frame. Search among the currently showing Frames 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 Frame that is showing and that
meets the search criteria. If no such Frame can be found, a
nullreference is returned.
-
getFrame
public static java.awt.Frame getFrame(ComponentChooser cc, int index)
Searches for a Frame. The search proceeds among the currently showing Frames for theindex+1'th Frame 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 Frame in the set of currently displayed Frames. The first index is 0.- Returns:
- a reference to the
index+1'th Frame that is showing and that meets the search criteria. If there are fewer thanindex+1Frames, anullreference is returned.
-
getFrame
public static java.awt.Frame getFrame(java.lang.String title, boolean ce, boolean cc)Searches for a Frame by title. The search proceeds among the currently showing Frames for the first with a suitable title.- Parameters:
title- Frame title or subtitle.ce- Iftrueand the search is case sensitive, then a match occurs when thetitleargument is a substring of a Frame title. Iffalseand the search is case sensitive, then thetitleargument and the Frame title must be the same. Iftrueand the search is case insensitive, then a match occurs when thetitleargument is a substring of the Frame title after changing both to upper case. Iffalseand the search is case insensitive, then a match occurs when thetitleargument is a substring of the Frame title after changing both to upper case.cc- Iftruethe search is case sensitive; otherwise, the search is case insensitive.- Returns:
- a reference to the first Frame that is showing and that has a
suitable title. If no such Frame can be found, a
nullreference is returned.
-
getFrame
public static java.awt.Frame getFrame(java.lang.String title, boolean ce, boolean cc, int index)Searches for a Frame by title. The search is for theindex+1'th Frame among the currently showing Frames that possess a suitable title.- Parameters:
title- Frame title or subtitle.ce- Iftrueand the search is case sensitive, then a match occurs when thetitleargument is a substring of a Frame title. Iffalseand the search is case sensitive, then thetitleargument and the Frame title must be the same. Iftrueand the search is case insensitive, then a match occurs when thetitleargument is a substring of the Frame title after changing both to upper case. Iffalseand the search is case insensitive, then a match occurs when thetitleargument is a substring of the Frame title after changing both to upper case.cc- Iftruethe search is case sensitive; otherwise, the search is case insensitive.index- The ordinal index of the Frame in the set of currently displayed Frames. The first index is 0.- Returns:
- a reference to the
index+1'th Frame that is showing and that has a suitable title. If there are fewer thanindex+1Frames, anullreference is returned.
-
setTimeouts
public void setTimeouts(Timeouts timeouts)
Defines current timeouts.- Specified by:
setTimeoutsin interfaceTimeoutable- Overrides:
setTimeoutsin classWindowWaiter- Parameters:
timeouts- A collection of timeout assignments.- See Also:
Timeoutable,Timeouts,getTimeouts()
-
getTimeouts
public Timeouts getTimeouts()
Return current timeouts.- Specified by:
getTimeoutsin interfaceTimeoutable- Overrides:
getTimeoutsin classWindowWaiter- Returns:
- the collection of current timeout assignments.
- See Also:
Timeoutable,Timeouts,setTimeouts(org.netbeans.jemmy.Timeouts)
-
setOutput
public void setOutput(TestOut output)
Defines print output streams or writers.- Specified by:
setOutputin interfaceOutputable- Overrides:
setOutputin classWaiter- Parameters:
output- 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:
getOutputin interfaceOutputable- Overrides:
getOutputin classWaiter- Returns:
- an object that contains references to objects for printing to output and err streams.
- See Also:
Outputable,TestOut,setOutput(org.netbeans.jemmy.TestOut)
-
waitFrame
public java.awt.Frame waitFrame(ComponentChooser ch, int index) throws java.lang.InterruptedException
Waits for a Frame to show. Wait for theindex+1'th Frame 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 Frame in the set of currently displayed Frames. The first index is 0.- Returns:
- a reference to the
index+1'th Frame that shows and that meets the search criteria. If fewer thanindex+1Frames show up in the allotted time period then anullreference is returned. - Throws:
TimeoutExpiredExceptionjava.lang.InterruptedException- See Also:
WindowWaiter.actionProduced(Object)
-
waitFrame
public java.awt.Frame waitFrame(ComponentChooser ch) throws java.lang.InterruptedException
Waits for a Frame to show. Wait for a Frame 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 Frame that shows and that
meets the search criteria. If no such Frame can be found within the
time period allotted, a
nullreference is returned. - Throws:
TimeoutExpiredExceptionjava.lang.InterruptedException- See Also:
WindowWaiter.actionProduced(Object)
-
waitFrame
public java.awt.Frame waitFrame(java.lang.String title, boolean compareExactly, boolean compareCaseSensitive, int index) throws java.lang.InterruptedExceptionWaits for a Frame to show. Wait for theindex+1'th Frame to show with a suitable title.- Parameters:
title- Frame title or subtitle.compareExactly- Iftrueand the search is case sensitive, then a match occurs when thetitleargument is a substring of a Frame title. Iffalseand the search is case sensitive, then thetitleargument and the Frame title must be the same. Iftrueand the search is case insensitive, then a match occurs when thetitleargument is a substring of the Frame title after changing both to upper case. Iffalseand the search is case insensitive, then a match occurs when thetitleargument is a substring of the Frame title after changing both to upper case.compareCaseSensitive- Iftruethe search is case sensitive; otherwise, the search is case insensitive.index- The ordinal index of the Frame in the set of currently displayed Frames with the proper window ownership and a suitable title. The first index is 0.- Returns:
- a reference to the
index+1'th Frame to show and that has a suitable title. If no such Frame can be found within the time period allotted, anullreference is returned. - Throws:
TimeoutExpiredExceptionjava.lang.InterruptedException- See Also:
WindowWaiter.actionProduced(Object)
-
waitFrame
public java.awt.Frame waitFrame(java.lang.String title, boolean compareExactly, boolean compareCaseSensitive) throws java.lang.InterruptedExceptionWaits for a Frame to show. Wait for the first Frame to show with a suitable title.- Parameters:
title- Frame title or subtitle.compareExactly- Iftrueand the search is case sensitive, then a match occurs when thetitleargument is a substring of a Frame title. Iffalseand the search is case sensitive, then thetitleargument and the Frame title must be the same. Iftrueand the search is case insensitive, then a match occurs when thetitleargument is a substring of the Frame title after changing both to upper case. Iffalseand the search is case insensitive, then a match occurs when thetitleargument is a substring of the Frame title after changing both to upper case.compareCaseSensitive- Iftruethe search is case sensitive; otherwise, the search is case insensitive.- Returns:
- a reference to the first Frame to show and that has a
suitable title. If no such Frame can be found within the time period
allotted, a
nullreference is returned. - Throws:
TimeoutExpiredExceptionjava.lang.InterruptedException- See Also:
WindowWaiter.actionProduced(Object)
-
getWaitingStartedMessage
protected java.lang.String getWaitingStartedMessage()
Description copied from class:WaiterReturns message to be printed before waiting start.- Overrides:
getWaitingStartedMessagein classWindowWaiter- Returns:
- a message.
- See Also:
Waiter.getWaitingStartedMessage()
-
getTimeoutExpiredMessage
protected java.lang.String getTimeoutExpiredMessage(long timeSpent)
Overrides WindowWaiter.getTimeoutExpiredMessage. Returns the timeout expired message value.- Overrides:
getTimeoutExpiredMessagein classWindowWaiter- Parameters:
timeSpent- Time spent for waiting- Returns:
- a message tring
- See Also:
Waiter.getTimeoutExpiredMessage(long)
-
getActionProducedMessage
protected java.lang.String getActionProducedMessage(long timeSpent, java.lang.Object result)Overrides WindowWaiter.getActionProducedMessage. Returns the action produced message value.- Overrides:
getActionProducedMessagein classWindowWaiter- Parameters:
timeSpent- Time spent for waiting.result- A message string.- Returns:
- a message tring
- See Also:
Waiter.getActionProducedMessage(long, Object)
-
getGoldenWaitingStartedMessage
protected java.lang.String getGoldenWaitingStartedMessage()
Description copied from class:WaiterReturns message to be printed int golden output before waiting start.- Overrides:
getGoldenWaitingStartedMessagein classWindowWaiter- Returns:
- a message.
- See Also:
Waiter.getGoldenWaitingStartedMessage()
-
getGoldenTimeoutExpiredMessage
protected java.lang.String getGoldenTimeoutExpiredMessage()
Description copied from class:WaiterReturns message to be printed int golden output when waiting timeout has been expired.- Overrides:
getGoldenTimeoutExpiredMessagein classWindowWaiter- Returns:
- a message.
- See Also:
Waiter.getGoldenTimeoutExpiredMessage()
-
getGoldenActionProducedMessage
protected java.lang.String getGoldenActionProducedMessage()
Description copied from class:WaiterReturns message to be printed int golden output when waiting has been successfully finished.- Overrides:
getGoldenActionProducedMessagein classWindowWaiter- Returns:
- a message.
- See Also:
Waiter.getGoldenActionProducedMessage()
-
-