public final class JTreeLocation extends Object
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 and Description |
---|
JTreeLocation() |
Modifier and Type | Method and Description |
---|---|
Pair<Rectangle,Point> |
pathBoundsAndCoordinates(JTree tree,
TreePath path)
Returns the bounds and visible coordinates of the given path.
|
TreePath |
pathFor(JTree tree,
int row)
Returns the path for the given row.
|
Pair<Rectangle,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.
|
@RunsInCurrentThread public Pair<Rectangle,Point> rowBoundsAndCoordinates(JTree tree, int row)
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
tree
- the target JTree
.row
- the given row.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.@RunsInCurrentThread public TreePath pathFor(JTree tree, int row)
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
tree
- the target JTree
.row
- the given row.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.@RunsInCurrentThread public int validIndex(JTree tree, int row)
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
tree
- the target JTree
.row
- the row index to validate.IndexOutOfBoundsException
- if the given row is less than zero or equal than or greater than the number of
visible rows in the JTree
.@RunsInCurrentThread public Pair<Rectangle,Point> pathBoundsAndCoordinates(JTree tree, TreePath path)
Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.
tree
- the target JTree
.path
- the given path.LocationUnavailableException
- if any part of the path is not visible.Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.