| java.lang.Object abbot.util.AWTFixtureHelper
AWTFixtureHelper | public class AWTFixtureHelper (Code) | | Provides various facilities for setting up, using, and tearing down
a test involving UI components.
Handles standardized AWTEvent logging and catching exceptions on the
AWT event dispatch thread (EDT).
This class should be used at setup and teardown of your chosen fixture.
See Also: junit.extensions.abbot.ComponentTestFixture See Also: abbot.script.StepRunner See Also: |
Method Summary | |
public void | dispose() Dispose all windows created during this object's lifetime and restore
the previous system/UI state, to the extent possible. | protected void | disposeAll() | public void | disposeWindow(Window w) Synchronous, safe dispose of a window. | public Throwable | getEventDispatchError() Returns the last exception thrown on the event dispatch thread, or
null if no such exception has been thrown. | public long | getEventDispatchErrorTime() Returns the time of the last exception thrown on the event dispatch
thread. | public Hierarchy | getHierarchy() | public Robot | getRobot() | public WindowTracker | getWindowTracker() | public void | hideWindow(Window w) Synchronous, safe hide of a window. | public void | installPopup(Component invoker, JPopupMenu popup) Install the given popup on the given component. | public void | invokeAndWait(Runnable runnable) Convenience for getRobot().invokeAndWait(Runnable) . | public void | invokeLater(Runnable runnable) Convenience for getRobot().invokeLater(Runnable) . | public boolean | isShowing(String id) Returns whether a Component is showing. | public boolean | isShowing(String id, ComponentFinder finder) Same as
AWTFixtureHelper.isShowing(String) , but uses the given
ComponentFinder to do the lookup. | public void | restore() Restore the state that was preserved when this object was created. | public void | setModifiers(int modifiers, boolean pressed) Convenience method to set key modifiers. | public Frame | showFrame(Component comp) This method should be invoked to display the component under test.
The frame's size will be its preferred size. | public Frame | showFrame(Component comp, Dimension size) This method should be invoked to display the component under test,
when a specific size of frame is desired. | public Frame | showFrame(Component comp, Dimension size, String title) This method should be invoked to display the component under test,
when a specific size of frame is desired. | public Dialog | showModalDialog(Runnable showAction) Display a modal dialog and wait for it to show. | public Dialog | showModalDialog(Runnable showAction, ComponentFinder finder) Same as
AWTFixtureHelper.showModalDialog(Runnable) , but provides a custom
ComponentFinder to find the dialog. | public void | showPopup(JPopupMenu popup, Component invoker) Safely install and display a popup in the center of the given
component, returning when it is visible. | public void | showPopup(JPopupMenu popup, Component invoker, int x, int y) Safely install and display a popup, returning when it is visible. | public void | showWindow(Window w) Safely display a window with proper EDT synchronization. | public void | showWindow(Window w, Dimension size) Safely display a window with proper EDT synchronization. | public void | showWindow(Window w, Dimension size, boolean pack) Safely display a window with proper EDT synchronization. | public void | waitForWindow(Window w, boolean visible) Return when the window is ready for input or times out waiting. |
EVENT_GENERATION_DELAY | final public static int EVENT_GENERATION_DELAY(Code) | | Typical delay to wait for a robot event to be translated into a Java
event.
|
POPUP_DELAY | final public static int POPUP_DELAY(Code) | | |
WINDOW_DELAY | final public static int WINDOW_DELAY(Code) | | |
AWTFixtureHelper | public AWTFixtureHelper()(Code) | | |
AWTFixtureHelper | public AWTFixtureHelper(Hierarchy hierarchy)(Code) | | Create an instance of AWTFixtureHelper which makes a snapshot of the
current VM state.
|
dispose | public void dispose()(Code) | | Dispose all windows created during this object's lifetime and restore
the previous system/UI state, to the extent possible.
|
disposeAll | protected void disposeAll()(Code) | | |
getEventDispatchError | public Throwable getEventDispatchError()(Code) | | Returns the last exception thrown on the event dispatch thread, or
null if no such exception has been thrown.
|
getEventDispatchErrorTime | public long getEventDispatchErrorTime()(Code) | | Returns the time of the last exception thrown on the event dispatch
thread.
|
installPopup | public void installPopup(Component invoker, JPopupMenu popup)(Code) | | Install the given popup on the given component. Takes care of
installing the appropriate mouse handler to activate the popup.
|
invokeAndWait | public void invokeAndWait(Runnable runnable)(Code) | | Convenience for getRobot().invokeAndWait(Runnable) .
|
invokeLater | public void invokeLater(Runnable runnable)(Code) | | Convenience for getRobot().invokeLater(Runnable) .
|
isShowing | public boolean isShowing(String id)(Code) | | Returns whether a Component is showing. The ID may be the component
name or, in the case of a Frame or Dialog, the title. Regular
expressions may be used, but must be delimited by slashes, e.g. /expr/.
Returns if one or more matches is found.
|
restore | public void restore()(Code) | | Restore the state that was preserved when this object was created.
|
setModifiers | public void setModifiers(int modifiers, boolean pressed)(Code) | | Convenience method to set key modifiers. Using this method is
preferred to invoking
Robot.setModifiers(intboolean) or
Robot.keyPress(int) , since this method's effects will be
automatically undone at the end of the test. If you use the
Robot methods, you must remember to release any keys pressed
during the test.
Parameters: modifiers - mask indicating which modifier keys to use Parameters: pressed - whether the modifiers should be in the pressed state. |
showFrame | public Frame showFrame(Component comp)(Code) | | This method should be invoked to display the component under test.
The frame's size will be its preferred size. This method will return
with the enclosing
Frame is showing and ready for input.
|
showFrame | public Frame showFrame(Component comp, Dimension size)(Code) | | This method should be invoked to display the component under test,
when a specific size of frame is desired. The method will return when
the enclosing
Frame is showing and ready for input.
Parameters: comp - Parameters: size - Desired size of the enclosing frame, or null to make no explicit adjustments to its size. |
showFrame | public Frame showFrame(Component comp, Dimension size, String title)(Code) | | This method should be invoked to display the component under test,
when a specific size of frame is desired. The method will return when
the enclosing
Frame is showing and ready for input.
Parameters: comp - Parameters: size - Desired size of the enclosing frame, or null to make no explicit adjustments to its size. Parameters: title - Title of the wrapping frame |
showPopup | public void showPopup(JPopupMenu popup, Component invoker)(Code) | | Safely install and display a popup in the center of the given
component, returning when it is visible. Does not install any mouse
handlers not generate any mouse events.
|
showPopup | public void showPopup(JPopupMenu popup, Component invoker, int x, int y)(Code) | | Safely install and display a popup, returning when it is visible.
Does not install any mouse handlers not generate any mouse events.
|
showWindow | public void showWindow(Window w)(Code) | | Safely display a window with proper EDT synchronization. This method
blocks until the
Window is showing and ready for input.
|
showWindow | public void showWindow(Window w, Dimension size)(Code) | | Safely display a window with proper EDT synchronization. This method
blocks until the
Window is showing and ready for input.
|
showWindow | public void showWindow(Window w, Dimension size, boolean pack)(Code) | | Safely display a window with proper EDT synchronization. This method
blocks until the window is showing. This method will return even when
the window is a modal dialog, since the show method is called on the
event dispatch thread. The window will be packed if the pack flag is
set, and set to the given size if it is non-null .
Modal dialogs may be shown with this method without blocking.
|
waitForWindow | public void waitForWindow(Window w, boolean visible)(Code) | | Return when the window is ready for input or times out waiting.
Parameters: w - |
|
|