S
- used to simulate "self types." For more information please read "Emulating 'self types' using Java Generics to simplify fluent API implementation."C
- the type of Container
that this fixture can manage.D
- the type of WindowDriver
that this fixture uses internally.public abstract class AbstractWindowFixture<S,C extends Window,D extends WindowDriver> extends AbstractContainerFixture<S,C,D> implements WindowLikeContainerFixture<S>, JPopupMenuInvokerFixture
Window
.BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY
Constructor and Description |
---|
AbstractWindowFixture(Class<S> selfType,
C target)
Creates a new
AbstractWindowFixture . |
AbstractWindowFixture(Class<S> selfType,
Class<? extends C> type)
Creates a new
AbstractWindowFixture . |
AbstractWindowFixture(Class<S> selfType,
Robot robot,
C target)
Creates a new
AbstractWindowFixture . |
AbstractWindowFixture(Class<S> selfType,
Robot robot,
Class<? extends C> type)
Creates a new
AbstractWindowFixture . |
AbstractWindowFixture(Class<S> selfType,
Robot robot,
String name,
Class<? extends C> type)
Creates a new
AbstractWindowFixture . |
AbstractWindowFixture(Class<S> selfType,
String name,
Class<? extends C> type)
Creates a new
AbstractWindowFixture . |
Modifier and Type | Method and Description |
---|---|
void |
cleanUp()
Cleans up any used resources (keyboard, mouse, open windows and
ScreenLock ) used by
this robot. |
void |
close()
Simulates a user closing this fixture's
Window . |
S |
moveTo(Point p)
Simulates a user moving this fixture's
Window to the given point. |
S |
moveToBack()
If the given
Window is visible, sends it to the back and may cause it to lose focus or activation if it is
the focused or active. |
S |
moveToFront()
If fixture's
Window is visible, brings it to the front and may make it the focused one. |
S |
requireSize(Dimension size)
Asserts that the size of this fixture's
Window is equal to given one. |
S |
resizeHeightTo(int height)
Simulates a user resizing vertically this fixture's
Window . |
S |
resizeTo(Dimension size)
Simulates a user resizing this fixture's
Window . |
S |
resizeWidthTo(int width)
Simulates a user resizing horizontally this fixture's
Window . |
S |
show()
Shows this fixture's
Window . |
S |
show(Dimension size)
Shows this fixture's
Window , resized to the given size. |
JPopupMenuFixture |
showPopupMenu()
Shows a pop-up menu using this fixture's
Window as the invoker of the pop-up menu. |
JPopupMenuFixture |
showPopupMenuAt(Point p)
Shows a pop-up menu at the given point using this fixture's
Window as the invoker of the pop-up menu. |
button, button, button, checkBox, checkBox, checkBox, comboBox, comboBox, comboBox, defaultDialogLookupTimeout, dialog, dialog, dialog, dialog, dialog, dialog, fileChooser, fileChooser, fileChooser, fileChooser, fileChooser, fileChooser, find, findByName, findByType, finder, internalFrame, internalFrame, internalFrame, label, label, label, list, list, list, menuItem, menuItem, menuItemWithPath, optionPane, optionPane, panel, panel, panel, progressBar, progressBar, progressBar, radioButton, radioButton, radioButton, scrollBar, scrollBar, scrollBar, scrollPane, scrollPane, scrollPane, slider, slider, slider, spinner, spinner, spinner, splitPane, splitPane, splitPane, tabbedPane, tabbedPane, tabbedPane, table, table, table, textBox, textBox, textBox, toggleButton, toggleButton, toggleButton, toolBar, toolBar, toolBar, tree, tree, tree, with
background, click, click, click, createDriver, doubleClick, driver, drop, equals, focus, font, foreground, hashCode, isEnabled, myself, pressAndReleaseKey, pressAndReleaseKeys, pressKey, pressKeyWhileRunning, releaseKey, replaceDriverWith, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireShowing, requireVisible, rightClick, robot, target, targetCastedTo
public AbstractWindowFixture(@Nonnull Class<S> selfType, @Nonnull Class<? extends C> type)
AbstractWindowFixture
. This constructor creates a new Robot
containing the current
AWT hierarchy.selfType
- the "self type."type
- the type of Window
to find using the created Robot
.NullPointerException
- if the given Window
type is null
.ComponentLookupException
- if a Window
having a matching type could not
be found.ComponentLookupException
- if more than one Window
having a matching type
is found.BasicRobot.robotWithCurrentAwtHierarchy()
public AbstractWindowFixture(@Nonnull Class<S> selfType, @Nonnull Robot robot, @Nonnull Class<? extends C> type)
AbstractWindowFixture
.selfType
- the "self type."robot
- performs simulation of user events on a Window
.type
- the type of Window
to find using the given Robot
.NullPointerException
- if the given robot is null
.NullPointerException
- if the given Window
type is null
.ComponentLookupException
- if a Window
having a matching type could not
be found.ComponentLookupException
- if more than one Window
having a matching type
is found.public AbstractWindowFixture(@Nonnull Class<S> selfType, @Nullable String name, @Nonnull Class<? extends C> type)
AbstractWindowFixture
. This constructor creates a new Robot
containing the current
AWT hierarchy.selfType
- the "self type."name
- the name of the Window
to find.type
- the type of Window
to find using the created Robot
.NullPointerException
- if the given Window
type is null
.ComponentLookupException
- if a Window
having a matching name could not
be found.ComponentLookupException
- if more than one Window
having a matching name
is found.BasicRobot.robotWithCurrentAwtHierarchy()
public AbstractWindowFixture(@Nonnull Class<S> selfType, @Nonnull Robot robot, @Nullable String name, @Nonnull Class<? extends C> type)
AbstractWindowFixture
.selfType
- the "self type."robot
- performs simulation of user events on a Window
.name
- the name of the Window
to find using the given Robot
.type
- the type of Window
to find using the given Robot
.NullPointerException
- if the given robot is null
.NullPointerException
- if the given Window
type is null
.ComponentLookupException
- if a Window
having a matching name could not
be found.ComponentLookupException
- if more than one Window
having a matching name
is found.public AbstractWindowFixture(@Nonnull Class<S> selfType, @Nonnull C target)
AbstractWindowFixture
. This constructor creates a new Robot
containing the current
AWT hierarchy.selfType
- the "self type."target
- the Window
to be managed by this fixture.NullPointerException
- if the given target Window
is null
.public AbstractWindowFixture(@Nonnull Class<S> selfType, @Nonnull Robot robot, @Nonnull C target)
AbstractWindowFixture
.selfType
- the "self type."robot
- performs simulation of user events on the given Window
.target
- the Window
to be managed by this fixture.NullPointerException
- if the given robot is null
.NullPointerException
- if the given target Window
is null
.@Nonnull public final S moveTo(@Nonnull Point p)
Window
to the given point.moveTo
in interface WindowLikeContainerFixture<S>
p
- the point to move this fixture's Window
to.ActionFailedException
- if the Window
is not movable.ActionFailedException
- if the given Window
is not showing on the screen.@Nonnull public final S moveToFront()
Window
is visible, brings it to the front and may make it the focused one.moveToFront
in interface WindowLikeContainerFixture<S>
@Nonnull public final S moveToBack()
Window
is visible, sends it to the back and may cause it to lose focus or activation if it is
the focused or active.moveToBack
in interface WindowLikeContainerFixture<S>
@Nonnull public final S requireSize(@Nonnull Dimension size)
Window
is equal to given one.requireSize
in interface WindowLikeContainerFixture<S>
size
- the given size to match.AssertionError
- if the size of this fixture's Window
is not equal to the given size.@Nonnull public final S resizeHeightTo(int height)
Window
.resizeHeightTo
in interface WindowLikeContainerFixture<S>
height
- the height that this fixture's Window
should have after being resized.ActionFailedException
- if the Window
is not resizable.@Nonnull public final S resizeTo(@Nonnull Dimension size)
Window
.resizeTo
in interface WindowLikeContainerFixture<S>
size
- the size that the target window should have after being resized.ActionFailedException
- if the Window
is not resizable.@Nonnull public final S resizeWidthTo(int width)
Window
.resizeWidthTo
in interface WindowLikeContainerFixture<S>
width
- the width that this fixture's Window
should have after being resized.ActionFailedException
- if the Window
is not resizable.@Nonnull public final S show(@Nonnull Dimension size)
Window
, resized to the given size.size
- the size to resize this fixture's Window
to.@Nonnull public final JPopupMenuFixture showPopupMenu()
Window
as the invoker of the pop-up menu.showPopupMenu
in interface JPopupMenuInvokerFixture
IllegalStateException
- if Settings.clickOnDisabledComponentsAllowed()
is
false
and this fixture's Window
is disabled.IllegalStateException
- if this fixture's Window
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.@Nonnull public final JPopupMenuFixture showPopupMenuAt(@Nonnull Point p)
Window
as the invoker of the pop-up menu.showPopupMenuAt
in interface JPopupMenuInvokerFixture
p
- the given point where to show the pop-up menu.IllegalStateException
- if Settings.clickOnDisabledComponentsAllowed()
is
false
and this fixture's Window
is disabled.IllegalStateException
- if this fixture's Window
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.public final void close()
Window
.close
in interface WindowLikeContainerFixture<S>
public final void cleanUp()
ScreenLock
) used by
this robot.Copyright © 2014–2019 AssertJ. All rights reserved.