|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.swing.driver.ComponentDriver
org.fest.swing.driver.ContainerDriver
org.fest.swing.driver.JComponentDriver
org.fest.swing.driver.JTreeDriver
public class JTreeDriver
Understands functional testing of
s:
JTree
org.fest.swing.fixture
in your tests.
Field Summary |
---|
Fields inherited from class org.fest.swing.driver.ComponentDriver |
---|
robot |
Constructor Summary | |
---|---|
JTreeDriver(Robot robot)
Creates a new JTreeDriver . |
Method Summary | |
---|---|
void |
cellReader(JTreeCellReader newCellReader)
Updates the implementation of to use when comparing internal values of a
and the values expected in a test. |
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 . |
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 . |
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 |
requireEditable(JTree tree)
Asserts that the given is editable. |
void |
requireNoSelection(JTree tree)
Asserts that the given does not have any selection. |
void |
requireNotEditable(JTree tree)
Asserts that the given is not editable. |
void |
requireSelection(JTree tree,
int[] rows)
Asserts that the given 's selected rows are equal to the given one. |
void |
requireSelection(JTree tree,
String[] paths)
Asserts that the given '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()
Returns the separator to use when converting s to String s. |
void |
separator(String newSeparator)
Updates the separator to use when converting s to String s. |
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. |
void |
validatePath(JTree tree,
String path)
Verifies that the given node path exists. |
void |
validateRow(JTree tree,
int row)
Verifies that the given row index is valid. |
Methods inherited from class org.fest.swing.driver.JComponentDriver |
---|
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisible |
Methods inherited from class org.fest.swing.driver.ContainerDriver |
---|
move, resize, resizeHeight, resizeWidth |
Methods inherited from class org.fest.swing.driver.ComponentDriver |
---|
assertIsEnabledAndShowing, click, click, click, click, click, doubleClick, drag, dragOver, drop, focus, focusAndWaitForFocusGain, 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(Robot robot)
JTreeDriver
.
robot
- the robot to use to simulate user input.Method Detail |
---|
@RunsInEDT public void clickRow(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(JTree tree, int row, 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(JTree tree, int row, 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(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(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(JTree tree, 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(JTree tree, String path, 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(JTree tree, String path, 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(JTree tree, 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(JTree tree, 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(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(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(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(JTree tree, 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(JTree tree, 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(JTree tree, 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(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(JTree tree, 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(JTree tree, 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 public JPopupMenu showPopupMenu(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 public JPopupMenu showPopupMenu(JTree tree, 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.separator(String)
@RunsInEDT public void drag(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(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(JTree tree, 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.separator(String)
@RunsInEDT public void drop(JTree tree, 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.separator(String)
@RunsInEDT public void requireSelection(JTree tree, 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(JTree tree, 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.separator(String)
@RunsInEDT public void requireNoSelection(JTree tree)
JTree
does not have any selection.
tree
- the given JTree
.
AssertionError
- if the JTree
has a selection.@RunsInEDT public void requireEditable(JTree tree)
JTree
is editable.
tree
- the given JTree
.
AssertionError
- if the JTree
is not editable.@RunsInEDT public void requireNotEditable(JTree tree)
JTree
is not editable.
tree
- the given JTree
.
AssertionError
- if the JTree
is editable.public String separator()
TreePath
s to String
s.
TreePath
s to String
s.public void separator(String newSeparator)
TreePath
s to String
s.
newSeparator
- the new separator.
NullPointerException
- if the given separator is null
.public void cellReader(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 validateRow(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 validatePath(JTree tree, String path)
tree
- the given JTree
.path
- the given path.
LocationUnavailableException
- if the given path cannot be found.@RunsInEDT public String nodeValue(JTree tree, 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.public String nodeValue(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 |