APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.tree

public Class FixedHeightLayoutCache

extends AbstractLayoutCache
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
javax.swing.event.TreeModelEvent, java.awt.Rectangle, java.util.Enumeration, .Hashtable, .NoSuchElementException, .Stack, sun.swing.SwingUtilities2

Note

This will become more open in a future release.

Warning

Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see java.beans.XMLEncoder.

Author
Scott Violet

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
FixedHeightLayoutCache.FHTreeStateNode

FHTreeStateNode is used to track what has been expanded.

private class
FixedHeightLayoutCache.SearchInfo

Used as a placeholder when getting the path in FHTreeStateNodes.

private class
FixedHeightLayoutCache.VisibleFHTreeStateNodeEnumeration

An enumerator to iterate through visible nodes.

Field Summary

Modifier and TypeField and Description
private Rectangle
boundsBuffer

Used in getting sizes for nodes to avoid creating a new Rectangle every time a size is needed.

private FixedHeightLayoutCache.SearchInfo
info

Used for getting path/row information.

private FixedHeightLayoutCache.FHTreeStateNode
root

Root node.

private int
rowCount

Number of rows currently visible.

private Stack<Stack<TreePath>>
private Hashtable<TreePath, FixedHeightLayoutCache.FHTreeStateNode>
treePathMapping

Maps from TreePath to a FHTreeStateNode.

Inherited from javax.swing.tree.AbstractLayoutCache:
nodeDimensionsrootVisiblerowHeighttreeModeltreeSelectionModel

Constructor Summary

AccessConstructor and Description
public
FixedHeightLayoutCache()

Constructs a FixedHeightLayoutCache.

Method Summary

Modifier and TypeMethod and Description
private void
addMapping(FixedHeightLayoutCache.FHTreeStateNode node)

Adds a mapping for node.

private void
adjustRowCountBy(int changeAmount)

Adjust the large row count of the AbstractTreeUI the receiver was created with.

private FixedHeightLayoutCache.FHTreeStateNode
createNodeForValue(Object value, int childIndex)

Creates and returns an instance of FHTreeStateNode.

private boolean
ensurePathIsExpanded(TreePath aPath, boolean expandLast)

Ensures that all the path components in path are expanded, except for the last component which will only be expanded if expandLast is true.

public Rectangle

Returns:

a Rectangle object specifying the space to be used
getBounds
(TreePath
a TreePath specifying a node
path
,
Rectangle
a Rectangle object giving the available space
placeIn
)

Implements abstract javax.swing.tree.AbstractLayoutCache.getBounds.

Returns a rectangle giving the bounds needed to draw path.

private Rectangle
getBounds(FixedHeightLayoutCache.FHTreeStateNode parent, int childIndex, Rectangle placeIn)

Returns the bounds for the given node.

