|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.assertj.swing.driver.ComponentDriver
org.assertj.swing.driver.ContainerDriver
org.assertj.swing.driver.JComponentDriver
org.assertj.swing.driver.JTreeDriver
@InternalApi public class JTreeDriver
Supports functional testing of JTree
s.
Note: This class is intended for internal use only. Please use the classes in the package
org.assertj.swing.fixture
in your tests.
Field Summary |
---|
Fields inherited from class org.assertj.swing.driver.ComponentDriver |
---|
robot |
Constructor Summary | |
---|---|
JTreeDriver(Robot robot)
Creates a new JTreeDriver . |
Method Summary | |
---|---|
void |
checkPathExists(JTree tree,
String path)
Verifies that the given node path exists. |
void |
checkRowInBounds(JTree tree,
int row)
Verifies that the given row index is valid. |
void |
clickPath(JTree tree,
String path)
Clicks the given path, expanding parent nodes if necessary. |
void |
clickPath(JTree tree,
String path,
MouseButton button)
Clicks the given path, expanding parent nodes if necessary. |
void |
clickPath(JTree tree,
String path,
MouseClickInfo mouseClickInfo)
Clicks the given path, expanding parent nodes if necessary. |
void |
clickRow(JTree tree,
int row)
Clicks the given row. |
void |
clickRow(JTree tree,
int row,
MouseButton button)
Clicks the given row. |
void |
clickRow(JTree tree,
int row,
MouseClickInfo mouseClickInfo)
Clicks the given row. |
void |
collapsePath(JTree tree,
String path)
Collapses the given path, is possible. |
void |
collapseRow(JTree tree,
int row)
Collapses the given row, is possible. |
void |
doubleClickPath(JTree tree,
String path)
Double-clicks the given path. |
void |
doubleClickRow(JTree tree,
int row)
Double-clicks the given row. |
void |
drag(JTree tree,
int row)
Starts a drag operation at the location of the given row. |
void |
drag(JTree tree,
String path)
Starts a drag operation at the location of the given TreePath . |
void |
drop(JTree tree,
int row)
Ends a drag operation at the location of the given row. |
void |
drop(JTree tree,
String path)
Ends a drag operation at the location of the given TreePath . |
void |
expandPath(JTree tree,
String path)
Expands the given path, is possible. |
void |
expandRow(JTree tree,
int row)
Expands the given row, is possible. |
String |
nodeValue(JTree tree,
int row)
Returns the String representation of the node at the given row index. |
String |
nodeValue(JTree tree,
String path)
Returns the String representation of the node at the given path. |
void |
replaceCellReader(JTreeCellReader newCellReader)
Updates the implementation of JTreeCellReader to use when comparing internal values of a JTree and
the values expected in a test. |
void |
replaceSeparator(String newSeparator)
Updates the separator to use when converting TreePath s to String s. |
void |
requireEditable(JTree tree)
Asserts that the given JTree is editable. |
void |
requireNoSelection(JTree tree)
Asserts that the given JTree does not have any selection. |
void |
requireNotEditable(JTree tree)
Asserts that the given JTree is not editable. |
void |
requireSelection(JTree tree,
int[] rows)
Asserts that the given JTree 's selected rows are equal to the given one. |
void |
requireSelection(JTree tree,
String[] paths)
Asserts that the given JTree 's selected paths are equal to the given one. |
void |
rightClickPath(JTree tree,
String path)
Right-clicks the given path, expanding parent nodes if necessary. |
void |
rightClickRow(JTree tree,
int row)
Right-clicks the given row. |
void |
selectPath(JTree tree,
String path)
Selects the given path, expanding parent nodes if necessary. |
void |
selectPaths(JTree tree,
String[] paths)
Selects the given paths, expanding parent nodes if necessary. |
void |
selectRow(JTree tree,
int row)
Selects the given row. |
void |
selectRows(JTree tree,
int[] rows)
Selects the given rows. |
String |
separator()
|
JPopupMenu |
showPopupMenu(JTree tree,
int row)
Shows a pop-up menu at the position of the node in the given row. |
JPopupMenu |
showPopupMenu(JTree tree,
String path)
Shows a pop-up menu at the position of the last node in the given path. |
void |
toggleRow(JTree tree,
int row)
Change the open/closed state of the given row, if possible. |
Methods inherited from class org.assertj.swing.driver.JComponentDriver |
---|
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisible |
Methods inherited from class org.assertj.swing.driver.ContainerDriver |
---|
doResizeHeight, doResizeWidth, isResizable, move, resize |
Methods inherited from class org.assertj.swing.driver.ComponentDriver |
---|
backgroundOf, checkInEdtEnabledAndShowing, click, click, click, click, click, doubleClick, drag, dragOver, drop, focus, focusAndWaitForFocusGain, fontOf, foregroundOf, invokePopupMenu, invokePopupMenu, moveMouseIgnoringAnyError, moveMouseIgnoringAnyError, performAccessibleActionOf, pressAndReleaseKey, pressAndReleaseKey, pressAndReleaseKeys, pressKey, propertyName, releaseKey, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireSize, requireVisible, rightClick, settings, waitForShowing |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JTreeDriver(@Nonnull Robot robot)
JTreeDriver
.
robot
- the robot to use to simulate user input.Method Detail |
---|
@RunsInEDT public void clickRow(@Nonnull JTree tree, int row)
tree
- the target JTree
.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.@RunsInEDT public void clickRow(@Nonnull JTree tree, int row, @Nonnull MouseButton button)
tree
- the target JTree
.row
- the given row.button
- the mouse button to use.
NullPointerException
- if the given 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.@RunsInEDT public void clickRow(@Nonnull JTree tree, int row, @Nonnull MouseClickInfo mouseClickInfo)
tree
- the target JTree
.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.@RunsInEDT public void doubleClickRow(@Nonnull JTree tree, int row)
tree
- the target JTree
.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.@RunsInEDT public void rightClickRow(@Nonnull JTree tree, int row)
tree
- the target JTree
.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.@RunsInEDT public void clickPath(@Nonnull JTree tree, @Nonnull String path)
tree
- the target JTree
.path
- the path to 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.@RunsInEDT public void clickPath(@Nonnull JTree tree, @Nonnull String path, @Nonnull MouseButton button)
tree
- the target JTree
.path
- the path to path.button
- the mouse button to use.
NullPointerException
- if the given button is null
.
IllegalStateException
- if the JTree
is disabled.
IllegalStateException
- if the JTree
is not showing on the screen.
LocationUnavailableException
- if the given path cannot be found.@RunsInEDT public void clickPath(@Nonnull JTree tree, @Nonnull String path, @Nonnull MouseClickInfo mouseClickInfo)
tree
- the target JTree
.path
- the path to path.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.
LocationUnavailableException
- if the given path cannot be found.@RunsInEDT public void doubleClickPath(@Nonnull JTree tree, @Nonnull String path)
tree
- the target JTree
.path
- the path to double-click.
IllegalStateException
- if the JTree
is disabled.
IllegalStateException
- if the JTree
is not showing on the screen.
LocationUnavailableException
- if the given path cannot be found.@RunsInEDT public void rightClickPath(@Nonnull JTree tree, @Nonnull String path)
tree
- the target JTree
.path
- the path to 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.@RunsInEDT public void expandRow(@Nonnull JTree tree, int row)
NOTE: a reasonable assumption is that the toggle control is just to the left of the row bounds and is roughly a square the dimensions of the row height. Clicking in the center of that square should work.
tree
- the target JTree
.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.
ActionFailedException
- if this method fails to expand the row.@RunsInEDT public void collapseRow(@Nonnull JTree tree, int row)
NOTE: a reasonable assumption is that the toggle control is just to the left of the row bounds and is roughly a square the dimensions of the row height. Clicking in the center of that square should work.
tree
- the target JTree
.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.
ActionFailedException
- if this method fails to collapse the row.@RunsInEDT public void toggleRow(@Nonnull JTree tree, int row)
NOTE: a reasonable assumption is that the toggle control is just to the left of the row bounds and is roughly a square the dimensions of the row height. Clicking in the center of that square should work.
tree
- the target JTree
.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.
ActionFailedException
- if this method fails to toggle the row.@RunsInEDT public void expandPath(@Nonnull JTree tree, @Nonnull String path)
NOTE: a reasonable assumption is that the toggle control is just to the left of the row bounds and is roughly a square the dimensions of the row height. Clicking in the center of that square should work.
tree
- the target JTree
.path
- the path to expand.
IllegalStateException
- if the JTree
is disabled.
IllegalStateException
- if the JTree
is not showing on the screen.
LocationUnavailableException
- if the given path cannot be found.
ActionFailedException
- if this method fails to expand the path.@RunsInEDT public void collapsePath(@Nonnull JTree tree, @Nonnull String path)
NOTE: a reasonable assumption is that the toggle control is just to the left of the row bounds and is roughly a square the dimensions of the row height. Clicking in the center of that square should work.
tree
- the target JTree
.path
- the path to collapse.
IllegalStateException
- if the JTree
is disabled.
IllegalStateException
- if the JTree
is not showing on the screen.
LocationUnavailableException
- if the given path cannot be found.
ActionFailedException
- if this method fails to collapse the path.@RunsInEDT public void selectRows(@Nonnull JTree tree, @Nonnull int[] rows)
tree
- the target JTree
.rows
- the rows to select.
NullPointerException
- if the array of rows is null
.
IllegalArgumentException
- if the array of rows is empty.
IllegalStateException
- if the JTree
is disabled.
IllegalStateException
- if the JTree
is not showing on the screen.
IndexOutOfBoundsException
- if any of the given rows 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.@RunsInEDT public void selectRow(@Nonnull JTree tree, int row)
tree
- the target JTree
.row
- the row to select.
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
.@RunsInEDT public void selectPaths(@Nonnull JTree tree, @Nonnull String[] paths)
tree
- the target JTree
.paths
- the paths to select.
NullPointerException
- if the array of rows is null
.
IllegalArgumentException
- if the array of rows is empty.
IllegalStateException
- if the JTree
is disabled.
IllegalStateException
- if the JTree
is not showing on the screen.
LocationUnavailableException
- if any the given path cannot be found.@RunsInEDT public void selectPath(@Nonnull JTree tree, @Nonnull String path)
clickPath(JTree, String)
, this method
will not click the path if it is already selected
tree
- the target JTree
.path
- the path to select.
IllegalStateException
- if the JTree
is disabled.
IllegalStateException
- if the JTree
is not showing on the screen.
LocationUnavailableException
- if the given path cannot be found.@RunsInEDT @Nonnull public JPopupMenu showPopupMenu(@Nonnull JTree tree, int row)
tree
- the target JTree
.row
- the given row.
IllegalStateException
- if the JTree
is disabled.
IllegalStateException
- if the JTree
is not showing on the screen.
ComponentLookupException
- if a pop-up menu cannot be found.
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.@RunsInEDT @Nonnull public JPopupMenu showPopupMenu(@Nonnull JTree tree, @Nonnull String path)
tree
- the target JTree
.path
- the given path.
IllegalStateException
- if the JTree
is disabled.
IllegalStateException
- if the JTree
is not showing on the screen.
ComponentLookupException
- if a pop-up menu cannot be found.
LocationUnavailableException
- if the given path cannot be found.replaceSeparator(String)
@RunsInEDT public void drag(@Nonnull JTree tree, int row)
tree
- the target JTree
.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.@RunsInEDT public void drop(@Nonnull JTree tree, int row)
tree
- the target JTree
.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.
ActionFailedException
- if there is no drag action in effect.@RunsInEDT public void drag(@Nonnull JTree tree, @Nonnull String path)
TreePath
.
tree
- the target JTree
.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.replaceSeparator(String)
@RunsInEDT public void drop(@Nonnull JTree tree, @Nonnull String path)
TreePath
.
tree
- the target JTree
.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.
ActionFailedException
- if there is no drag action in effect.replaceSeparator(String)
@RunsInEDT public void requireSelection(@Nonnull JTree tree, @Nonnull int[] rows)
JTree
's selected rows are equal to the given one.
tree
- the target JTree
.rows
- the indices of the rows, expected to be selected.
NullPointerException
- if the array of row indices is null
.
AssertionError
- if the given JTree
selection is not equal to the given rows.@RunsInEDT public void requireSelection(@Nonnull JTree tree, @Nonnull String[] paths)
JTree
's selected paths are equal to the given one.
tree
- the target JTree
.paths
- the given paths, expected to be selected.
NullPointerException
- if the array of paths is null
.
LocationUnavailableException
- if any of the given paths cannot be found.
AssertionError
- if the given JTree
selection is not equal to the given paths.replaceSeparator(String)
@RunsInEDT public void requireNoSelection(@Nonnull JTree tree)
JTree
does not have any selection.
tree
- the given JTree
.
AssertionError
- if the JTree
has a selection.@RunsInEDT public void requireEditable(@Nonnull JTree tree)
JTree
is editable.
tree
- the given JTree
.
AssertionError
- if the JTree
is not editable.@RunsInEDT public void requireNotEditable(@Nonnull JTree tree)
JTree
is not editable.
tree
- the given JTree
.
AssertionError
- if the JTree
is editable.@Nonnull public String separator()
TreePath
s to String
s.public void replaceSeparator(@Nonnull String newSeparator)
TreePath
s to String
s.
newSeparator
- the new separator.
NullPointerException
- if the given separator is null
.public void replaceCellReader(@Nonnull JTreeCellReader newCellReader)
JTreeCellReader
to use when comparing internal values of a JTree
and
the values expected in a test.
newCellReader
- the new JTreeCellValueReader
to use.
NullPointerException
- if newCellReader
is null
.@RunsInEDT public void checkRowInBounds(@Nonnull JTree tree, int row)
tree
- the given JTree
.row
- the given index.
IndexOutOfBoundsException
- if the given index is less than zero or equal than or greater than the number of
visible rows in the JTree
.@RunsInEDT public void checkPathExists(@Nonnull JTree tree, @Nonnull String path)
tree
- the given JTree
.path
- the given path.
LocationUnavailableException
- if the given path cannot be found.@RunsInEDT @Nullable public String nodeValue(@Nonnull JTree tree, @Nonnull String path)
String
representation of the node at the given path.
tree
- the given JTree
.path
- the given path.
String
representation of the node at the given path.
LocationUnavailableException
- if the given path cannot be found.@Nullable public String nodeValue(@Nonnull JTree tree, int row)
String
representation of the node at the given row index.
tree
- the given JTree
.row
- the given row.
String
representation of the node at the given row index.
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |