< prev index next >

src/java.desktop/share/classes/javax/swing/tree/FixedHeightLayoutCache.java

Print this page

        

*** 41,51 **** * 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&trade; ! * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @author Scott Violet */ @SuppressWarnings("serial") // Same-version serialization only --- 41,51 ---- * 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&trade; ! * has been added to the {@code java.beans} package. * Please see {@link java.beans.XMLEncoder}. * * @author Scott Violet */ @SuppressWarnings("serial") // Same-version serialization only
*** 292,303 **** } return null; } /** ! * Marks the path <code>path</code> expanded state to ! * <code>isExpanded</code>. */ public void setExpandedState(TreePath path, boolean isExpanded) { if(isExpanded) ensurePathIsExpanded(path, true); else if(path != null) { --- 292,303 ---- } return null; } /** ! * Marks the path {@code path} expanded state to ! * {@code isExpanded}. */ public void setExpandedState(TreePath path, boolean isExpanded) { if(isExpanded) ensurePathIsExpanded(path, true); else if(path != null) {
*** 525,537 **** private void visibleNodesChanged() { } /** ! * Returns the bounds for the given node. If <code>childIndex</code> ! * is -1, the bounds of <code>parent</code> are returned, otherwise ! * the bounds of the node at <code>childIndex</code> are returned. */ private Rectangle getBounds(FHTreeStateNode parent, int childIndex, Rectangle placeIn) { boolean expanded; int level; --- 525,537 ---- private void visibleNodesChanged() { } /** ! * Returns the bounds for the given node. If {@code childIndex} ! * is -1, the bounds of {@code parent} are returned, otherwise ! * the bounds of the node at {@code childIndex} are returned. */ private Rectangle getBounds(FHTreeStateNode parent, int childIndex, Rectangle placeIn) { boolean expanded; int level;
*** 589,599 **** private void removeMapping(FHTreeStateNode node) { treePathMapping.remove(node.getTreePath()); } /** ! * Returns the node previously added for <code>path</code>. This may * return null, if you to create a node use getNodeForPath. */ private FHTreeStateNode getMapping(TreePath path) { return treePathMapping.get(path); } --- 589,599 ---- private void removeMapping(FHTreeStateNode node) { treePathMapping.remove(node.getTreePath()); } /** ! * Returns the node previously added for {@code path}. This may * return null, if you to create a node use getNodeForPath. */ private FHTreeStateNode getMapping(TreePath path) { return treePathMapping.get(path); }
*** 785,795 **** } } /** * Messaged when this node is removed from its parent, this messages ! * <code>removedFromMapping</code> to remove all the children. */ public void remove(int childIndex) { FHTreeStateNode node = (FHTreeStateNode)getChildAt(childIndex); node.removeFromMapping(); --- 785,795 ---- } } /** * Messaged when this node is removed from its parent, this messages ! * {@code removedFromMapping} to remove all the children. */ public void remove(int childIndex) { FHTreeStateNode node = (FHTreeStateNode)getChildAt(childIndex); node.removeFromMapping();
*** 820,838 **** public int getChildIndex() { return childIndex; } /** ! * Returns the <code>TreePath</code> of the receiver. */ public TreePath getTreePath() { return path; } /** * Returns the child for the passed in model index, this will ! * return <code>null</code> if the child for <code>index</code> * has not yet been created (expanded). */ public FHTreeStateNode getChildAtModelIndex(int index) { // PENDING: Make this a binary search! for(int counter = getChildCount() - 1; counter >= 0; counter--) --- 820,838 ---- public int getChildIndex() { return childIndex; } /** ! * Returns the {@code TreePath} of the receiver. */ public TreePath getTreePath() { return path; } /** * Returns the child for the passed in model index, this will ! * return {@code null} if the child for {@code index} * has not yet been created (expanded). */ public FHTreeStateNode getChildAtModelIndex(int index) { // PENDING: Make this a binary search! for(int counter = getChildCount() - 1; counter >= 0; counter--)
*** 860,870 **** return row; } /** * Returns the row of the child with a model index of ! * <code>index</code>. */ public int getRowToModelIndex(int index) { FHTreeStateNode child; int lastRow = getRow() + 1; int retValue = lastRow; --- 860,870 ---- return row; } /** * Returns the row of the child with a model index of ! * {@code index}. */ public int getRowToModelIndex(int index) { FHTreeStateNode child; int lastRow = getRow() + 1; int retValue = lastRow;
*** 963,975 **** ((FHTreeStateNode)getChildAt(counter)).removeFromMapping(); } } /** ! * Creates a new node to represent <code>userObject</code>. * This does NOT check to ensure there isn't already a child node ! * to manage <code>userObject</code>. */ protected FHTreeStateNode createChildFor(Object userObject) { int newChildIndex = treeModel.getIndexOfChild (getUserObject(), userObject); --- 963,975 ---- ((FHTreeStateNode)getChildAt(counter)).removeFromMapping(); } } /** ! * Creates a new node to represent {@code userObject}. * This does NOT check to ensure there isn't already a child node ! * to manage {@code userObject}. */ protected FHTreeStateNode createChildFor(Object userObject) { int newChildIndex = treeModel.getIndexOfChild (getUserObject(), userObject);
*** 1000,1010 **** return child; } /** * Adjusts the receiver, and all its children rows by ! * <code>amount</code>. */ protected void adjustRowBy(int amount) { row += amount; if(isExpanded) { for(int counter = getChildCount() - 1; counter >= 0; --- 1000,1010 ---- return child; } /** * Adjusts the receiver, and all its children rows by ! * {@code amount}. */ protected void adjustRowBy(int amount) { row += amount; if(isExpanded) { for(int counter = getChildCount() - 1; counter >= 0;
*** 1013,1023 **** } } /** * Adjusts this node, its child, and its parent starting at ! * an index of <code>index</code> index is the index of the child * to start adjusting from, which is not necessarily the model * index. */ protected void adjustRowBy(int amount, int startIndex) { // Could check isVisible, but probably isn't worth it. --- 1013,1023 ---- } } /** * Adjusts this node, its child, and its parent starting at ! * an index of {@code index} index is the index of the child * to start adjusting from, which is not necessarily the model * index. */ protected void adjustRowBy(int amount, int startIndex) { // Could check isVisible, but probably isn't worth it.
*** 1049,1059 **** } adjustRowCountBy(childRowCount); } /** ! * Sets the receivers row to <code>nextRow</code> and recursively * updates all the children of the receivers rows. The index the * next row is to be placed as is returned. */ protected int setRowAndChildren(int nextRow) { row = nextRow; --- 1049,1059 ---- } adjustRowCountBy(childRowCount); } /** ! * Sets the receivers row to {@code nextRow} and recursively * updates all the children of the receivers rows. The index the * next row is to be placed as is returned. */ protected int setRowAndChildren(int nextRow) { row = nextRow;
*** 1080,1093 **** return lastRow + childCount - lastModelIndex; } /** * Resets the receivers children's rows. Starting with the child ! * at <code>childIndex</code> (and <code>modelIndex</code>) to ! * <code>newRow</code>. This uses <code>setRowAndChildren</code> * to recursively descend children, and uses ! * <code>resetRowSelection</code> to ascend parents. */ // This can be rather expensive, but is needed for the collapse // case this is resulting from a remove (although I could fix // that by having instances of FHTreeStateNode hold a ref to // the number of children). I prefer this though, making determing --- 1080,1093 ---- return lastRow + childCount - lastModelIndex; } /** * Resets the receivers children's rows. Starting with the child ! * at {@code childIndex} (and {@code modelIndex}) to ! * {@code newRow}. This uses {@code setRowAndChildren} * to recursively descend children, and uses ! * {@code resetRowSelection} to ascend parents. */ // This can be rather expensive, but is needed for the collapse // case this is resulting from a remove (although I could fix // that by having instances of FHTreeStateNode hold a ref to // the number of children). I prefer this though, making determing
*** 1121,1141 **** } } /** * Makes the receiver visible, but invoking ! * <code>expandParentAndReceiver</code> on the superclass. */ protected void makeVisible() { FHTreeStateNode parent = (FHTreeStateNode)getParent(); if(parent != null) parent.expandParentAndReceiver(); } /** ! * Invokes <code>expandParentAndReceiver</code> on the parent, * and expands the receiver. */ protected void expandParentAndReceiver() { FHTreeStateNode parent = (FHTreeStateNode)getParent(); --- 1121,1141 ---- } } /** * Makes the receiver visible, but invoking ! * {@code expandParentAndReceiver} on the superclass. */ protected void makeVisible() { FHTreeStateNode parent = (FHTreeStateNode)getParent(); if(parent != null) parent.expandParentAndReceiver(); } /** ! * Invokes {@code expandParentAndReceiver} on the parent, * and expands the receiver. */ protected void expandParentAndReceiver() { FHTreeStateNode parent = (FHTreeStateNode)getParent();
*** 1164,1174 **** } } } /** ! * Collapses the receiver. If <code>adjustRows</code> is true, * the rows of nodes after the receiver are adjusted. */ protected void collapse(boolean adjustRows) { if(isExpanded) { if(isVisible() && adjustRows) { --- 1164,1174 ---- } } } /** ! * Collapses the receiver. If {@code adjustRows} is true, * the rows of nodes after the receiver are adjusted. */ protected void collapse(boolean adjustRows) { if(isExpanded) { if(isVisible() && adjustRows) {
*** 1218,1229 **** if(!added) add(newChild); } /** ! * Removes the child at <code>modelIndex</code>. ! * <code>isChildVisible</code> should be true if the receiver * is visible and expanded. */ protected void removeChildAtModelIndex(int modelIndex, boolean isChildVisible) { FHTreeStateNode childNode = getChildAtModelIndex(modelIndex); --- 1218,1229 ---- if(!added) add(newChild); } /** ! * Removes the child at {@code modelIndex}. ! * {@code isChildVisible} should be true if the receiver * is visible and expanded. */ protected void removeChildAtModelIndex(int modelIndex, boolean isChildVisible) { FHTreeStateNode childNode = getChildAtModelIndex(modelIndex);
*** 1272,1282 **** } } /** * Adjusts the child indexs of the receivers children by ! * <code>amount</code>, starting at <code>index</code>. */ protected void adjustChildIndexs(int index, int amount) { for(int counter = index, maxCounter = getChildCount(); counter < maxCounter; counter++) { ((FHTreeStateNode)getChildAt(counter)).childIndex += amount; --- 1272,1282 ---- } } /** * Adjusts the child indexs of the receivers children by ! * {@code amount}, starting at {@code index}. */ protected void adjustChildIndexs(int index, int amount) { for(int counter = index, maxCounter = getChildCount(); counter < maxCounter; counter++) { ((FHTreeStateNode)getChildAt(counter)).childIndex += amount;
*** 1316,1330 **** } childCount++; } /** ! * Returns true if there is a row for <code>row</code>. ! * <code>nextRow</code> gives the bounds of the receiver. ! * Information about the found row is returned in <code>info</code>. ! * This should be invoked on root with <code>nextRow</code> set ! * to <code>getRowCount</code>(). */ protected boolean getPathForRow(int row, int nextRow, SearchInfo info) { if(this.row == row) { info.node = this; --- 1316,1330 ---- } childCount++; } /** ! * Returns true if there is a row for {@code row}. ! * {@code nextRow} gives the bounds of the receiver. ! * Information about the found row is returned in {@code info}. ! * This should be invoked on root with {@code nextRow} set ! * to {@code getRowCount}(). */ protected boolean getPathForRow(int row, int nextRow, SearchInfo info) { if(this.row == row) { info.node = this;
*** 1421,1432 **** return retCount; } /** * Returns the number of children that are expanded to ! * <code>stopIndex</code>. This does not include the number ! * of children that the child at <code>stopIndex</code> might * have. */ protected int getNumExpandedChildrenTo(int stopIndex) { FHTreeStateNode aChild; int retCount = stopIndex; --- 1421,1432 ---- return retCount; } /** * Returns the number of children that are expanded to ! * {@code stopIndex}. This does not include the number ! * of children that the child at {@code stopIndex} might * have. */ protected int getNumExpandedChildrenTo(int stopIndex) { FHTreeStateNode aChild; int retCount = stopIndex;
*** 1532,1543 **** updateNextObject(); return retObject; } /** ! * Determines the next object by invoking <code>updateNextIndex</code> ! * and if not succesful <code>findNextValidParent</code>. */ protected void updateNextObject() { if(!updateNextIndex()) { findNextValidParent(); } --- 1532,1543 ---- updateNextObject(); return retObject; } /** ! * Determines the next object by invoking {@code updateNextIndex} ! * and if not succesful {@code findNextValidParent}. */ protected void updateNextObject() { if(!updateNextIndex()) { findNextValidParent(); }
*** 1570,1580 **** } return false; } /** ! * Updates <code>nextIndex</code> 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. --- 1570,1580 ---- } return false; } /** ! * 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 >