Package org.fest.swing.driver
Class ComponentShownWaiter
java.lang.Object
java.awt.event.ComponentAdapter
org.fest.swing.driver.ComponentShownWaiter
- All Implemented Interfaces:
ComponentListener
,EventListener
Understands waiting for a
Component
to be shown.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private boolean
private Component
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
void
Notification that the component to wait for is finally shown on the screen.private void
done()
private void
startWaiting
(long timeout) static void
waitTillShown
(Component toWaitFor) Waits until the given component is shown on the screen, using a timeout of 5 seconds.static void
waitTillShown
(Component toWaitFor, long timeout) Waits until the given component is shown on the screen.Methods inherited from class java.awt.event.ComponentAdapter
componentHidden, componentMoved, componentResized
-
Field Details
-
DEFAULT_TIMEOUT
private static final int DEFAULT_TIMEOUT- See Also:
-
DEFAULT_SLEEP_TIME
private static final int DEFAULT_SLEEP_TIME- See Also:
-
toWaitFor
-
shown
private volatile boolean shown
-
-
Constructor Details
-
ComponentShownWaiter
-
-
Method Details
-
waitTillShown
Waits until the given component is shown on the screen, using a timeout of 5 seconds.- Parameters:
toWaitFor
- the component to wait for.- Throws:
WaitTimedOutError
- if the component is not shown before the default timeout of 5 seconds.
-
waitTillShown
Waits until the given component is shown on the screen.- Parameters:
toWaitFor
- the component to wait for.timeout
- the amount to time (in milliseconds) to wait for the component to be shown.- Throws:
WaitTimedOutError
- if the component is not shown before the given timeout expires.
-
startWaiting
private void startWaiting(long timeout) -
alreadyVisible
private boolean alreadyVisible() -
componentShown
Notification that the component to wait for is finally shown on the screen.- Specified by:
componentShown
in interfaceComponentListener
- Overrides:
componentShown
in classComponentAdapter
- Parameters:
e
- the event raised when the component has been made visible.
-
done
private void done()
-