src/share/classes/javax/swing/tree/VariableHeightLayoutCache.java
Print this page
*** 740,750 ****
if (isRootVisible())
visibleNodes.addElement(root);
if(!root.isExpanded())
root.expand();
else {
! Enumeration cursor = root.children();
while(cursor.hasMoreElements()) {
visibleNodes.addElement(cursor.nextElement());
}
if(!isFixedRowHeight())
updateYLocationsFrom(0);
--- 740,750 ----
if (isRootVisible())
visibleNodes.addElement(root);
if(!root.isExpanded())
root.expand();
else {
! Enumeration<?> cursor = root.children();
while(cursor.hasMoreElements()) {
visibleNodes.addElement(cursor.nextElement());
}
if(!isFixedRowHeight())
updateYLocationsFrom(0);
*** 1097,1107 ****
/**
* Returns the children of the receiver.
* If the receiver is not currently expanded, this will return an
* empty enumeration.
*/
! public Enumeration children() {
if (!this.isExpanded()) {
return DefaultMutableTreeNode.EMPTY_ENUMERATION;
} else {
return super.children();
}
--- 1097,1108 ----
/**
* Returns the children of the receiver.
* If the receiver is not currently expanded, this will return an
* empty enumeration.
*/
! @Override
! public Enumeration<TreeNode> children() {
if (!this.isExpanded()) {
return DefaultMutableTreeNode.EMPTY_ENUMERATION;
} else {
return super.children();
}
*** 1403,1413 ****
* 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
* loaded.
*/
! protected Enumeration getLoadedChildren(boolean createIfNeeded) {
if(!createIfNeeded || hasBeenExpanded)
return super.children();
TreeStateNode newNode;
Object realNode = getValue();
--- 1404,1414 ----
* 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
* loaded.
*/
! protected Enumeration<TreeNode> getLoadedChildren(boolean createIfNeeded) {
if(!createIfNeeded || hasBeenExpanded)
return super.children();
TreeStateNode newNode;
Object realNode = getValue();
*** 1497,1507 ****
}
}
}
int i = originalRow;
! Enumeration cursor = preorderEnumeration();
cursor.nextElement(); // don't add me, I'm already in
int newYOrigin;
if(isFixed)
--- 1498,1508 ----
}
}
}
int i = originalRow;
! Enumeration<TreeNode> cursor = preorderEnumeration();
cursor.nextElement(); // don't add me, I'm already in
int newYOrigin;
if(isFixed)
*** 1511,1531 ****
else
newYOrigin = getYOrigin() + this.getPreferredHeight();
TreeStateNode aNode;
if(!isFixed) {
while (cursor.hasMoreElements()) {
! aNode = (TreeStateNode)cursor.nextElement();
if(!updateNodeSizes && !aNode.hasValidSize())
aNode.updatePreferredSize(i + 1);
aNode.setYOrigin(newYOrigin);
newYOrigin += aNode.getPreferredHeight();
visibleNodes.insertElementAt(aNode, ++i);
}
}
else {
while (cursor.hasMoreElements()) {
! aNode = (TreeStateNode)cursor.nextElement();
visibleNodes.insertElementAt(aNode, ++i);
}
}
if(adjustTree && (originalRow != i ||
--- 1512,1532 ----
else
newYOrigin = getYOrigin() + this.getPreferredHeight();
TreeStateNode aNode;
if(!isFixed) {
while (cursor.hasMoreElements()) {
! aNode = (TreeStateNode) cursor.nextElement();
if(!updateNodeSizes && !aNode.hasValidSize())
aNode.updatePreferredSize(i + 1);
aNode.setYOrigin(newYOrigin);
newYOrigin += aNode.getPreferredHeight();
visibleNodes.insertElementAt(aNode, ++i);
}
}
else {
while (cursor.hasMoreElements()) {
! aNode = (TreeStateNode) cursor.nextElement();
visibleNodes.insertElementAt(aNode, ++i);
}
}
if(adjustTree && (originalRow != i ||
*** 1557,1567 ****
* Collapses this node in the tree. If <I>adjustTree</I> is
* true the tree and selection are updated accordingly.
*/
protected void collapse(boolean adjustTree) {
if (isExpanded()) {
! Enumeration cursor = preorderEnumeration();
cursor.nextElement(); // don't remove me, I'm still visible
int rowsDeleted = 0;
boolean isFixed = isFixedRowHeight();
int lastYEnd;
if(isFixed)
--- 1558,1568 ----
* Collapses this node in the tree. If <I>adjustTree</I> is
* true the tree and selection are updated accordingly.
*/
protected void collapse(boolean adjustTree) {
if (isExpanded()) {
! Enumeration<TreeNode> cursor = preorderEnumeration();
cursor.nextElement(); // don't remove me, I'm still visible
int rowsDeleted = 0;
boolean isFixed = isFixedRowHeight();
int lastYEnd;
if(isFixed)