public class JPanelFixture extends ContainerFixture<JPanel> implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture
JPanel
s:
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
DEFAULT_DIALOG_LOOKUP_TIMEOUT
Constructor and Description |
---|
JPanelFixture(Robot robot,
JPanel target)
Creates a new
. |
JPanelFixture(Robot robot,
String panelName)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
JPanelFixture |
click()
Simulates a user clicking this fixture's
. |
JPanelFixture |
click(MouseButton button)
Simulates a user clicking this fixture's
. |
JPanelFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's
. |
Object |
clientProperty(Object key)
Returns the client property stored in this fixture's
, under the given key. |
JPanelFixture |
doubleClick()
Simulates a user double-clicking this fixture's
. |
protected void |
driver(JComponentDriver newDriver)
Sets the
to be used by this fixture. |
JPanelFixture |
focus()
Gives input focus to this fixture's
. |
JPanelFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's
. |
JPanelFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on the
managed by this
fixture. |
JPanelFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JPanelFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
JPanelFixture |
requireDisabled()
Asserts that this fixture's
is disabled. |
JPanelFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JPanelFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JPanelFixture |
requireFocused()
Asserts that this fixture's
has input focus. |
JPanelFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JPanelFixture |
requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's
matches the given regular expression
pattern. |
JPanelFixture |
requireToolTip(String expected)
Asserts that the toolTip in this fixture's
matches the given value. |
JPanelFixture |
requireVisible()
Asserts that this fixture's
is visible. |
JPanelFixture |
rightClick()
Simulates a user right-clicking this fixture's
. |
JPopupMenuFixture |
showPopupMenu()
Shows a pop-up menu using this fixture's
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
as the invoker of the
pop-up menu. |
button, button, button, checkBox, checkBox, checkBox, comboBox, comboBox, comboBox, dialog, dialog, dialog, dialog, dialog, dialog, fileChooser, fileChooser, fileChooser, fileChooser, fileChooser, fileChooser, find, findByName, findByType, finder, 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, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
public JPanelFixture(Robot robot, String panelName)
JPanelFixture
.robot
- performs simulation of user events on a JPanel
.panelName
- the name of the JPanel
to find using the given Robot
.NullPointerException
- if robot
is null
.ComponentLookupException
- if a matching JPanel
could not be found.ComponentLookupException
- if more than one matching JPanel
is found.public JPanelFixture(Robot robot, JPanel target)
JPanelFixture
.robot
- performs simulation of user events on the given JPanel
.target
- the JPanel
to be managed by this fixture.NullPointerException
- if robot
is null
.NullPointerException
- if target
is null
.protected final void driver(JComponentDriver newDriver)
JComponentDriver
to be used by this fixture.newDriver
- the new JComponentDriver
.NullPointerException
- if the given driver is null
.public JPanelFixture click()
JPanel
.click
in interface MouseInputSimulationFixture
public JPanelFixture click(MouseButton button)
JPanel
.click
in interface MouseInputSimulationFixture
button
- the button to click.public JPanelFixture click(MouseClickInfo mouseClickInfo)
JPanel
.click
in interface MouseInputSimulationFixture
mouseClickInfo
- specifies the button to click and the times the button should be clicked.NullPointerException
- if the given MouseClickInfo
is null
.public JPanelFixture rightClick()
JPanel
.rightClick
in interface MouseInputSimulationFixture
public JPanelFixture doubleClick()
JPanel
.doubleClick
in interface MouseInputSimulationFixture
public JPanelFixture focus()
JPanel
.focus
in interface FocusableComponentFixture
public JPanelFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JPanel
.
Modifiers is a mask from the available InputEvent
masks.pressAndReleaseKey
in interface KeyboardInputSimulationFixture
keyPressInfo
- specifies the key and modifiers to press.NullPointerException
- if the given KeyPressInfo
is null
.IllegalArgumentException
- if the given code is not a valid key code.KeyPressInfo
public JPanelFixture pressAndReleaseKeys(int... keyCodes)
JPanel
managed by this
fixture.pressAndReleaseKeys
in interface KeyboardInputSimulationFixture
keyCodes
- one or more codes of the keys to press.NullPointerException
- if the given array of codes is null
.IllegalArgumentException
- if any of the given code is not a valid key code.KeyEvent
public JPanelFixture pressKey(int keyCode)
JPanel
.pressKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to press.IllegalArgumentException
- if any of the given code is not a valid key code.KeyEvent
public JPanelFixture releaseKey(int keyCode)
JPanel
.releaseKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to release.IllegalArgumentException
- if any of the given code is not a valid key code.KeyEvent
public JPanelFixture requireFocused()
JPanel
has input focus.requireFocused
in interface FocusableComponentFixture
AssertionError
- if this fixture's JPanel
does not have input focus.public JPanelFixture requireEnabled()
JPanel
is enabled.requireEnabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JPanel
is disabled.public JPanelFixture requireEnabled(Timeout timeout)
JPanel
is enabled.requireEnabled
in interface StateVerificationFixture
timeout
- the time this fixture will wait for the component to be enabled.WaitTimedOutError
- if this fixture's JPanel
is never enabled.public JPanelFixture requireDisabled()
JPanel
is disabled.requireDisabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JPanel
is enabled.public JPanelFixture requireVisible()
JPanel
is visible.requireVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JPanel
is not visible.public JPanelFixture requireNotVisible()
JPanel
is not visible.requireNotVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JPanel
is visible.public JPanelFixture requireToolTip(String expected)
JPanel
matches the given value.requireToolTip
in interface ToolTipDisplayFixture
expected
- the given value. It can be a regular expression.AssertionError
- if the toolTip in this fixture's JPanel
does not match the given value.public JPanelFixture requireToolTip(Pattern pattern)
JPanel
matches the given regular expression
pattern.requireToolTip
in interface ToolTipDisplayFixture
pattern
- the regular expression pattern to match.NullPointerException
- if the given regular expression pattern is null
.AssertionError
- if the toolTip in this fixture's JPanel
does not match the given regular
expression.public Object clientProperty(Object key)
JPanel
, under the given key.clientProperty
in interface ClientPropertyStorageFixture
key
- the key to use to retrieve the client property.null
if the property was
not found.NullPointerException
- if the given key is null
.public JPopupMenuFixture showPopupMenu()
JPanel
as the invoker of the pop-up menu.showPopupMenu
in interface JPopupMenuInvokerFixture
IllegalStateException
- if this fixture's JPanel
is disabled.IllegalStateException
- if this fixture's JPanel
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.public JPopupMenuFixture showPopupMenuAt(Point p)
JPanel
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 this fixture's JPanel
is disabled.IllegalStateException
- if this fixture's JPanel
is not showing on the screen.ComponentLookupException
- if a pop-up menu cannot be found.Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.