public boolean
getExpandedState(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.getExpandedState.

Returns true if the path is expanded, and visible.

private FixedHeightLayoutCache.FHTreeStateNode
getMapping(TreePath path)

Returns the node previously added for path.

private FixedHeightLayoutCache.FHTreeStateNode
getNodeForPath(TreePath path, boolean onlyIfVisible, boolean shouldCreate)

Messages getTreeNodeForPage(path, onlyIfVisible, shouldCreate, path.length) as long as path is non-null and the length is > 0.

public TreePath
getPathClosestTo(int x, int y)

Implements abstract javax.swing.tree.AbstractLayoutCache.getPathClosestTo.

Returns the path to the node that is closest to x,y.

public TreePath
getPathForRow(int row)

Implements abstract javax.swing.tree.AbstractLayoutCache.getPathForRow.

Returns the path for passed in row.

private int
getRowContainingYLocation(int location)

Returns the index of the row containing location.

public int
getRowCount()

Implements abstract javax.swing.tree.AbstractLayoutCache.getRowCount.

Returns the number of visible rows.

public int
getRowForPath(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.getRowForPath.

Returns the row that the last item identified in path is visible at.

public int
getVisibleChildCount(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.getVisibleChildCount.

Returns the number of visible children for row.

public Enumeration<TreePath>
getVisiblePathsFrom(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.getVisiblePathsFrom.

Returns an Enumerator that increments over the visible paths starting at the passed in location.

public void
invalidatePathBounds(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.invalidatePathBounds.

Does nothing, FixedHeightLayoutCache doesn't cache width, and that is all that could change.

public void
invalidateSizes()

Implements abstract javax.swing.tree.AbstractLayoutCache.invalidateSizes.

Informs the TreeState that it needs to recalculate all the sizes it is referencing.

public boolean
isExpanded(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.isExpanded.

Returns true if the value identified by row is currently expanded.

private void
rebuild(boolean clearSelection)

Sent to completely rebuild the visible tree.

private void
removeMapping(FixedHeightLayoutCache.FHTreeStateNode node)

Removes the mapping for a previously added node.

public void
setExpandedState(TreePath path, boolean isExpanded)

Implements abstract javax.swing.tree.AbstractLayoutCache.setExpandedState.

Marks the path path expanded state to isExpanded.

public void
setModel(TreeModel
the TreeModel that is to provide the data
newModel
)

Overrides javax.swing.tree.AbstractLayoutCache.setModel.

Sets the TreeModel that will provide the data.

public void
setRootVisible(boolean
true if the root node of the tree is to be displayed
rootVisible
)

Overrides javax.swing.tree.AbstractLayoutCache.setRootVisible.

Determines whether or not the root node from the TreeModel is visible.

public void
setRowHeight(int
the height of each cell, in pixels
rowHeight
)

Overrides javax.swing.tree.AbstractLayoutCache.setRowHeight.

Sets the height of each cell.

public void
treeNodesChanged(TreeModelEvent e)

Implements abstract javax.swing.tree.AbstractLayoutCache.treeNodesChanged.

Invoked after a node (or a set of siblings) has changed in some way.

public void
treeNodesInserted(TreeModelEvent e)

Implements abstract javax.swing.tree.AbstractLayoutCache.treeNodesInserted.

Invoked after nodes have been inserted into the tree.

public void
treeNodesRemoved(TreeModelEvent e)

Implements abstract javax.swing.tree.AbstractLayoutCache.treeNodesRemoved.

Invoked after nodes have been removed from the tree.

public void
treeStructureChanged(TreeModelEvent e)

Implements abstract javax.swing.tree.AbstractLayoutCache.treeStructureChanged.

Invoked after the tree has drastically changed structure from a given node down.

private void
Inherited from javax.swing.tree.AbstractLayoutCache:
getModelgetNodeDimensionsgetNodeDimensionsgetPreferredHeightgetPreferredWidthgetRowHeightgetRowsForPathsgetSelectionModelisFixedRowHeightisRootVisiblesetNodeDimensionssetSelectionModel

Field Detail

boundsBufferback to summary
private Rectangle boundsBuffer

Used in getting sizes for nodes to avoid creating a new Rectangle every time a size is needed.

infoback to summary
private FixedHeightLayoutCache.SearchInfo info

Used for getting path/row information.

rootback to summary
private FixedHeightLayoutCache.FHTreeStateNode root

Root node.

rowCountback to summary
private int rowCount

Number of rows currently visible.

tempStacksback to summary
private Stack<Stack<TreePath>> tempStacks
treePathMappingback to summary
private Hashtable<TreePath, FixedHeightLayoutCache.FHTreeStateNode> treePathMapping

Maps from TreePath to a FHTreeStateNode.

Constructor Detail

FixedHeightLayoutCacheback to summary
public FixedHeightLayoutCache()

Constructs a FixedHeightLayoutCache.

Method Detail

addMappingback to summary
private void addMapping(FixedHeightLayoutCache.FHTreeStateNode node)

Adds a mapping for node.

adjustRowCountByback to summary
private void adjustRowCountBy(int changeAmount)

Adjust the large row count of the AbstractTreeUI the receiver was created with.

createNodeForValueback to summary
private FixedHeightLayoutCache.FHTreeStateNode createNodeForValue(Object value, int childIndex)

Creates and returns an instance of FHTreeStateNode.

ensurePathIsExpandedback to summary
private boolean ensurePathIsExpanded(TreePath aPath, boolean expandLast)

Ensures that all the path components in path are expanded, except for the last component which will only be expanded if expandLast is true. Returns true if successful in finding the path.

getBoundsback to summary
public Rectangle getBounds(TreePath path, Rectangle placeIn)

Implements abstract javax.swing.tree.AbstractLayoutCache.getBounds.

Returns a rectangle giving the bounds needed to draw path.

Parameters
path:TreePath

a TreePath specifying a node

placeIn:Rectangle

a Rectangle object giving the available space

Returns:Rectangle

a Rectangle object specifying the space to be used

getBoundsback to summary
private Rectangle getBounds(FixedHeightLayoutCache.FHTreeStateNode parent, int childIndex, Rectangle placeIn)

Returns the bounds for the given node. If childIndex is -1, the bounds of parent are returned, otherwise the bounds of the node at childIndex are returned.

getExpandedStateback to summary
public boolean getExpandedState(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.getExpandedState.

Returns true if the path is expanded, and visible.

getMappingback to summary
private FixedHeightLayoutCache.FHTreeStateNode getMapping(TreePath path)

Returns the node previously added for path. This may return null, if you to create a node use getNodeForPath.

getNodeForPathback to summary
private FixedHeightLayoutCache.FHTreeStateNode getNodeForPath(TreePath path, boolean onlyIfVisible, boolean shouldCreate)

Messages getTreeNodeForPage(path, onlyIfVisible, shouldCreate, path.length) as long as path is non-null and the length is > 0. Otherwise returns null.

getPathClosestToback to summary
public TreePath getPathClosestTo(int x, int y)

Implements abstract javax.swing.tree.AbstractLayoutCache.getPathClosestTo.

Returns the path to the node that is closest to x,y. If there is nothing currently visible this will return null, otherwise it'll always return a valid path. If you need to test if the returned object is exactly at x, y you should get the bounds for the returned path and test x, y against that.

getPathForRowback to summary
public TreePath getPathForRow(int row)

Implements abstract javax.swing.tree.AbstractLayoutCache.getPathForRow.

Returns the path for passed in row. If row is not visible null is returned.

getRowContainingYLocationback to summary
private int getRowContainingYLocation(int location)

Returns the index of the row containing location. If there are no rows, -1 is returned. If location is beyond the last row index, the last row index is returned.

getRowCountback to summary
public int getRowCount()

Implements abstract javax.swing.tree.AbstractLayoutCache.getRowCount.

Returns the number of visible rows.

getRowForPathback to summary
public int getRowForPath(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.getRowForPath.

Returns the row that the last item identified in path is visible at. Will return -1 if any of the elements in path are not currently visible.

getVisibleChildCountback to summary
public int getVisibleChildCount(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.getVisibleChildCount.

Returns the number of visible children for row.

getVisiblePathsFromback to summary
public Enumeration<TreePath> getVisiblePathsFrom(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.getVisiblePathsFrom.

Returns an Enumerator that increments over the visible paths starting at the passed in location. The ordering of the enumeration is based on how the paths are displayed.

invalidatePathBoundsback to summary
public void invalidatePathBounds(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.invalidatePathBounds.

Does nothing, FixedHeightLayoutCache doesn't cache width, and that is all that could change.

invalidateSizesback to summary
public void invalidateSizes()

Implements abstract javax.swing.tree.AbstractLayoutCache.invalidateSizes.

Informs the TreeState that it needs to recalculate all the sizes it is referencing.

isExpandedback to summary
public boolean isExpanded(TreePath path)

Implements abstract javax.swing.tree.AbstractLayoutCache.isExpanded.

Returns true if the value identified by row is currently expanded.

rebuildback to summary
private void rebuild(boolean clearSelection)

Sent to completely rebuild the visible tree. All nodes are collapsed.

removeMappingback to summary
private void removeMapping(FixedHeightLayoutCache.FHTreeStateNode node)

Removes the mapping for a previously added node.

setExpandedStateback to summary
public void setExpandedState(TreePath path, boolean isExpanded)

Implements abstract javax.swing.tree.AbstractLayoutCache.setExpandedState.

Marks the path path expanded state to isExpanded.

setModelback to summary
public void setModel(TreeModel newModel)

Overrides javax.swing.tree.AbstractLayoutCache.setModel.

Sets the TreeModel that will provide the data.

Parameters
newModel:TreeModel

the TreeModel that is to provide the data

setRootVisibleback to summary
public void setRootVisible(boolean rootVisible)

Overrides javax.swing.tree.AbstractLayoutCache.setRootVisible.

Determines whether or not the root node from the TreeModel is visible.

Parameters
rootVisible:boolean

true if the root node of the tree is to be displayed

See Also
rootVisible
setRowHeightback to summary
public void setRowHeight(int rowHeight)

Overrides javax.swing.tree.AbstractLayoutCache.setRowHeight.

Sets the height of each cell. If rowHeight is less than or equal to 0 this will throw an IllegalArgumentException.

Parameters
rowHeight:int

the height of each cell, in pixels

treeNodesChangedback to summary
public void treeNodesChanged(TreeModelEvent e)

Implements abstract javax.swing.tree.AbstractLayoutCache.treeNodesChanged.

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).

treeNodesInsertedback to summary
public void treeNodesInserted(TreeModelEvent e)

Implements abstract javax.swing.tree.AbstractLayoutCache.treeNodesInserted.

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.

treeNodesRemovedback to summary
public void treeNodesRemoved(TreeModelEvent e)

Implements abstract javax.swing.tree.AbstractLayoutCache.treeNodesRemoved.

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.

treeStructureChangedback to summary
public void treeStructureChanged(TreeModelEvent e)

Implements abstract javax.swing.tree.AbstractLayoutCache.treeStructureChanged.

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.

visibleNodesChangedback to summary
private void visibleNodesChanged()
javax.swing.tree back to summary

private Class FixedHeightLayoutCache.FHTreeStateNode

extends DefaultMutableTreeNode
Class Inheritance

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.

Field Summary

Modifier and TypeField and Description
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.

Inherited from javax.swing.tree.DefaultMutableTreeNode:
allowsChildrenchildrenEMPTY_ENUMERATIONparentuserObject

Constructor Summary

AccessConstructor and Description
public
FHTreeStateNode(Object userObject, int childIndex, int row)

Method Summary

Modifier and TypeMethod and Description
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 indices 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.

public 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).

public 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.

public int
getRow()

Returns the row of the receiver.

public int
getRowToModelIndex(int index)

Returns the row of the child with a model index of index.

public int
getTotalChildCount()

Returns the number of children in the receiver by descending all expanded nodes and messaging them with getTotalChildCount.

public TreePath
getTreePath()

Returns the TreePath of the receiver.

public int
getVisibleLevel()

The highest visible nodes have a depth of 0.

public boolean
isExpanded()

Returns true if this node is expanded.

public boolean
isLeaf()

Overrides javax.swing.tree.DefaultMutableTreeNode.isLeaf.

Implements javax.swing.tree.TreeNode.isLeaf.

Returns true if the receiver is a leaf.

public boolean
isVisible()

Returns true if this node is visible.

protected void
makeVisible()

Makes the receiver visible, but invoking expandParentAndReceiver on the superclass.

public void
remove(int childIndex)

Overrides javax.swing.tree.DefaultMutableTreeNode.remove.

Implements javax.swing.tree.MutableTreeNode.remove.

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 children's paths.

protected void
resetChildrenRowsFrom(int newRow, int childIndex, int modelIndex)

Resets the receivers children's rows.

public void
setParent(MutableTreeNode parent)

Overrides javax.swing.tree.DefaultMutableTreeNode.setParent.

Implements javax.swing.tree.MutableTreeNode.setParent.

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.

public void
Inherited from javax.swing.tree.DefaultMutableTreeNode:
addbreadthFirstEnumerationchildrenclonedepthFirstEnumerationgetAllowsChildrengetChildAftergetChildAtgetChildBeforegetChildCountgetDepthgetFirstChildgetFirstLeafgetIndexgetLastChildgetLastLeafgetLeafCountgetLevelgetNextLeafgetNextNodegetNextSiblinggetParentgetPathgetPathToRootgetPreviousLeafgetPreviousNodegetPreviousSiblinggetRootgetSharedAncestorgetSiblingCountgetUserObjectgetUserObjectPathinsertisNodeAncestorisNodeChildisNodeDescendantisNodeRelatedisNodeSiblingisRootpathFromAncestorEnumerationpostorderEnumerationpreorderEnumerationremoveremoveAllChildrenremoveFromParentsetAllowsChildrentoString

Field Detail

childCountback to summary
protected int childCount

Child count of the receiver.

childIndexback to summary
protected int childIndex

Index of this node from the model.

isExpandedback to summary
protected boolean isExpanded

Is this node expanded?

pathback to summary
protected TreePath path

Path of this node.

rowback to summary
protected int row

Row of the receiver. This is only valid if the row is expanded.

Constructor Detail

FHTreeStateNodeback to summary
public FHTreeStateNode(Object userObject, int childIndex, int row)

Method Detail

addNodeback to summary
protected void addNode(FixedHeightLayoutCache.FHTreeStateNode newChild)

Adds newChild to this nodes children at the appropriate location. The location is determined from the childIndex of newChild.

adjustChildIndexsback to summary
protected void adjustChildIndexs(int index, int amount)

Adjusts the child indices of the receivers children by amount, starting at index.

adjustRowByback to summary
protected void adjustRowBy(int amount)

Adjusts the receiver, and all its children rows by amount.

adjustRowByback to summary
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.

childInsertedAtModelIndexback to summary
protected void childInsertedAtModelIndex(int index, boolean isExpandedAndVisible)

Messaged when a child has been inserted at index. For all the children that have a childIndex ≥ index their index is incremented by one.

collapseback to summary
protected void collapse(boolean adjustRows)

Collapses the receiver. If adjustRows is true, the rows of nodes after the receiver are adjusted.

createChildForback to summary
protected FixedHeightLayoutCache.FHTreeStateNode createChildFor(Object userObject)

Creates a new node to represent userObject. This does NOT check to ensure there isn't already a child node to manage userObject.

didAdjustTreeback to summary
protected void didAdjustTree()

Messaged when this node either expands or collapses.

didExpandback to summary
protected void didExpand()

Messaged when the node has expanded. This updates all of the receivers children rows, as well as the total row count.

expandback to summary
protected void expand()

Expands the receiver.

expandParentAndReceiverback to summary
protected void expandParentAndReceiver()

Invokes expandParentAndReceiver on the parent, and expands the receiver.

getChildAtModelIndexback to summary
public 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).

getChildIndexback to summary
public int getChildIndex()

Returns the index of the receiver in the model.

getCountToback to summary
protected int getCountTo(int stopIndex)

Asks all the children of the receiver for their totalChildCount and returns this value (plus stopIndex).

getNumExpandedChildrenToback to summary
protected int getNumExpandedChildrenTo(int stopIndex)

Returns the number of children that are expanded to stopIndex. This does not include the number of children that the child at stopIndex might have.

getPathForRowback to summary
protected boolean getPathForRow(int row, int nextRow, FixedHeightLayoutCache.SearchInfo info)

Returns true if there is a row for 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().

getRowback to summary
public int getRow()

Returns the row of the receiver.

getRowToModelIndexback to summary
public int getRowToModelIndex(int index)

Returns the row of the child with a model index of index.

getTotalChildCountback to summary
public int getTotalChildCount()

Returns the number of children in the receiver by descending all expanded nodes and messaging them with getTotalChildCount.

getTreePathback to summary
public TreePath getTreePath()

Returns the TreePath of the receiver.

getVisibleLevelback to summary
public int getVisibleLevel()

The highest visible nodes have a depth of 0.

isExpandedback to summary
public boolean isExpanded()

Returns true if this node is expanded.

isLeafback to summary
public boolean isLeaf()

Overrides javax.swing.tree.DefaultMutableTreeNode.isLeaf.

Implements javax.swing.tree.TreeNode.isLeaf.

Returns true if the receiver is a leaf.

isVisibleback to summary
public boolean isVisible()

Returns true if this node is visible. This is determined by asking all the parents if they are expanded.

makeVisibleback to summary
protected void makeVisible()

Makes the receiver visible, but invoking expandParentAndReceiver on the superclass.

removeback to summary
public void remove(int childIndex)

Overrides javax.swing.tree.DefaultMutableTreeNode.remove.

Implements javax.swing.tree.MutableTreeNode.remove.

Messaged when this node is removed from its parent, this messages removedFromMapping to remove all the children.

removeChildAtModelIndexback to summary
protected void removeChildAtModelIndex(int modelIndex, boolean isChildVisible)

Removes the child at modelIndex. isChildVisible should be true if the receiver is visible and expanded.

removeFromMappingback to summary
protected void removeFromMapping()

Removes the receiver, and all its children, from the mapping table.

resetChildrenPathsback to summary
protected void resetChildrenPaths(TreePath parentPath)

Recreates the receivers path, and all its children's paths.

resetChildrenRowsFromback to summary
protected void resetChildrenRowsFrom(int newRow, int childIndex, int modelIndex)

Resets the receivers children's rows. Starting with the child at childIndex (and modelIndex) to newRow. This uses setRowAndChildren to recursively descend children, and uses resetRowSelection to ascend parents.

setParentback to summary
public void setParent(MutableTreeNode parent)

Overrides javax.swing.tree.DefaultMutableTreeNode.setParent.

Implements javax.swing.tree.MutableTreeNode.setParent.

Messaged when this node is added somewhere, resets the path and adds a mapping from path to this node.

setRowAndChildrenback to summary
protected int setRowAndChildren(int nextRow)

Sets the receivers row to nextRow and recursively updates all the children of the receivers rows. The index the next row is to be placed as is returned.

setUserObjectback to summary
public void setUserObject(Object o)

Overrides javax.swing.tree.DefaultMutableTreeNode.setUserObject.

Implements javax.swing.tree.MutableTreeNode.setUserObject.

Messaged to set the user object. This resets the path.

javax.swing.tree back to summary

private Class FixedHeightLayoutCache.SearchInfo

extends Object
Class Inheritance

Used as a placeholder when getting the path in FHTreeStateNodes.

Field Summary

Modifier and TypeField and Description
protected int
protected boolean
protected FixedHeightLayoutCache.FHTreeStateNode

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected TreePath
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

childIndexback to summary
protected int childIndex
isNodeParentNodeback to summary
protected boolean isNodeParentNode
nodeback to summary
protected FixedHeightLayoutCache.FHTreeStateNode node

Constructor Detail

SearchInfoback to summary
private SearchInfo()

Method Detail

getPathback to summary
protected TreePath getPath()
javax.swing.tree back to summary

private Class FixedHeightLayoutCache.VisibleFHTreeStateNodeEnumeration

extends Object
implements Enumeration<TreePath>
Class Inheritance
  • java.lang.Object
  • javax.swing.tree.FixedHeightLayoutCache.VisibleFHTreeStateNodeEnumeration
All Implemented Interfaces
java.util.Enumeration

An enumerator to iterate through visible nodes.

Field Summary

Modifier and TypeField and Description
protected int
childCount

Number of children in parent.

protected int
nextIndex

Index of next child.

protected FixedHeightLayoutCache.FHTreeStateNode
parent

Parent whose children are being enumerated.

Constructor Summary

AccessConstructor and Description
protected
protected

Method Summary

Modifier and TypeMethod and Description
protected boolean
findNextValidParent()

Finds the next valid parent, this should be called when nextIndex is beyond the number of children of the current parent.

public boolean

Returns:

true if more visible nodes.
hasMoreElements
()

Implements java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.

public TreePath

Returns:

next visible TreePath.
nextElement
()

Implements java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

protected boolean
updateNextIndex()

Updates nextIndex returning false if it is beyond the number of children of parent.

protected void
updateNextObject()

Determines the next object by invoking updateNextIndex and if not successful findNextValidParent.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

childCountback to summary
protected int childCount

Number of children in parent.

nextIndexback to summary
protected int nextIndex

Index of next child. An index of -1 signifies parent should be visibled next.

parentback to summary
protected FixedHeightLayoutCache.FHTreeStateNode parent

Parent whose children are being enumerated.

Constructor Detail

VisibleFHTreeStateNodeEnumerationback to summary
protected VisibleFHTreeStateNodeEnumeration(FixedHeightLayoutCache.FHTreeStateNode node)
VisibleFHTreeStateNodeEnumerationback to summary
protected VisibleFHTreeStateNodeEnumeration(FixedHeightLayoutCache.FHTreeStateNode parent, int startIndex)

Method Detail

findNextValidParentback to summary
protected boolean findNextValidParent()

Finds the next valid parent, this should be called when nextIndex is beyond the number of children of the current parent.

hasMoreElementsback to summary
public boolean hasMoreElements()

Implements java.util.Enumeration.hasMoreElements.

Doc from java.util.Enumeration.hasMoreElements.

Tests if this enumeration contains more elements.

Returns:boolean

true if more visible nodes.

nextElementback to summary
public TreePath nextElement()

Implements java.util.Enumeration.nextElement.

Doc from java.util.Enumeration.nextElement.

Returns the next element of this enumeration if this enumeration object has at least one more element to provide.

Returns:TreePath

next visible TreePath.

updateNextIndexback to summary
protected boolean updateNextIndex()

Updates nextIndex returning false if it is beyond the number of children of parent.

updateNextObjectback to summary
protected void updateNextObject()

Determines the next object by invoking updateNextIndex and if not successful findNextValidParent.