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..
| Modifier and Type | Class and Description |
|---|---|
| private class | FixedHeightLayoutCache.
FHTreeStateNode is used to track what has been expanded. |
| private class | FixedHeightLayoutCache.
Used as a placeholder when getting the path in FHTreeStateNodes. |
| private class | FixedHeightLayoutCache.
An enumerator to iterate through visible nodes. |
| Modifier and Type | Field 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. | info
Used for getting path/row information. |
| private FixedHeightLayoutCache. | root
Root node. |
| private int | rowCount
Number of rows currently visible. |
| private Stack | |
| private Hashtable | treePathMapping
Maps from TreePath to a FHTreeStateNode. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | adjustRowCountBy(int changeAmount)
Adjust the large row count of the AbstractTreeUI the receiver was created with. |
| private FixedHeightLayoutCache. | |
| 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 useda TreePath specifying a node path, Rectangle a Rectangle object giving the available space placeIn)Implements abstract javax. Returns a rectangle giving the bounds needed to draw path. |
| private Rectangle | getBounds(FixedHeightLayoutCache.
Returns the bounds for the given node. |
| public boolean | getExpandedState(TreePath path)
Implements abstract javax. Returns true if the path is expanded, and visible. |
| private FixedHeightLayoutCache. | |
| private FixedHeightLayoutCache. | 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. Returns the path to the node that is closest to x,y. |
| public TreePath | getPathForRow(int row)
Implements abstract javax. Returns the path for passed in row. |
| private int | |
| public int | getRowCount()
Implements abstract javax. Returns the number of visible rows. |
| public int | getRowForPath(TreePath path)
Implements abstract javax. Returns the row that the last item identified in path is visible at. |
| public int | getVisibleChildCount(TreePath path)
Implements abstract javax. Returns the number of visible children for row. |
| public Enumeration | getVisiblePathsFrom(TreePath path)
Implements abstract javax. Returns an Enumerator that increments over the visible paths starting at the passed in location. |
| public void | invalidatePathBounds(TreePath path)
Implements abstract javax. Does nothing, FixedHeightLayoutCache doesn't cache width, and that is all that could change. |
| public void | invalidateSizes()
Implements abstract javax. Informs the TreeState that it needs to recalculate all the sizes it is referencing. |
| public boolean | isExpanded(TreePath path)
Implements abstract javax. Returns true if the value identified by row is currently expanded. |
| private void | |
| private void | removeMapping(FixedHeightLayoutCache.
Removes the mapping for a previously added node. |
| public void | setExpandedState(TreePath path, boolean isExpanded)
Implements abstract javax. Marks the path |
| public void | setModel(TreeModel
the TreeModel that is to provide the data newModel)Overrides javax. 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. 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. Sets the height of each cell. |
| public void | treeNodesChanged(TreeModelEvent e)
Implements abstract javax. Invoked after a node (or a set of siblings) has changed in some way. |
| public void | treeNodesInserted(TreeModelEvent e)
Implements abstract javax. Invoked after nodes have been inserted into the tree. |
| public void | treeNodesRemoved(TreeModelEvent e)
Implements abstract javax. Invoked after nodes have been removed from the tree. |
| public void | treeStructureChanged(TreeModelEvent e)
Implements abstract javax. Invoked after the tree has drastically changed structure from a given node down. |
| private void |
| boundsBuffer | back to summary |
|---|---|
| private Rectangle boundsBuffer Used in getting sizes for nodes to avoid creating a new Rectangle every time a size is needed. | |
| info | back to summary |
|---|---|
| private FixedHeightLayoutCache. Used for getting path/row information. | |
| root | back to summary |
|---|---|
| private FixedHeightLayoutCache. Root node. | |
| rowCount | back to summary |
|---|---|
| private int rowCount Number of rows currently visible. | |
| tempStacks | back to summary |
|---|---|
| private Stack<Stack<TreePath>> tempStacks | |
| treePathMapping | back to summary |
|---|---|
| private Hashtable<TreePath, FixedHeightLayoutCache. Maps from TreePath to a FHTreeStateNode. | |
| FixedHeightLayoutCache | back to summary |
|---|---|
| public FixedHeightLayoutCache() Constructs a | |
| addMapping | back to summary |
|---|---|
| private void addMapping(FixedHeightLayoutCache. Adds a mapping for node. | |
| adjustRowCountBy | back to summary |
|---|---|
| private void adjustRowCountBy(int changeAmount) Adjust the large row count of the AbstractTreeUI the receiver was created with. | |
| createNodeForValue | back to summary |
|---|---|
| private FixedHeightLayoutCache. Creates and returns an instance of FHTreeStateNode. | |
| ensurePathIsExpanded | back 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. | |
| getBounds | back to summary |
|---|---|
| public Rectangle getBounds(TreePath path, Rectangle placeIn) Implements abstract javax. Returns a rectangle giving the bounds needed to draw path. | |
| getBounds | back to summary |
|---|---|
| private Rectangle getBounds(FixedHeightLayoutCache. Returns the bounds for the given node. If | |
| getExpandedState | back to summary |
|---|---|
| public boolean getExpandedState(TreePath path) Implements abstract javax. Returns true if the path is expanded, and visible. | |
| getMapping | back to summary |
|---|---|
| private FixedHeightLayoutCache. Returns the node previously added for | |
| getNodeForPath | back to summary |
|---|---|
| private FixedHeightLayoutCache. Messages getTreeNodeForPage(path, onlyIfVisible, shouldCreate, path.length) as long as path is non-null and the length is > 0. Otherwise returns null. | |
| getPathClosestTo | back to summary |
|---|---|
| public TreePath getPathClosestTo(int x, int y) Implements abstract javax. 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. | |
| getPathForRow | back to summary |
|---|---|
| public TreePath getPathForRow(int row) Implements abstract javax. Returns the path for passed in row. If row is not visible null is returned. | |
| getRowContainingYLocation | back 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. | |
| getRowCount | back to summary |
|---|---|
| public int getRowCount() Implements abstract javax. Returns the number of visible rows. | |
| getRowForPath | back to summary |
|---|---|
| public int getRowForPath(TreePath path) Implements abstract javax. 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. | |
| getVisibleChildCount | back to summary |
|---|---|
| public int getVisibleChildCount(TreePath path) Implements abstract javax. Returns the number of visible children for row. | |
| getVisiblePathsFrom | back to summary |
|---|---|
| public Enumeration Implements abstract javax. 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. | |
| invalidatePathBounds | back to summary |
|---|---|
| public void invalidatePathBounds(TreePath path) Implements abstract javax. Does nothing, FixedHeightLayoutCache doesn't cache width, and that is all that could change. | |
| invalidateSizes | back to summary |
|---|---|
| public void invalidateSizes() Implements abstract javax. Informs the TreeState that it needs to recalculate all the sizes it is referencing. | |
| isExpanded | back to summary |
|---|---|
| public boolean isExpanded(TreePath path) Implements abstract javax. Returns true if the value identified by row is currently expanded. | |
| rebuild | back to summary |
|---|---|
| private void rebuild(boolean clearSelection) Sent to completely rebuild the visible tree. All nodes are collapsed. | |
| removeMapping | back to summary |
|---|---|
| private void removeMapping(FixedHeightLayoutCache. Removes the mapping for a previously added node. | |
| setExpandedState | back to summary |
|---|---|
| public void setExpandedState(TreePath path, boolean isExpanded) Implements abstract javax. Marks the path | |
| setModel | back to summary |
|---|---|
| public void setModel(TreeModel newModel) Overrides javax. Sets the TreeModel that will provide the data.
| |
| setRootVisible | back to summary |
|---|---|
| public void setRootVisible(boolean rootVisible) Overrides javax. Determines whether or not the root node from the TreeModel is visible.
| |
| setRowHeight | back to summary |
|---|---|
| public void setRowHeight(int rowHeight) Overrides javax. Sets the height of each cell. If rowHeight is less than or equal to 0 this will throw an IllegalArgumentException.
| |
| treeNodesChanged | back to summary |
|---|---|
| public void treeNodesChanged(TreeModelEvent e) Implements abstract javax. 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). | |
| treeNodesInserted | back to summary |
|---|---|
| public void treeNodesInserted(TreeModelEvent e) Implements abstract javax. 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. | |
| treeNodesRemoved | back to summary |
|---|---|
| public void treeNodesRemoved(TreeModelEvent e) Implements abstract javax. 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. | |
| treeStructureChanged | back to summary |
|---|---|
| public void treeStructureChanged(TreeModelEvent e) Implements abstract javax. 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. | |
| visibleNodesChanged | back to summary |
|---|---|
| private void visibleNodesChanged() | |
| Modifier and Type | Field 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. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | addNode(FixedHeightLayoutCache.
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
|
| protected void | |
| protected void | adjustRowBy(int amount, int startIndex)
Adjusts this node, its child, and its parent starting at
an index of |
| protected void | childInsertedAtModelIndex(int index, boolean isExpandedAndVisible)
Messaged when a child has been inserted at index. |
| protected void | |
| protected FixedHeightLayoutCache. | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| public FixedHeightLayoutCache. | getChildAtModelIndex(int index)
Returns the child for the passed in model index, this will
return |
| public int | |
| 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
|
| protected boolean | getPathForRow(int row, int nextRow, FixedHeightLayoutCache.
Returns true if there is a row for |
| public int | |
| public int | |
| public int | getTotalChildCount()
Returns the number of children in the receiver by descending all expanded nodes and messaging them with getTotalChildCount. |
| public TreePath | |
| public int | |
| public boolean | |
| public boolean | isLeaf()
Overrides javax. Implements javax. Returns true if the receiver is a leaf. |
| public boolean | |
| protected void | |
| public void | remove(int childIndex)
Overrides javax. Implements javax. Messaged when this node is removed from its parent, this messages
|
| protected void | |
| protected void | |
| protected void | |
| protected void | resetChildrenRowsFrom(int newRow, int childIndex, int modelIndex)
Resets the receivers children's rows. |
| public void | setParent(MutableTreeNode parent)
Overrides javax. Implements javax. 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 |
| public void | setUserObject(Object o)
Overrides javax. Implements javax. Messaged to set the user object. |
| childCount | back to summary |
|---|---|
| protected int childCount Child count of the receiver. | |
| childIndex | back to summary |
|---|---|
| protected int childIndex Index of this node from the model. | |
| isExpanded | back to summary |
|---|---|
| protected boolean isExpanded Is this node expanded? | |
| path | back to summary |
|---|---|
| protected TreePath path Path of this node. | |
| row | back to summary |
|---|---|
| protected int row Row of the receiver. This is only valid if the row is expanded. | |
| FHTreeStateNode | back to summary |
|---|---|
| public FHTreeStateNode(Object userObject, int childIndex, int row) | |
| addNode | back to summary |
|---|---|
| protected void addNode(FixedHeightLayoutCache. Adds newChild to this nodes children at the appropriate location. The location is determined from the childIndex of newChild. | |
| adjustChildIndexs | back to summary |
|---|---|
| protected void adjustChildIndexs(int index, int amount) Adjusts the child indices of the receivers children by
| |
| adjustRowBy | back to summary |
|---|---|
| protected void adjustRowBy(int amount) Adjusts the receiver, and all its children rows by
| |
| adjustRowBy | back to summary |
|---|---|
| protected void adjustRowBy(int amount, int startIndex) Adjusts this node, its child, and its parent starting at
an index of | |
| childInsertedAtModelIndex | back 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. | |
| collapse | back to summary |
|---|---|
| protected void collapse(boolean adjustRows) Collapses the receiver. If | |
| createChildFor | back to summary |
|---|---|
| protected FixedHeightLayoutCache. Creates a new node to represent | |
| didAdjustTree | back to summary |
|---|---|
| protected void didAdjustTree() Messaged when this node either expands or collapses. | |
| didExpand | back 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. | |
| expand | back to summary |
|---|---|
| protected void expand() Expands the receiver. | |
| expandParentAndReceiver | back to summary |
|---|---|
| protected void expandParentAndReceiver() Invokes | |
| getChildAtModelIndex | back to summary |
|---|---|
| public FixedHeightLayoutCache. Returns the child for the passed in model index, this will
return | |
| getChildIndex | back to summary |
|---|---|
| public int getChildIndex() Returns the index of the receiver in the model. | |
| getCountTo | back to summary |
|---|---|
| protected int getCountTo(int stopIndex) Asks all the children of the receiver for their totalChildCount and returns this value (plus stopIndex). | |
| getNumExpandedChildrenTo | back to summary |
|---|---|
| protected int getNumExpandedChildrenTo(int stopIndex) Returns the number of children that are expanded to
| |
| getPathForRow | back to summary |
|---|---|
| protected boolean getPathForRow(int row, int nextRow, FixedHeightLayoutCache. Returns true if there is a row for | |
| getRow | back to summary |
|---|---|
| public int getRow() Returns the row of the receiver. | |
| getRowToModelIndex | back to summary |
|---|---|
| public int getRowToModelIndex(int index) Returns the row of the child with a model index of
| |
| getTotalChildCount | back to summary |
|---|---|
| public int getTotalChildCount() Returns the number of children in the receiver by descending all expanded nodes and messaging them with getTotalChildCount. | |
| getTreePath | back to summary |
|---|---|
| public TreePath getTreePath() Returns the | |
| getVisibleLevel | back to summary |
|---|---|
| public int getVisibleLevel() The highest visible nodes have a depth of 0. | |
| isExpanded | back to summary |
|---|---|
| public boolean isExpanded() Returns true if this node is expanded. | |
| isLeaf | back to summary |
|---|---|
| public boolean isLeaf() Overrides javax. Implements javax. Returns true if the receiver is a leaf. | |
| isVisible | back to summary |
|---|---|
| public boolean isVisible() Returns true if this node is visible. This is determined by asking all the parents if they are expanded. | |
| makeVisible | back to summary |
|---|---|
| protected void makeVisible() Makes the receiver visible, but invoking
| |
| remove | back to summary |
|---|---|
| public void remove(int childIndex) Overrides javax. Implements javax. Messaged when this node is removed from its parent, this messages
| |
| removeChildAtModelIndex | back to summary |
|---|---|
| protected void removeChildAtModelIndex(int modelIndex, boolean isChildVisible) Removes the child at | |
| removeFromMapping | back to summary |
|---|---|
| protected void removeFromMapping() Removes the receiver, and all its children, from the mapping table. | |
| resetChildrenPaths | back to summary |
|---|---|
| protected void resetChildrenPaths(TreePath parentPath) Recreates the receivers path, and all its children's paths. | |
| resetChildrenRowsFrom | back to summary |
|---|---|
| protected void resetChildrenRowsFrom(int newRow, int childIndex, int modelIndex) Resets the receivers children's rows. Starting with the child
at | |
| setParent | back to summary |
|---|---|
| public void setParent(MutableTreeNode parent) Overrides javax. Implements javax. Messaged when this node is added somewhere, resets the path and adds a mapping from path to this node. | |
| setRowAndChildren | back to summary |
|---|---|
| protected int setRowAndChildren(int nextRow) Sets the receivers row to | |
| setUserObject | back to summary |
|---|---|
| public void setUserObject(Object o) Overrides javax. Implements javax. Messaged to set the user object. This resets the path. | |
| Modifier and Type | Field and Description |
|---|---|
| protected int | |
| protected boolean | |
| protected FixedHeightLayoutCache. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected TreePath |
| childIndex | back to summary |
|---|---|
| protected int childIndex | |
| isNodeParentNode | back to summary |
|---|---|
| protected boolean isNodeParentNode | |
| node | back to summary |
|---|---|
| protected FixedHeightLayoutCache. | |
| SearchInfo | back to summary |
|---|---|
| private SearchInfo() | |
| getPath | back to summary |
|---|---|
| protected TreePath getPath() | |
| Modifier and Type | Field and Description |
|---|---|
| protected int | childCount
Number of children in parent. |
| protected int | nextIndex
Index of next child. |
| protected FixedHeightLayoutCache. | parent
Parent whose children are being enumerated. |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected |
| Modifier and Type | Method 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.Implements java. Tests if this enumeration contains more elements. |
| public TreePath | Returns: next visible TreePath.Implements java. Returns the next element of this enumeration if this enumeration object has at least one more element to provide. |
| protected boolean | updateNextIndex()
Updates |
| protected void | updateNextObject()
Determines the next object by invoking |
| childCount | back to summary |
|---|---|
| protected int childCount Number of children in parent. | |
| nextIndex | back to summary |
|---|---|
| protected int nextIndex Index of next child. An index of -1 signifies parent should be visibled next. | |
| parent | back to summary |
|---|---|
| protected FixedHeightLayoutCache. Parent whose children are being enumerated. | |
| VisibleFHTreeStateNodeEnumeration | back to summary |
|---|---|
| protected VisibleFHTreeStateNodeEnumeration(FixedHeightLayoutCache. | |
| VisibleFHTreeStateNodeEnumeration | back to summary |
|---|---|
| protected VisibleFHTreeStateNodeEnumeration(FixedHeightLayoutCache. | |
| findNextValidParent | back 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. | |
| hasMoreElements | back to summary |
|---|---|
| public boolean hasMoreElements() Implements java. Doc from java. Tests if this enumeration contains more elements.
| |
| nextElement | back to summary |
|---|---|
| public TreePath nextElement() Implements java. Doc from java. Returns the next element of this enumeration if this enumeration object has at least one more element to provide.
| |
| updateNextIndex | back to summary |
|---|---|
| protected boolean updateNextIndex() Updates | |
| updateNextObject | back to summary |
|---|---|
| protected void updateNextObject() Determines the next object by invoking | |