Fixes bug #24218
2005-10-18 Lillian Angel <[EMAIL PROTECTED]>
* javax/swing/JTree.java
(scrollPathToVisible): Reimplemented to make the path visible
if its parent is not expanded.
* javax/swing/plaf/basic/BasicTreeUI.java
(installDefaults): Initialized row height for the tree.
(updateCurrentVisiblePath): Updated the visible row count.
* javax/swing/plaf/metal/MetalTreeUI.java
(installUI): Initialized row height for the tree.
Index: javax/swing/JTree.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JTree.java,v
retrieving revision 1.47
diff -u -r1.47 JTree.java
--- javax/swing/JTree.java 14 Oct 2005 17:30:31 -0000 1.47
+++ javax/swing/JTree.java 18 Oct 2005 14:58:46 -0000
@@ -2046,13 +2046,26 @@
{
if (path == null)
return;
-
+
+ Object[] oPath = path.getPath();
+ TreePath temp = new TreePath(oPath[0]);
+ boolean stop = false;
+ int i = 1;
+ while (!stop)
+ {
+ while (isVisible(temp))
+ if (i < oPath.length)
+ temp = temp.pathByAddingChild(oPath[i++]);
+ else
+ {
+ stop = true;
+ break;
+ }
+ makeVisible(temp);
+ }
Rectangle rect = getPathBounds(path);
-
- if (rect == null)
- return;
-
scrollRectToVisible(rect);
+ setSelectionPath(temp);
}
public void scrollRowToVisible(int row)
Index: javax/swing/plaf/basic/BasicTreeUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTreeUI.java,v
retrieving revision 1.100
diff -u -r1.100 BasicTreeUI.java
--- javax/swing/plaf/basic/BasicTreeUI.java 17 Oct 2005 18:47:17 -0000 1.100
+++ javax/swing/plaf/basic/BasicTreeUI.java 18 Oct 2005 14:58:46 -0000
@@ -1230,6 +1230,7 @@
rightChildIndent = UIManager.getInt("Tree.rightChildIndent");
leftChildIndent = UIManager.getInt("Tree.leftChildIndent");
setRowHeight(UIManager.getInt("Tree.rowHeight"));
+ tree.setRowHeight(UIManager.getInt("Tree.rowHeight"));
tree.requestFocusInWindow(false);
tree.setScrollsOnExpand(UIManager.getBoolean("Tree.scrollsOnExpand"));
setExpandedIcon(UIManager.getIcon("Tree.openIcon"));
@@ -3778,6 +3779,7 @@
!tree.isVisible(new TreePath(getPathToRoot(next, 0))));
}
currentVisiblePath = current;
+ tree.setVisibleRowCount(getRowCount(tree));
}
/**
Index: javax/swing/plaf/metal/MetalTreeUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalTreeUI.java,v
retrieving revision 1.10
diff -u -r1.10 MetalTreeUI.java
--- javax/swing/plaf/metal/MetalTreeUI.java 17 Oct 2005 18:47:17 -0000 1.10
+++ javax/swing/plaf/metal/MetalTreeUI.java 18 Oct 2005 14:58:46 -0000
@@ -140,6 +140,7 @@
rightChildIndent = defaults.getInt("Tree.rightChildIndent");
leftChildIndent = defaults.getInt("Tree.leftChildIndent");
setRowHeight(defaults.getInt("Tree.rowHeight"));
+ tree.setRowHeight(defaults.getInt("Tree.rowHeight"));
tree.requestFocusInWindow(false);
setExpandedIcon(defaults.getIcon("Tree.openIcon"));
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches