Package org.netbeans.jemmy
Class DialogWaiter
java.lang.Object
org.netbeans.jemmy.Waiter
org.netbeans.jemmy.WindowWaiter
org.netbeans.jemmy.DialogWaiter
- All Implemented Interfaces:
Outputable
,Timeoutable
,Waitable
A DialogWaiter is a utility class used to look or wait for Dialogs.
It contains methods to search for a Dialog among the currently
showing Dialogs as well as methods that wait for a Diaog to show
within an allotted time period.
Searches and waits can either involve search criteria applied by a
ComponentChooser instance or a search criteria based on the Dialog
title. Searches and waits can both be restricted to dialogs owned
by a given window.
Timeouts used:
DialogWaiter.WaitDialogTimeout - time to wait dialog displayed
DialogWaiter.AfterDialogTimeout - time to sleep after dialog has been dispayed
Timeouts used:
DialogWaiter.WaitDialogTimeout - time to wait dialog displayed
DialogWaiter.AfterDialogTimeout - time to sleep after dialog has been dispayed
- Author:
- Alexandre Iline (alexandre.iline@sun.com)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
getActionProducedMessage
(long spendedTime, Object result) Overrides WindowWaiter.getActionProducedMessage.static Dialog
Searches for a dialog by title.static Dialog
Searches for a dialog by title.static Dialog
getDialog
(Window owner, ComponentChooser cc) Searches for a dialog.static Dialog
getDialog
(Window owner, ComponentChooser cc, int index) Searches for a dialog.static Dialog
Searches for a dialog by title.static Dialog
Searches for a dialog by title.static Dialog
Searches for a dialog.static Dialog
getDialog
(ComponentChooser cc, int index) Searches for a dialog.protected String
Returns message to be printed int golden output when waiting has been successfully finished.protected String
Returns message to be printed int golden output when waiting timeout has been expired.protected String
Returns message to be printed int golden output before waiting start.Returns print output streams or writers.protected String
getTimeoutExpiredMessage
(long spendedTime) Overrides WindowWaiter.getTimeoutExpiredMessage.Return current timeouts.protected String
Returns message to be printed before waiting start.void
Defines print output streams or writers.void
setTimeouts
(Timeouts timeouts) Defines current timeouts.waitDialog
(Window owner, String title, boolean compareExactly, boolean compareCaseSensitive) Waits for a dialog to show.waitDialog
(Window owner, String title, boolean compareExactly, boolean compareCaseSensitive, int index) Waits for a dialog to show.waitDialog
(Window owner, ComponentChooser ch) Waits for a dialog to show.waitDialog
(Window owner, ComponentChooser ch, int index) Waits for a dialog to show.waitDialog
(String title, boolean compareExactly, boolean compareCaseSensitive) Waits for a dialog to show.waitDialog
(String title, boolean compareExactly, boolean compareCaseSensitive, int index) Waits for a dialog to show.Waits for a dialog to show.waitDialog
(ComponentChooser ch, int index) Waits for a dialog 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
-
Constructor Details
-
DialogWaiter
public DialogWaiter()Constructor.
-
-
Method Details
-
getDialog
Searches for a dialog. Search among the currently showing dialogs for one that meets the search criteria applied by theComponentChooser
parameter.- Parameters:
cc
- A component chooser used to define and apply the search criteria.- Returns:
- a reference to the first dialog that is showing and that
meets the search criteria. If no such dialog can be found, a
null
reference is returned.
-
getDialog
Searches for a dialog. The search proceeds among the currently showing dialogs for theindex+1
'th dialog that meets the criteria defined and applied by theComonentChooser
parameter.- Parameters:
cc
- A component chooser used to define and apply the search criteria.index
- The ordinal index of the dialog in the set of currently displayed dialogs. The first index is 0.- Returns:
- a reference to the
index+1
'th dialog that is showing and that meets the search criteria. If there are fewer thanindex+1
dialogs, anull
reference is returned.
-
getDialog
Searches for a dialog by title. The search proceeds among the currently showing dialogs for the first with a suitable title.- Parameters:
title
- Dialog title or subtitle.ce
- Iftrue
and the search is case sensitive, then a match occurs when thetitle
argument is a substring of a dialog title. Iffalse
and the search is case sensitive, then thetitle
argument and the dialog title must be the same. Iftrue
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case. Iffalse
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case.cc
- Iftrue
the search is case sensitive; otherwise, the search is case insensitive.- Returns:
- a reference to the first dialog that is showing and that has a
suitable title. If no such dialog can be found, a
null
reference is returned.
-
getDialog
Searches for a dialog by title. The search is for theindex+1
'th dialog among the currently showing dialogs that possess a suitable title.- Parameters:
title
- Dialog title or subtitle.ce
- Iftrue
and the search is case sensitive, then a match occurs when thetitle
argument is a substring of a dialog title. Iffalse
and the search is case sensitive, then thetitle
argument and the dialog title must be the same. Iftrue
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case. Iffalse
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case.cc
- Iftrue
the search is case sensitive; otherwise, the search is case insensitive.index
- Ordinal index between appropriate dialogs- Returns:
- a reference to the
index+1
'th dialog that is showing and that has a suitable title. If there are fewer thanindex+1
dialogs, anull
reference is returned.
-
getDialog
Searches for a dialog. Search among the currently showing dialogs for the first that is both owned by thejava.awt.Window
owner
and that meets the search criteria applied by theComponentChooser
parameter.- Parameters:
owner
- The owner window of the dialogs to be searched.cc
- A component chooser used to define and apply the search criteria.- Returns:
- a reference to the first dialog that is showing, has a proper
owner window, and that meets the search criteria. If no such dialog
can be found, a
null
reference is returned.
-
getDialog
Searches for a dialog. The search proceeds among the currently showing dialogs for theindex+1
'th dialog that is both owned by thejava.awt.Window
owner
and that meets the criteria defined and applied by theComponentChooser
parameter.- Parameters:
owner
- The owner window of all the dialogs to be searched.cc
- A component chooser used to define and apply the search criteria.index
- Ordinal index between appropriate dialogs- Returns:
- a reference to the
index+1
'th dialog that is showing, has the proper window ownership, and that meets the search criteria. If there are fewer thanindex+1
dialogs, anull
reference is returned.
-
getDialog
Searches for a dialog by title. The search proceeds among the currently showing dialogs that are owned by thejava.awt.Window
owner
for the first with a suitable title.- Parameters:
owner
- A window - owner of a dialods to be checked.title
- Dialog title or subtitle.ce
- Iftrue
and the search is case sensitive, then a match occurs when thetitle
argument is a substring of a dialog title. Iffalse
and the search is case sensitive, then thetitle
argument and the dialog title must be the same. Iftrue
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case. Iffalse
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case.cc
- Iftrue
the search is case sensitive; otherwise, the search is case insensitive.- Returns:
- a reference to the first dialog that is showing, has the proper
window ownership, and a suitable title. If no such dialog can be found,
a
null
reference is returned.
-
getDialog
Searches for a dialog by title. The search is for theindex+1
'th dialog among the currently showing dialogs that are owned by thejava.awt.Window
owner
and that have a suitable title.- Parameters:
owner
- ?title? Dialog title or subtitle.title
- ?ce? Iftrue
and the search is case sensitive, then a match occurs when thetitle
argument is a substring of a dialog title. Iffalse
and the search is case sensitive, then thetitle
argument and the dialog title must be the same. Iftrue
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case. Iffalse
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case.ce
- ?cc? Iftrue
the search is case sensitive; otherwise, the search is case insensitive.cc
- ?index? The ordinal index of the dialog in the set of currently displayed dialogs with the proper window ownership and a suitable title. The first index is 0.index
- Ordinal index between appropriate dialogs- Returns:
- a reference to the
index+1
'th dialog that is showing, has the proper window ownership, and a suitable title. If there are fewer thanindex+1
dialogs, anull
reference is returned.
-
setTimeouts
Defines current timeouts.- Specified by:
setTimeouts
in interfaceTimeoutable
- Overrides:
setTimeouts
in classWindowWaiter
- Parameters:
timeouts
- ?t? A collection of timeout assignments.- See Also:
-
getTimeouts
Return current timeouts.- Specified by:
getTimeouts
in interfaceTimeoutable
- Overrides:
getTimeouts
in classWindowWaiter
- Returns:
- the collection of current timeout assignments.
- See Also:
-
setOutput
Defines print output streams or writers.- Specified by:
setOutput
in interfaceOutputable
- Overrides:
setOutput
in classWaiter
- Parameters:
output
- ?out? Identify the streams or writers used for print output.- See Also:
-
getOutput
Returns print output streams or writers.- Specified by:
getOutput
in interfaceOutputable
- Overrides:
getOutput
in classWaiter
- Returns:
- an object that contains references to objects for printing to output and err streams.
- See Also:
-
waitDialog
Waits for a dialog to show. Wait for theindex+1
'th dialog that meets the criteria defined and applied by theComonentChooser
parameter to show up.- Parameters:
ch
- A component chooser used to define and apply the search criteria.index
- The ordinal index of the dialog in the set of currently displayed dialogs. The first index is 0.- Returns:
- a reference to the
index+1
'th dialog that shows and that meets the search criteria. If fewer thanindex+1
dialogs show up in the allotted time period then anull
reference is returned. - Throws:
TimeoutExpiredException
InterruptedException
- See Also:
-
waitDialog
Waits for a dialog to show. Wait for a dialog that meets the search criteria applied by theComponentChooser
parameter to show up.- Parameters:
ch
- A component chooser used to define and apply the search criteria.- Returns:
- a reference to the first dialog that shows and that
meets the search criteria. If no such dialog can be found within the
time period allotted, a
null
reference is returned. - Throws:
TimeoutExpiredException
InterruptedException
- See Also:
-
waitDialog
public Dialog waitDialog(String title, boolean compareExactly, boolean compareCaseSensitive, int index) throws InterruptedException Waits for a dialog to show. Wait for theindex+1
'th dialog to show with a suitable title.- Parameters:
title
- Dialog title or subtitle.compareExactly
- Iftrue
and the search is case sensitive, then a match occurs when thetitle
argument is a substring of a dialog title. Iffalse
and the search is case sensitive, then thetitle
argument and the dialog title must be the same. Iftrue
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case. Iffalse
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case.compareCaseSensitive
- Iftrue
the search is case sensitive; otherwise, the search is case insensitive.index
- The ordinal index of the dialog in the set of currently displayed dialogs with the proper window ownership and a suitable title. The first index is 0.- Returns:
- a reference to the
index+1
'th dialog to show and that has a suitable title. If no such dialog can be found within the time period allotted, anull
reference is returned. - Throws:
TimeoutExpiredException
InterruptedException
- See Also:
-
waitDialog
public Dialog waitDialog(String title, boolean compareExactly, boolean compareCaseSensitive) throws InterruptedException Waits for a dialog to show. Wait for the first dialog to show with a suitable title.- Parameters:
title
- Dialog title or subtitle.compareExactly
- Iftrue
and the search is case sensitive, then a match occurs when thetitle
argument is a substring of a dialog title. Iffalse
and the search is case sensitive, then thetitle
argument and the dialog title must be the same. Iftrue
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case. Iffalse
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case.compareCaseSensitive
- Iftrue
the search is case sensitive; otherwise, the search is case insensitive.- Returns:
- a reference to the first dialog to show and that has a
suitable title. If no such dialog can be found within the time period
allotted, a
null
reference is returned. - Throws:
TimeoutExpiredException
InterruptedException
- See Also:
-
waitDialog
Waits for a dialog to show. Wait for theindex+1
'th dialog to show that is both owned by thejava.awt.Window
owner
and that meets the criteria defined and applied by theComponentChooser
parameter.- Parameters:
owner
- The owner window of all the dialogs to be searched.ch
- A component chooser used to define and apply the search criteria.index
- The ordinal index of the dialog in the set of currently displayed dialogs with the proper window ownership and a suitable title. The first index is 0.- Returns:
- a reference to the
index+1
'th dialog to show that has the proper window ownership, and that meets the search criteria. If there are fewer thanindex+1
dialogs, anull
reference is returned. - Throws:
TimeoutExpiredException
InterruptedException
- See Also:
-
waitDialog
Waits for a dialog to show. Wait for the first dialog to show that is both owned by thejava.awt.Window
owner
and that meets the criteria defined and applied by theComponentChooser
parameter.- Parameters:
owner
- The owner window of all the dialogs to be searched.ch
- A component chooser used to define and apply the search criteria.- Returns:
- a reference to the first dialog to show that
has the proper window ownership, and that meets the search criteria.
If there is no such dialog, a
null
reference is returned. - Throws:
TimeoutExpiredException
InterruptedException
- See Also:
-
waitDialog
public Dialog waitDialog(Window owner, String title, boolean compareExactly, boolean compareCaseSensitive, int index) throws InterruptedException Waits for a dialog to show. Wait for theindex+1
'th dialog to show with the proper owner and a suitable title.- Parameters:
owner
- The owner window of all the dialogs to be searched.title
- Dialog title or subtitle.compareExactly
- Iftrue
and the search is case sensitive, then a match occurs when thetitle
argument is a substring of a dialog title. Iffalse
and the search is case sensitive, then thetitle
argument and the dialog title must be the same. Iftrue
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case. Iffalse
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case.compareCaseSensitive
- Iftrue
the search is case sensitive; otherwise, the search is case insensitive.index
- Ordinal index between appropriate dialogs- Returns:
- a reference to the
index+1
'th dialog to show that has both the proper owner window and a suitable title. If no such dialog can be found within the time period allotted, anull
reference is returned. - Throws:
TimeoutExpiredException
InterruptedException
- See Also:
-
waitDialog
public Dialog waitDialog(Window owner, String title, boolean compareExactly, boolean compareCaseSensitive) throws InterruptedException Waits for a dialog to show. Wait for the first dialog to show with the proper owner and a suitable title.- Parameters:
owner
- The owner window of all the dialogs to be searched.title
- Dialog title or subtitle.compareExactly
- Iftrue
and the search is case sensitive, then a match occurs when thetitle
argument is a substring of a dialog title. Iffalse
and the search is case sensitive, then thetitle
argument and the dialog title must be the same. Iftrue
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case. Iffalse
and the search is case insensitive, then a match occurs when thetitle
argument is a substring of the dialog title after changing both to upper case.compareCaseSensitive
- Iftrue
the search is case sensitive; otherwise, the search is case insensitive.- Returns:
- a reference to the first dialog to show and that has both the proper
owner and a suitable title. If no such dialog can be found within the time period
allotted, a
null
reference is returned. - Throws:
TimeoutExpiredException
InterruptedException
- See Also:
-
getWaitingStartedMessage
Description copied from class:Waiter
Returns message to be printed before waiting start.- Overrides:
getWaitingStartedMessage
in classWindowWaiter
- Returns:
- a message.
- See Also:
-
getTimeoutExpiredMessage
Overrides WindowWaiter.getTimeoutExpiredMessage. Returns the timeout expired message value.- Overrides:
getTimeoutExpiredMessage
in classWindowWaiter
- Parameters:
spendedTime
- Time spent for waiting- Returns:
- A message string.
- See Also:
-
getActionProducedMessage
Overrides WindowWaiter.getActionProducedMessage. Returns the action produced message value.- Overrides:
getActionProducedMessage
in classWindowWaiter
- Parameters:
spendedTime
- Time spent for waitingresult
- A result of the action- Returns:
- A message string.
- See Also:
-
getGoldenWaitingStartedMessage
Description copied from class:Waiter
Returns message to be printed int golden output before waiting start.- Overrides:
getGoldenWaitingStartedMessage
in classWindowWaiter
- Returns:
- a message.
- See Also:
-
getGoldenTimeoutExpiredMessage
Description copied from class:Waiter
Returns message to be printed int golden output when waiting timeout has been expired.- Overrides:
getGoldenTimeoutExpiredMessage
in classWindowWaiter
- Returns:
- a message.
- See Also:
-
getGoldenActionProducedMessage
Description copied from class:Waiter
Returns message to be printed int golden output when waiting has been successfully finished.- Overrides:
getGoldenActionProducedMessage
in classWindowWaiter
- Returns:
- a message.
- See Also:
-