|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wicket.markup.html.tree.TreeState
public final class TreeState
Holder and handler for tree state.
This class is largely based on
FixedHeightLayoutCache
from JDK 1.5_01. Using that
class or VariableHeightLayoutCache
gave problems
when working in clustered environments. Hence, for this class most of the
useful workings of FixedHeightLayoutCache were copied, while everything that
is Swing/paint specific was removed.
Constructor Summary | |
---|---|
TreeState()
Construct. |
Method Summary | |
---|---|
boolean |
getExpandedState(javax.swing.tree.TreePath path)
Returns true if the path is expanded, and visible. |
javax.swing.tree.TreeModel |
getModel()
Returns the TreeModel that is providing the data. |
javax.swing.tree.TreePath |
getPathForRow(int row)
Returns the path for passed in row. |
int |
getRowCount()
Returns the number of visible rows. |
int |
getRowForPath(javax.swing.tree.TreePath path)
Returns the row that the last item identified in path is visible at. |
int[] |
getRowsForPaths(javax.swing.tree.TreePath[] paths)
Returns the rows that the TreePath instances in
path are being displayed at. |
javax.swing.tree.TreePath |
getSelectedPath()
Gets the currently selected path. |
javax.swing.tree.TreeSelectionModel |
getSelectionModel()
Returns the model used to maintain the selection. |
int |
getVisibleChildCount(javax.swing.tree.TreePath path)
Returns the number of visible children for row. |
java.util.Enumeration |
getVisiblePathsFrom(javax.swing.tree.TreePath path)
Returns an Enumerator that increments over the visible paths starting at the passed in location. |
boolean |
isExpanded(javax.swing.tree.TreePath path)
Returns true if the value identified by row is currently expanded. |
boolean |
isRootVisible()
Returns true if the root node of the tree is displayed. |
void |
setExpandedState(javax.swing.tree.TreePath path,
boolean isExpanded)
Marks the path path expanded state to
isExpanded . |
void |
setModel(javax.swing.tree.TreeModel newModel)
Sets the TreeModel that will provide the data. |
void |
setRootVisible(boolean rootVisible)
Determines whether or not the root node from the TreeModel is visible. |
void |
setSelectedPath(javax.swing.tree.TreePath selection)
Expands the selected path and set selection to currently selected path. |
void |
setSelectionModel(javax.swing.tree.TreeSelectionModel selectionModel)
Sets the TreeSelectionModel used to manage the selection
to new LSM. |
void |
treeNodesChanged(javax.swing.event.TreeModelEvent e)
Invoked after a node (or a set of siblings) has changed in some way. |
void |
treeNodesInserted(javax.swing.event.TreeModelEvent e)
Invoked after nodes have been inserted into the tree. |
void |
treeNodesRemoved(javax.swing.event.TreeModelEvent e)
Invoked after nodes have been removed from the tree. |
void |
treeStructureChanged(javax.swing.event.TreeModelEvent e)
Invoked after the tree has drastically changed structure from a given node down. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TreeState()
Method Detail |
---|
public void setSelectedPath(javax.swing.tree.TreePath selection)
selection
- the new selection.public javax.swing.tree.TreePath getSelectedPath()
public javax.swing.tree.TreeModel getModel()
TreeModel
that is providing the data.
TreeModel
that is providing the datapublic boolean isRootVisible()
public void setSelectionModel(javax.swing.tree.TreeSelectionModel selectionModel)
TreeSelectionModel
used to manage the selection
to new LSM.
selectionModel
- the new TreeSelectionModel
public javax.swing.tree.TreeSelectionModel getSelectionModel()
treeSelectionModel
public int[] getRowsForPaths(javax.swing.tree.TreePath[] paths)
TreePath
instances in
path
are being displayed at. This method should return an
array of the same length as that passed in, and if one of the
TreePaths
in path
is not valid its entry in
the array should be set to -1.
getRowsForPaths
in interface javax.swing.tree.RowMapper
paths
- the array of TreePath
s being queried
TreePath
is
displayed; if paths
is null
,
null
is returnedpublic void setModel(javax.swing.tree.TreeModel newModel)
newModel
- the TreeModel that is to provide the datapublic void setRootVisible(boolean rootVisible)
rootVisible
- true if the root node of the tree is to be displayedpublic int getRowCount()
public boolean isExpanded(javax.swing.tree.TreePath path)
path
- the row
public javax.swing.tree.TreePath getPathForRow(int row)
row
- the row
public int getRowForPath(javax.swing.tree.TreePath path)
path
- the path
public int getVisibleChildCount(javax.swing.tree.TreePath path)
path
- the path
public java.util.Enumeration getVisiblePathsFrom(javax.swing.tree.TreePath path)
path
- the path
public void setExpandedState(javax.swing.tree.TreePath path, boolean isExpanded)
path
expanded state to
isExpanded
.
path
- the pathisExpanded
- whether the path is expandedpublic boolean getExpandedState(javax.swing.tree.TreePath path)
path
- the path
public void treeNodesChanged(javax.swing.event.TreeModelEvent e)
Invoked after a node (or a set of siblings) has changed in some way. The node(s) have not changed locations in the tree or altered their children arrays, but other attributes have changed and may affect presentation. Example: the name of a file has changed, but it is in the same location in the file system.
e.path() returns the path the parent of the changed node(s).
e.childIndices() returns the index(es) of the changed node(s).
treeNodesChanged
in interface javax.swing.event.TreeModelListener
e
- the tree model eventpublic void treeNodesInserted(javax.swing.event.TreeModelEvent e)
Invoked after nodes have been inserted into the tree.
e.path() returns the parent of the new nodes
e.childIndices() returns the indices of the new nodes in ascending order.
treeNodesInserted
in interface javax.swing.event.TreeModelListener
e
- the tree model eventpublic void treeNodesRemoved(javax.swing.event.TreeModelEvent e)
Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree, this method may only be invoked once for the root of the removed subtree, not once for each individual set of siblings removed.
e.path() returns the former parent of the deleted nodes.
e.childIndices() returns the indices the nodes had before they were deleted in ascending order.
treeNodesRemoved
in interface javax.swing.event.TreeModelListener
e
- the tree model eventpublic void treeStructureChanged(javax.swing.event.TreeModelEvent e)
Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.
e.path() holds the path to the node.
e.childIndices() returns null.
treeStructureChanged
in interface javax.swing.event.TreeModelListener
e
- the tree model event
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |