< prev index next >
src/java.desktop/share/classes/javax/swing/tree/VariableHeightLayoutCache.java
Print this page
@@ -42,11 +42,11 @@
* 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 <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Rob Davis
* @author Ray Ryan
* @author Scott Violet
@@ -76,11 +76,11 @@
* every time a size is needed.
*/
private Rectangle boundsBuffer;
/**
- * Maps from <code>TreePath</code> to a <code>TreeStateNode</code>.
+ * Maps from {@code TreePath} to a {@code TreeStateNode}.
*/
private Hashtable<TreePath, TreeStateNode> treePathMapping;
/**
* A stack of stacks.
@@ -98,13 +98,13 @@
boundsBuffer = new Rectangle();
treePathMapping = new Hashtable<TreePath, TreeStateNode>();
}
/**
- * Sets the <code>TreeModel</code> that will provide the data.
+ * Sets the {@code TreeModel} that will provide the data.
*
- * @param newModel the <code>TreeModel</code> that is to provide the data
+ * @param newModel the {@code TreeModel} that is to provide the data
* @beaninfo
* bound: true
* description: The TreeModel that will provide the data.
*/
public void setModel(TreeModel newModel) {
@@ -112,11 +112,11 @@
rebuild(false);
}
/**
* Determines whether or not the root node from
- * the <code>TreeModel</code> is visible.
+ * the {@code TreeModel} is visible.
*
* @param rootVisible true if the root node of the tree is to be displayed
* @see #rootVisible
* @beaninfo
* bound: true
@@ -172,13 +172,13 @@
invalidateSizes();
visibleNodesChanged();
}
/**
- * Marks the path <code>path</code> expanded state to
- * <code>isExpanded</code>.
- * @param path the <code>TreePath</code> of interest
+ * Marks the path {@code path} expanded state to
+ * {@code isExpanded}.
+ * @param path the {@code TreePath} of interest
* @param isExpanded true if the path should be expanded, otherwise false
*/
public void setExpandedState(TreePath path, boolean isExpanded) {
if(path != null) {
if(isExpanded)
@@ -204,16 +204,16 @@
return (node != null) ? (node.isVisible() && node.isExpanded()) :
false;
}
/**
- * Returns the <code>Rectangle</code> enclosing the label portion
- * into which the item identified by <code>path</code> will be drawn.
+ * Returns the {@code Rectangle} enclosing the label portion
+ * into which the item identified by {@code path} will be drawn.
*
* @param path the path to be drawn
* @param placeIn the bounds of the enclosing rectangle
- * @return the bounds of the enclosing rectangle or <code>null</code>
+ * @return the bounds of the enclosing rectangle or {@code null}
* if the node could not be ascertained
*/
public Rectangle getBounds(TreePath path, Rectangle placeIn) {
TreeStateNode node = getNodeForPath(path, true, false);
@@ -224,16 +224,16 @@
}
return null;
}
/**
- * Returns the path for <code>row</code>. If <code>row</code>
- * is not visible, <code>null</code> is returned.
+ * Returns the path for {@code row}. If {@code row}
+ * is not visible, {@code null} is returned.
*
* @param row the location of interest
- * @return the path for <code>row</code>, or <code>null</code>
- * if <code>row</code> is not visible
+ * @return the path for {@code row}, or {@code null}
+ * if {@code row} is not visible
*/
public TreePath getPathForRow(int row) {
if(row >= 0 && row < getRowCount()) {
return getNode(row).getTreePath();
}
@@ -243,11 +243,11 @@
/**
* Returns the row where the last item identified in path is visible.
* Will return -1 if any of the elements in path are not
* currently visible.
*
- * @param path the <code>TreePath</code> of interest
+ * @param path the {@code TreePath} of interest
* @return the row where the last item in path is visible
*/
public int getRowForPath(TreePath path) {
if(path == null)
return -1;
@@ -266,14 +266,14 @@
public int getRowCount() {
return visibleNodes.size();
}
/**
- * Instructs the <code>LayoutCache</code> that the bounds for
- * <code>path</code> are invalid, and need to be updated.
+ * Instructs the {@code LayoutCache} that the bounds for
+ * {@code path} are invalid, and need to be updated.
*
- * @param path the <code>TreePath</code> which is now invalid
+ * @param path the {@code TreePath} which is now invalid
*/
public void invalidatePathBounds(TreePath path) {
TreeStateNode node = getNodeForPath(path, true, false);
if(node != null) {
@@ -299,11 +299,11 @@
return 0;
}
/**
* Returns the preferred width and height for the region in
- * <code>visibleRegion</code>.
+ * {@code visibleRegion}.
*
* @param bounds the region being queried
*/
public int getPreferredWidth(Rectangle bounds) {
if(updateNodeSizes)
@@ -312,11 +312,11 @@
return getMaxNodeWidth();
}
/**
* Returns the path to the node that is closest to x,y. If
- * there is nothing currently visible this will return <code>null</code>,
+ * there is nothing currently visible this will return {@code null},
* otherwise it will 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.
*
@@ -335,16 +335,16 @@
return getNode(row).getTreePath();
}
/**
- * Returns an <code>Enumerator</code> that increments over the visible paths
+ * Returns an {@code 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.
*
- * @param path the location in the <code>TreePath</code> to start
- * @return an <code>Enumerator</code> that increments over the visible
+ * @param path the location in the {@code TreePath} to start
+ * @return an {@code Enumerator} that increments over the visible
* paths
*/
public Enumeration<TreePath> getVisiblePathsFrom(TreePath path) {
TreeStateNode node = getNodeForPath(path, true, false);
@@ -353,21 +353,21 @@
}
return null;
}
/**
- * Returns the number of visible children for <code>path</code>.
- * @return the number of visible children for <code>path</code>
+ * Returns the number of visible children for {@code path}.
+ * @return the number of visible children for {@code path}
*/
public int getVisibleChildCount(TreePath path) {
TreeStateNode node = getNodeForPath(path, true, false);
return (node != null) ? node.getVisibleChildCount() : 0;
}
/**
- * Informs the <code>TreeState</code> that it needs to recalculate
+ * Informs the {@code TreeState} that it needs to recalculate
* all the sizes it is referencing.
*/
public void invalidateSizes() {
if(root != null)
root.deepMarkSizeInvalid();
@@ -375,13 +375,13 @@
updateNodeSizes(true);
}
}
/**
- * Returns true if the value identified by <code>path</code> is
+ * Returns true if the value identified by {@code path} is
* currently expanded.
- * @return true if the value identified by <code>path</code> is
+ * @return true if the value identified by {@code path} is
* currently expanded
*/
public boolean isExpanded(TreePath path) {
if(path != null) {
TreeStateNode lastNode = getNodeForPath(path, true, false);
@@ -401,17 +401,17 @@
* 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.
*
- * <p><code>e.path</code> returns the path the parent of the
+ * <p>{@code e.path} returns the path the parent of the
* changed node(s).
*
- * <p><code>e.childIndices</code> returns the index(es) of the
+ * <p>{@code e.childIndices} returns the index(es) of the
* changed node(s).
*
- * @param e the <code>TreeModelEvent</code> of interest
+ * @param e the {@code TreeModelEvent} of interest
*/
public void treeNodesChanged(TreeModelEvent e) {
if(e != null) {
int changedIndexs[];
TreeStateNode changedNode;
@@ -456,15 +456,15 @@
/**
* Invoked after nodes have been inserted into the tree.
*
- * <p><code>e.path</code> returns the parent of the new nodes.
- * <p><code>e.childIndices</code> returns the indices of the new nodes in
+ * <p>{@code e.path} returns the parent of the new nodes.
+ * <p>{@code e.childIndices} returns the indices of the new nodes in
* ascending order.
*
- * @param e the <code>TreeModelEvent</code> of interest
+ * @param e the {@code TreeModelEvent} of interest
*/
public void treeNodesInserted(TreeModelEvent e) {
if(e != null) {
int changedIndexs[];
TreeStateNode changedParentNode;
@@ -529,16 +529,16 @@
* 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.
*
- * <p><code>e.path</code> returns the former parent of the deleted nodes.
+ * <p>{@code e.path} returns the former parent of the deleted nodes.
*
- * <p><code>e.childIndices</code> returns the indices the nodes had
+ * <p>{@code e.childIndices} returns the indices the nodes had
* before they were deleted in ascending order.
*
- * @param e the <code>TreeModelEvent</code> of interest
+ * @param e the {@code TreeModelEvent} of interest
*/
public void treeNodesRemoved(TreeModelEvent e) {
if(e != null) {
int changedIndexs[];
TreeStateNode changedParentNode;
@@ -617,19 +617,19 @@
}
}
/**
* Invoked after the tree has drastically changed structure from a
- * given node down. If the path returned by <code>e.getPath</code>
+ * given node down. If the path returned by {@code 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.
*
- * <p><code>e.path</code> holds the path to the node.
- * <p><code>e.childIndices</code> returns <code>null</code>.
+ * <p>{@code e.path} holds the path to the node.
+ * <p>{@code e.childIndices} returns {@code null}.
*
- * @param e the <code>TreeModelEvent</code> of interest
+ * @param e the {@code TreeModelEvent} of interest
*/
public void treeStructureChanged(TreeModelEvent e) {
if(e != null)
{
TreePath changedPath = SwingUtilities2.getTreePath(e, getModel());
@@ -702,20 +702,20 @@
private void removeMapping(TreeStateNode node) {
treePathMapping.remove(node.getTreePath());
}
/**
- * Returns the node previously added for <code>path</code>. This may
+ * Returns the node previously added for {@code path}. This may
* return null, if you to create a node use getNodeForPath.
*/
private TreeStateNode getMapping(TreePath path) {
return treePathMapping.get(path);
}
/**
- * Retursn the bounds for row, <code>row</code> by reference in
- * <code>placeIn</code>. If <code>placeIn</code> is null a new
+ * Retursn the bounds for row, {@code row} by reference in
+ * {@code placeIn}. If {@code placeIn} is null a new
* Rectangle will be created and returned.
*/
private Rectangle getBounds(int row, Rectangle placeIn) {
if(updateNodeSizes)
updateNodeSizes(false);
@@ -1071,11 +1071,11 @@
}
}
/**
* Messaged when this node is removed from its parent, this messages
- * <code>removedFromMapping</code> to remove all the children.
+ * {@code removedFromMapping} to remove all the children.
*/
public void remove(int childIndex) {
TreeStateNode node = (TreeStateNode)getChildAt(childIndex);
node.removeFromMapping();
@@ -1274,11 +1274,11 @@
}
}
/**
* Makes the receiver visible, but invoking
- * <code>expandParentAndReceiver</code> on the superclass.
+ * {@code expandParentAndReceiver} on the superclass.
*/
public void makeVisible() {
TreeStateNode parent = (TreeStateNode)getParent();
if(parent != null)
@@ -1339,19 +1339,19 @@
protected void setYOrigin(int newYOrigin) {
yOrigin = newYOrigin;
}
/**
- * Shifts the y origin by <code>offset</code>.
+ * Shifts the y origin by {@code offset}.
*/
protected void shiftYOriginBy(int offset) {
yOrigin += offset;
}
/**
* Updates the receivers preferredSize by invoking
- * <code>updatePreferredSize</code> with an argument of -1.
+ * {@code updatePreferredSize} with an argument of -1.
*/
protected void updatePreferredSize() {
updatePreferredSize(getRow());
}
@@ -1404,11 +1404,11 @@
}
/**
* Returns the children of the receiver. If the children haven't
* been loaded from the model and
- * <code>createIfNeeded</code> is true, the children are first
+ * {@code createIfNeeded} is true, the children are first
* loaded.
*/
protected Enumeration<TreeNode> getLoadedChildren(boolean createIfNeeded) {
if(!createIfNeeded || hasBeenExpanded)
return super.children();
@@ -1448,11 +1448,11 @@
*/
protected void didAdjustTree() {
}
/**
- * Invokes <code>expandParentAndReceiver</code> on the parent,
+ * Invokes {@code expandParentAndReceiver} on the parent,
* and expands the receiver.
*/
protected void expandParentAndReceiver() {
TreeStateNode parent = (TreeStateNode)getParent();
@@ -1703,12 +1703,12 @@
updateNextObject();
return retObject;
}
/**
- * Determines the next object by invoking <code>updateNextIndex</code>
- * and if not succesful <code>findNextValidParent</code>.
+ * Determines the next object by invoking {@code updateNextIndex}
+ * and if not succesful {@code findNextValidParent}.
*/
protected void updateNextObject() {
if(!updateNextIndex()) {
findNextValidParent();
}
@@ -1740,11 +1740,11 @@
}
return false;
}
/**
- * Updates <code>nextIndex</code> returning false if it is beyond
+ * Updates {@code nextIndex} returning false if it is beyond
* the number of children of parent.
*/
protected boolean updateNextIndex() {
// nextIndex == -1 identifies receiver, make sure is expanded
// before descend.
< prev index next >