|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.tree.DefaultMutableTreeNode javax.swing.tree.FixedHeightLayoutCache.FHTreeStateNode
FHTreeStateNode is used to track what has been expanded. FHTreeStateNode differs from VariableHeightTreeState.TreeStateNode in that it is highly model intensive. That is almost all queries to a FHTreeStateNode result in the TreeModel being queried. And it obviously does not support variable sized row heights.
Nested Class Summary |
Nested classes inherited from class javax.swing.tree.DefaultMutableTreeNode |
DefaultMutableTreeNode.BreadthFirstEnumeration, DefaultMutableTreeNode.PathBetweenNodesEnumeration, DefaultMutableTreeNode.PostorderEnumeration, DefaultMutableTreeNode.PreorderEnumeration |
Field Summary | |
protected int |
childCount
Child count of the receiver. |
protected int |
childIndex
Index of this node from the model. |
protected boolean |
isExpanded
Is this node expanded? |
protected TreePath |
path
Path of this node. |
protected int |
row
Row of the receiver. |
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode |
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
Constructor Summary | |
FixedHeightLayoutCache.FHTreeStateNode(Object userObject,
int childIndex,
int row)
|
Method Summary | |
protected void |
addNode(FixedHeightLayoutCache.FHTreeStateNode newChild)
Adds newChild to this nodes children at the appropriate location. |
protected void |
adjustChildIndexs(int index,
int amount)
Adjusts the child indexs of the receivers children by amount , starting at index . |
protected void |
adjustRowBy(int amount)
Adjusts the receiver, and all its children rows by amount . |
protected void |
adjustRowBy(int amount,
int startIndex)
Adjusts this node, its child, and its parent starting at an index of index index is the index of the child
to start adjusting from, which is not necessarily the model
index. |
protected void |
childInsertedAtModelIndex(int index,
boolean isExpandedAndVisible)
Messaged when a child has been inserted at index. |
protected void |
collapse(boolean adjustRows)
Collapses the receiver. |
protected FixedHeightLayoutCache.FHTreeStateNode |
createChildFor(Object userObject)
Creates a new node to represent userObject .
|
protected void |
didAdjustTree()
Messaged when this node either expands or collapses. |
protected void |
didExpand()
Messaged when the node has expanded. |
protected void |
expand()
Expands the receiver. |
protected void |
expandParentAndReceiver()
Invokes expandParentAndReceiver on the parent,
and expands the receiver. |
FixedHeightLayoutCache.FHTreeStateNode |
getChildAtModelIndex(int index)
Returns the child for the passed in model index, this will return null if the child for index
has not yet been created (expanded). |
int |
getChildIndex()
Returns the index of the receiver in the model. |
protected int |
getCountTo(int stopIndex)
Asks all the children of the receiver for their totalChildCount and returns this value (plus stopIndex). |
protected int |
getNumExpandedChildrenTo(int stopIndex)
Returns the number of children that are expanded to stopIndex . |
protected boolean |
getPathForRow(int row,
int nextRow,
FixedHeightLayoutCache.SearchInfo info)
Returns true if there is a row for row .
|
int |
getRow()
Returns the row of the receiver. |
int |
getRowToModelIndex(int index)
Returns the row of the child with a model index of index . |
int |
getTotalChildCount()
Returns the number of children in the receiver by descending all expanded nodes and messaging them with getTotalChildCount. |
TreePath |
getTreePath()
Returns the TreePath of the receiver. |
int |
getVisibleLevel()
The highest visible nodes have a depth of 0. |
boolean |
isExpanded()
Returns true if this node is expanded. |
boolean |
isLeaf()
Returns true if the receiver is a leaf. |
boolean |
isVisible()
Returns true if this node is visible. |
protected void |
makeVisible()
Makes the receiver visible, but invoking expandParentAndReceiver on the superclass. |
void |
remove(int childIndex)
Messaged when this node is removed from its parent, this messages removedFromMapping to remove all the children. |
protected void |
removeChildAtModelIndex(int modelIndex,
boolean isChildVisible)
Removes the child at modelIndex .
|
protected void |
removeFromMapping()
Removes the receiver, and all its children, from the mapping table. |
protected void |
resetChildrenPaths(TreePath parentPath)
Recreates the receivers path, and all its childrens paths. |
protected void |
resetChildrenRowsFrom(int newRow,
int childIndex,
int modelIndex)
Resets the receivers childrens rows. |
void |
setParent(MutableTreeNode parent)
Messaged when this node is added somewhere, resets the path and adds a mapping from path to this node. |
protected int |
setRowAndChildren(int nextRow)
Sets the receivers row to nextRow and recursively
updates all the children of the receivers rows. |
void |
setUserObject(Object o)
Messaged to set the user object. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected boolean isExpanded
protected int childIndex
protected int childCount
protected int row
protected TreePath path
Constructor Detail |
public FixedHeightLayoutCache.FHTreeStateNode(Object userObject, int childIndex, int row)
Method Detail |
public void setParent(MutableTreeNode parent)
setParent
in interface MutableTreeNode
setParent
in class DefaultMutableTreeNode
parent
- this node's new parentpublic void remove(int childIndex)
removedFromMapping
to remove all the children.
remove
in interface MutableTreeNode
remove
in class DefaultMutableTreeNode
childIndex
- the index in this node's child array
of the child to removepublic void setUserObject(Object o)
setUserObject
in interface MutableTreeNode
setUserObject
in class DefaultMutableTreeNode
o
- the Object that constitutes this node's
user-specified dataDefaultMutableTreeNode.getUserObject()
,
DefaultMutableTreeNode.toString()
public int getChildIndex()
public TreePath getTreePath()
TreePath
of the receiver.
public FixedHeightLayoutCache.FHTreeStateNode getChildAtModelIndex(int index)
null
if the child for index
has not yet been created (expanded).
public boolean isVisible()
public int getRow()
public int getRowToModelIndex(int index)
index
.
public int getTotalChildCount()
public boolean isExpanded()
public int getVisibleLevel()
protected void resetChildrenPaths(TreePath parentPath)
protected void removeFromMapping()
protected FixedHeightLayoutCache.FHTreeStateNode createChildFor(Object userObject)
userObject
.
This does NOT check to ensure there isn't already a child node
to manage userObject
.
protected void adjustRowBy(int amount)
amount
.
protected void adjustRowBy(int amount, int startIndex)
index
index is the index of the child
to start adjusting from, which is not necessarily the model
index.
protected void didExpand()
protected int setRowAndChildren(int nextRow)
nextRow
and recursively
updates all the children of the receivers rows. The index the
next row is to be placed as is returned.
protected void resetChildrenRowsFrom(int newRow, int childIndex, int modelIndex)
childIndex
(and modelIndex
) to
newRow
. This uses setRowAndChildren
to recursively descend children, and uses
resetRowSelection
to ascend parents.
protected void makeVisible()
expandParentAndReceiver
on the superclass.
protected void expandParentAndReceiver()
expandParentAndReceiver
on the parent,
and expands the receiver.
protected void expand()
protected void collapse(boolean adjustRows)
adjustRows
is true,
the rows of nodes after the receiver are adjusted.
public boolean isLeaf()
isLeaf
in interface TreeNode
isLeaf
in class DefaultMutableTreeNode
DefaultMutableTreeNode.getAllowsChildren()
protected void addNode(FixedHeightLayoutCache.FHTreeStateNode newChild)
protected void removeChildAtModelIndex(int modelIndex, boolean isChildVisible)
modelIndex
.
isChildVisible
should be true if the receiver
is visible and expanded.
protected void adjustChildIndexs(int index, int amount)
amount
, starting at index
.
protected void childInsertedAtModelIndex(int index, boolean isExpandedAndVisible)
protected boolean getPathForRow(int row, int nextRow, FixedHeightLayoutCache.SearchInfo info)
row
.
nextRow
gives the bounds of the receiver.
Information about the found row is returned in info
.
This should be invoked on root with nextRow
set
to getRowCount
().
protected int getCountTo(int stopIndex)
protected int getNumExpandedChildrenTo(int stopIndex)
stopIndex
. This does not include the number
of children that the child at stopIndex
might
have.
protected void didAdjustTree()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |