Package org.fest.swing.driver
Class JTreeLocation
java.lang.Object
org.fest.swing.driver.JTreeLocation
Understands a visible location on a
JTree
. A row index or a String
ified
TreePath
(i.e. each TreePath
component is a String
) or
a TreePath
of Object
may be used to indicate the location. Note that if a
TreePath
is used, the entire path leading up to the designated node must be viewable at the
time the location is used.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionpathBoundsAndCoordinates
(JTree tree, TreePath path) Returns the bounds and visible coordinates of the given path.Returns the path for the given row.private Point
rowBoundsAndCoordinates
(JTree tree, int row) Returns the bounds and visible coordinates of the given row.int
validIndex
(JTree tree, int row) Validates that the given row index is valid.
-
Constructor Details
-
JTreeLocation
public JTreeLocation()
-
-
Method Details
-
rowBoundsAndCoordinates
Returns the bounds and visible coordinates of the given row.Note: This method is not executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in the EDT.
- Parameters:
tree
- the targetJTree
.row
- the given row.- Returns:
- the the bounds and visible coordinates of the given row.
- Throws:
IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.- Since:
- 1.2
-
pathFor
Returns the path for the given row.Note: This method is not executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in the EDT.
- Parameters:
tree
- the targetJTree
.row
- the given row.- Returns:
- the path for the given row.
- Throws:
IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.LocationUnavailableException
- if a tree path for the given row cannot be found.
-
validIndex
Validates that the given row index is valid.- Parameters:
tree
- the targetJTree
.row
- the row index to validate.- Returns:
- the validated row index.
- Throws:
IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of visible rows in theJTree
.
-
pathBoundsAndCoordinates
@RunsInCurrentThread public Pair<Rectangle,Point> pathBoundsAndCoordinates(JTree tree, TreePath path) Returns the bounds and visible coordinates of the given path.Note: This method is not executed in the event dispatch thread (EDT.) Clients are responsible for invoking this method in the EDT.
- Parameters:
tree
- the targetJTree
.path
- the given path.- Returns:
- the bounds and visible coordinates of the given path.
- Throws:
LocationUnavailableException
- if any part of the path is not visible.- Since:
- 1.2
-
pointAt
-