public class JTreeFixture extends ComponentFixture<JTree> implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture
JTrees:
s can be specified using TreePathStrings. For example, for the following
tree:
root
|
-- node1
|
-- node1.1
we can identify the node "node1.1" as follows:
root/node1/node1.1
The default path separator is "/". It can be changed by calling .
separator(String)
The conversion between the values given in tests and the values being displayed by a
renderer is performed by a JTree. This fixture uses a
JTreeCellReader by default.
BasicJTreeCellReader
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target| Constructor and Description |
|---|
JTreeFixture(Robot robot,
JTree target)
Creates a new
. |
JTreeFixture(Robot robot,
String treeName)
Creates a new
. |
| Modifier and Type | Method and Description |
|---|---|
JTreeFixture |
cellReader(JTreeCellReader cellReader)
Updates the implementation of
to use when comparing internal values of a
and the values expected in a test. |
JTreeFixture |
click()
Simulates a user clicking this fixture's
. |
JTreeFixture |
click(MouseButton button)
Simulates a user clicking this fixture's
. |
JTreeFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's
. |
JTreeFixture |
clickPath(String path)
Clicks the given path, expanding parent nodes if necessary.
|
JTreeFixture |
clickPath(String path,
MouseButton button)
Clicks the given path, expanding parent nodes if necessary.
|
JTreeFixture |
clickPath(String path,
MouseClickInfo mouseClickInfo)
Clicks the given path, expanding parent nodes if necessary.
|
JTreeFixture |
clickRow(int row)
Clicks the given row.
|
JTreeFixture |
clickRow(int row,
MouseButton button)
Clicks the given row.
|
JTreeFixture |
clickRow(int row,
MouseClickInfo mouseClickInfo)
Clicks the given row.
|
Object |
clientProperty(Object key)
Returns the client property stored in this fixture's
, under the given key. |
JTreeFixture |
collapsePath(String path)
Simulates a user collapsing the tree node at the given path.
|
JTreeFixture |
collapseRow(int row)
Simulates a user collapsing the tree node at the given row.
|
JTreeFixture |
doubleClick()
Simulates a user double-clicking this fixture's
. |
JTreeFixture |
doubleClickPath(String path)
Double-clicks the given path.
|
JTreeFixture |
doubleClickRow(int row)
Double-clicks the given row.
|
JTreeFixture |
drag(int row)
Simulates a user dragging a row from this fixture's
. |
JTreeFixture |
drag(String path)
Simulates a user dragging an item from this fixture's
. |
protected void |
driver(JTreeDriver newDriver)
Sets the
to be used by this fixture. |
JTreeFixture |
drop(int row)
Simulates a user dropping an item into this fixture's
. |
JTreeFixture |
drop(String path)
Simulates a user dropping an item into this fixture's
. |
JTreeFixture |
expandPath(String path)
Simulates a user expanding the tree node at the given path.
|
JTreeFixture |
expandRow(int row)
Simulates a user expanding the tree node at the given row.
|
JTreeFixture |
focus()
Gives input focus to this fixture's
. |
JTreeNodeFixture |
node(int row)
Returns a fixture that manages the node specified by the given row.
|
JTreeNodeFixture |
node(String path)
Returns a fixture that manages the node specified by the given path.
|
JTreeFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's
. |
JTreeFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys in this fixture's
. |
JTreeFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JTreeFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
JTreeFixture |
requireDisabled()
Asserts that this fixture's
is disabled. |
JTreeFixture |
requireEditable()
Asserts that this fixture's
is editable. |
JTreeFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JTreeFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JTreeFixture |
requireFocused()
Asserts that this fixture's
has input focus. |
JTreeFixture |
requireNoSelection()
Asserts that this fixture's
's does not have any selection. |
JTreeFixture |
requireNotEditable()
Asserts that this fixture's
is not editable. |
JTreeFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JTreeFixture |
requireSelection(int... rows)
Asserts that this fixture's
's selected rows are equal to the given one. |
JTreeFixture |
requireSelection(String... paths)
Asserts that this fixture's
selection is equal to the given paths. |
JTreeFixture |
requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's
matches the given regular expression
pattern. |
JTreeFixture |
requireToolTip(String expected)
Asserts that the toolTip in this fixture's
matches the given value. |
JTreeFixture |
requireVisible()
Asserts that this fixture's
is visible. |
JTreeFixture |
rightClick()
Simulates a user right-clicking this fixture's
. |
JTreeFixture |
rightClickPath(String path)
Right-clicks the given path, expanding parent nodes if necessary.
|
JTreeFixture |
rightClickRow(int row)
Right-clicks the given row.
|
JTreeFixture |
selectPath(String path)
Selects the given path, expanding parent nodes if necessary.
|
JTreeFixture |
selectPaths(String... paths)
Select the given paths, expanding parent nodes if necessary.
|
JTreeFixture |
selectRow(int row)
Simulates a user selecting the tree node at the given row.
|
JTreeFixture |
selectRows(int... rows)
Simulates a user selecting the tree nodes at the given rows.
|
String |
separator()
Returns the separator to use when converting
s to Strings. |
JTreeFixture |
separator(String separator)
Updates the separator to use when converting
s to Strings. |
JPopupMenuFixture |
showPopupMenu()
Shows a pop-up menu using this fixture's
as the invoker of the pop-up menu. |
JPopupMenuFixture |
showPopupMenuAt(int row)
Shows a pop-up menu at the position of the node in the given row.
|
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. |
JPopupMenuFixture |
showPopupMenuAt(String path)
Shows a pop-up menu at the position of the last node in the given path.
|
JTreeFixture |
toggleRow(int row)
Simulates a user toggling the open/closed state of the tree node at the given row.
|
String |
valueAt(int row)
Returns the
String representation of the given row. |
String |
valueAt(String path)
Returns the
String representation of the node at the given path. |
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNullpublic JTreeFixture(Robot robot, JTree target)
JTreeFixture.robot - performs simulation of user events on the given JTree.target - the JTree to be managed by this fixture.NullPointerException - if robot is null.NullPointerException - if target is null.public JTreeFixture(Robot robot, String treeName)
JTreeFixture.robot - performs simulation of user events on a JTree.treeName - the name of the JTree to find using the given Robot.NullPointerException - if robot is null.ComponentLookupException - if a matching JTree could not be found.ComponentLookupException - if more than one matching JTree is found.protected final void driver(JTreeDriver newDriver)
JTreeDriver to be used by this fixture.newDriver - the new JTreeDriver.NullPointerException - if the given driver is null.public JTreeFixture clickRow(int row)
row - the given row.IllegalStateException - if the JTree is disabled.IllegalStateException - if the JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.public JTreeFixture clickRow(int row, MouseButton button)
row - the given row.button - the mouse button to use.NullPointerException - if the button is null.IllegalStateException - if the JTree is disabled.IllegalStateException - if the JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.public JTreeFixture clickRow(int row, MouseClickInfo mouseClickInfo)
row - the given row.mouseClickInfo - specifies the mouse button to use and how many times to click.NullPointerException - if the given MouseClickInfo is null.IllegalStateException - if the JTree is disabled.IllegalStateException - if the JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.public JTreeFixture clickPath(String path)
path - the given path.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.LocationUnavailableException - if the given path cannot be found.public JTreeFixture clickPath(String path, MouseButton button)
path - the given path.button - the mouse button to use.NullPointerException - if the button is null.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.LocationUnavailableException - if the given path cannot be found.public JTreeFixture clickPath(String path, MouseClickInfo mouseClickInfo)
path - the given path.mouseClickInfo - specifies the mouse button to use and how many times to click.NullPointerException - if the given MouseClickInfo is null.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.LocationUnavailableException - if the given path cannot be found.public JTreeFixture doubleClickRow(int row)
row - the given row.IllegalStateException - if the JTree is disabled.IllegalStateException - if the JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.public JTreeFixture doubleClickPath(String path)
path - the given path.IllegalStateException - if the JTree is disabled.IllegalStateException - if the JTree is not showing on the screen.LocationUnavailableException - if the given path cannot be found.public JTreeFixture rightClickRow(int row)
row - the given row.IllegalStateException - if the JTree is disabled.IllegalStateException - if the JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.public JTreeFixture rightClickPath(String path)
path - the given path.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.LocationUnavailableException - if the given path cannot be found.public JTreeFixture click()
JTree.click in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.public JTreeFixture click(MouseButton button)
JTree.click in interface MouseInputSimulationFixturebutton - the button to click.NullPointerException - if the given MouseButton is null.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.public JTreeFixture click(MouseClickInfo mouseClickInfo)
JTree.click in interface MouseInputSimulationFixturemouseClickInfo - specifies the button to click and the times the button should be clicked.NullPointerException - if the given MouseClickInfo is null.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.public JTreeFixture doubleClick()
JTree.doubleClick in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.public JTreeFixture rightClick()
JTree.rightClick in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.public JTreeFixture drag(int row)
JTree.row - the index of the row to drag.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.public JTreeFixture drag(String path)
JTree.path - the path corresponding to the item to drag.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.LocationUnavailableException - if the given path cannot be found.public JTreeFixture drop(int row)
JTree.row - the row to drop the item to.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.ActionFailedException - if there is no drag action in effect.public JTreeFixture drop(String path)
JTree.path - the path corresponding to the item relative to the drop point.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.LocationUnavailableException - if the given path cannot be found.ActionFailedException - if there is no drag action in effect.public JTreeFixture selectPath(String path)
clickPath(String),
this method will not click the path if it is already selected.path - the path to select.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.LocationUnavailableException - if the given path cannot be found.public JTreeFixture selectPaths(String... paths)
paths - the paths to select.NullPointerException - if the array of rows is null.IllegalArgumentException - if the array of rows is empty.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.LocationUnavailableException - if the any of the given paths cannot be found.public JTreeFixture selectRow(int row)
row - the index of the row to select.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.public JTreeFixture selectRows(int... rows)
rows - the indices of the rows to select.NullPointerException - if the array of rows is null.IllegalArgumentException - if the array of rows is empty.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for any of the given rows cannot be found.public JTreeFixture toggleRow(int row)
row - the index of the row to toggle.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.ActionFailedException - if this method fails to toggle the row.public JTreeFixture expandRow(int row)
row - the index of the row to expand.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.ActionFailedException - if this method fails to expand the row.public JTreeFixture collapseRow(int row)
row - the index of the row to collapse.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.ActionFailedException - if this method fails to collapse the row.public JTreeFixture expandPath(String path)
path - the path of the row to expand.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.LocationUnavailableException - if the given path cannot be found.ActionFailedException - if this method fails to expand the path.public JTreeFixture collapsePath(String path)
path - the path of the row to collapse.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.LocationUnavailableException - if the given path cannot be found.ActionFailedException - if this method fails to collapse the path.public JPopupMenuFixture showPopupMenuAt(int row)
row - the index of the row invoking the pop-up menu.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.ComponentLookupException - if a pop-up menu cannot be found.LocationUnavailableException - if a tree path for the given row cannot be found.public JPopupMenuFixture showPopupMenuAt(String path)
path - the path of the node invoking the pop-up menu.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.ComponentLookupException - if a pop-up menu cannot be found.LocationUnavailableException - if the given path cannot be found.public JTreeFixture focus()
JTree.focus in interface FocusableComponentFixtureIllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.public JTreeFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JTree.
Modifiers is a mask from the available InputEvent masks.pressAndReleaseKey in interface KeyboardInputSimulationFixturekeyPressInfo - 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.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.KeyPressInfopublic JTreeFixture pressAndReleaseKeys(int... keyCodes)
JTree.pressAndReleaseKeys in interface KeyboardInputSimulationFixturekeyCodes - the 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.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.KeyEventpublic JTreeFixture pressKey(int keyCode)
JTree.pressKey in interface KeyboardInputSimulationFixturekeyCode - the code of the key to press.IllegalArgumentException - if any of the given code is not a valid key code.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.KeyEventpublic JTreeFixture releaseKey(int keyCode)
JTree.releaseKey in interface KeyboardInputSimulationFixturekeyCode - the code of the key to release.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.IllegalArgumentException - if any of the given code is not a valid key code.KeyEventpublic JTreeFixture requireFocused()
JTree has input focus.requireFocused in interface FocusableComponentFixtureAssertionError - if this fixture's JTree does not have input focus.public JTreeFixture requireEnabled()
JTree is enabled.requireEnabled in interface StateVerificationFixtureAssertionError - if this fixture's JTree is disabled.public JTreeFixture requireEnabled(Timeout timeout)
JTree is enabled.requireEnabled in interface StateVerificationFixturetimeout - the time this fixture will wait for the component to be enabled.WaitTimedOutError - if this fixture's JTree is never enabled.public JTreeFixture requireDisabled()
JTree is disabled.requireDisabled in interface StateVerificationFixtureAssertionError - if this fixture's JTree is enabled.public JTreeFixture requireVisible()
JTree is visible.requireVisible in interface StateVerificationFixtureAssertionError - if this fixture's JTree is not visible.public JTreeFixture requireNotVisible()
JTree is not visible.requireNotVisible in interface StateVerificationFixtureAssertionError - if this fixture's JTree is visible.public JTreeFixture requireEditable()
JTree is editable.AssertionError - if this fixture's JTree is not editable.AssertionError - if this fixture's JTree is not editable.public JTreeFixture requireNotEditable()
JTree is not editable.AssertionError - if this fixture's JTree is editable.AssertionError - if this fixture's JTree is editable.public JTreeFixture requireSelection(String... paths)
JTree selection is equal to the given paths.paths - the given paths, expected to be selected.NullPointerException - if the array of paths is null.LocationUnavailableException - if any of the given path cannot be found.AssertionError - if this fixture's JTree selection is not equal to the given paths.public JTreeFixture requireSelection(int... rows)
JTree's selected rows are equal to the given one.rows - the indices of the rows, expected to be selected.NullPointerException - if the array of row indices is null.AssertionError - if this fixture's JTree selection is not equal to the given rows.public JTreeFixture requireNoSelection()
JTree's does not have any selection.AssertionError - if this fixture's JTree has a selection.public JTreeFixture requireToolTip(String expected)
JTree matches the given value.requireToolTip in interface ToolTipDisplayFixtureexpected - the given value. It can be a regular expression.AssertionError - if the toolTip in this fixture's JTree does not match the given value.public JTreeFixture requireToolTip(Pattern pattern)
JTree matches the given regular expression
pattern.requireToolTip in interface ToolTipDisplayFixturepattern - the regular expression pattern to match.NullPointerException - if the given regular expression pattern is null.AssertionError - if the toolTip in this fixture's JTree does not match the given regular
expression.public Object clientProperty(Object key)
JButton, under the given key.clientProperty in interface ClientPropertyStorageFixturekey - 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()
JTree as the invoker of the pop-up menu.showPopupMenu in interface JPopupMenuInvokerFixtureIllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.ComponentLookupException - if a pop-up menu cannot be found.public JPopupMenuFixture showPopupMenuAt(Point p)
JTree as the invoker of the
pop-up menu.showPopupMenuAt in interface JPopupMenuInvokerFixturep - the given point where to show the pop-up menu.IllegalStateException - if this fixture's JTree is disabled.IllegalStateException - if this fixture's JTree is not showing on the screen.ComponentLookupException - if a pop-up menu cannot be found.public String separator()
TreePaths to Strings.TreePaths to Strings.public JTreeFixture separator(String separator)
TreePaths to Strings. The default
value is "/".separator - the new separator.NullPointerException - if the given separator is null.public JTreeFixture cellReader(JTreeCellReader cellReader)
JTreeCellReader to use when comparing internal values of a
JTree and the values expected in a test. The default implementation to use
is BasicJTreeCellReader.cellReader - the new JTreeCellValueReader to use.NullPointerException - if cellReader is null.public JTreeNodeFixture node(int row)
row - the given row.IndexOutOfBoundsException - if the given index is less than zero or equal than or greater than the number of
visible rows in the JTree.public JTreeNodeFixture node(String path)
path - the given path.LocationUnavailableException - if the given path cannot be found.public String valueAt(String path)
String representation of the node at the given path.path - the given path.String representation of the node at the given path.LocationUnavailableException - if the given path cannot be found.public String valueAt(int row)
String representation of the given row.row - the given row.String representation of the node at the given path.IndexOutOfBoundsException - if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree.LocationUnavailableException - if a tree path for the given row cannot be found.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.