From: <ls...@us...> - 2007-02-04 16:00:52
|
Revision: 3109 http://jnode.svn.sourceforge.net/jnode/?rev=3109&view=rev Author: lsantha Date: 2007-02-04 08:00:42 -0800 (Sun, 04 Feb 2007) Log Message: ----------- Classpath patches. Modified Paths: -------------- trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicTreeUI.java Modified: trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java 2007-02-04 12:10:47 UTC (rev 3108) +++ trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicTableUI.java 2007-02-04 16:00:42 UTC (rev 3109) @@ -443,11 +443,14 @@ public Dimension getPreferredSize(JComponent comp) { int prefTotalColumnWidth = 0; - for (int i = 0; i < table.getColumnCount(); i++) + TableColumnModel tcm = table.getColumnModel(); + + for (int i = 0; i < tcm.getColumnCount(); i++) { - TableColumn col = table.getColumnModel().getColumn(i); + TableColumn col = tcm.getColumn(i); prefTotalColumnWidth += col.getPreferredWidth(); } + return new Dimension(prefTotalColumnWidth, getHeight()); } Modified: trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicTreeUI.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicTreeUI.java 2007-02-04 12:10:47 UTC (rev 3108) +++ trunk/core/src/classpath/javax/javax/swing/plaf/basic/BasicTreeUI.java 2007-02-04 16:00:42 UTC (rev 3109) @@ -195,7 +195,7 @@ protected AbstractLayoutCache treeState; /** Used for minimizing the drawing of vertical lines. */ - protected Hashtable drawingCache; + protected Hashtable<TreePath, Boolean> drawingCache; /** * True if doing optimizations for a largeModel. Subclasses that don't support @@ -1587,12 +1587,15 @@ for (int i = startIndex; i <= endIndex; i++, k++) { path[k] = treeState.getPathForRow(i); + if (path[k] != null) + { isLeaf[k] = treeModel.isLeaf(path[k].getLastPathComponent()); isExpanded[k] = tree.isExpanded(path[k]); bounds[k] = getPathBounds(tree, path[k]); - paintHorizontalPartOfLeg(g, clip, insets, bounds[k], path[k], i, - isExpanded[k], false, isLeaf[k]); + paintHorizontalPartOfLeg(g, clip, insets, bounds[k], path[k], + i, isExpanded[k], false, isLeaf[k]); + } if (isLastChild(path[k])) paintVerticalPartOfLeg(g, clip, insets, path[k]); } @@ -1600,6 +1603,7 @@ k = 0; for (int i = startIndex; i <= endIndex; i++, k++) { + if (path[k] != null) paintRow(g, clip, insets, bounds[k], path[k], i, isExpanded[k], false, isLeaf[k]); } @@ -1611,7 +1615,9 @@ */ private boolean isLastChild(TreePath path) { - if (path instanceof GnuPath) + if (path == null) + return false; + else if (path instanceof GnuPath) { // Except the seldom case when the layout cache is changed, this // optimized code will be executed. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |