summaryrefslogtreecommitdiff
path: root/javax/swing/tree/AbstractLayoutCache.java
diff options
context:
space:
mode:
Diffstat (limited to 'javax/swing/tree/AbstractLayoutCache.java')
-rw-r--r--javax/swing/tree/AbstractLayoutCache.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/javax/swing/tree/AbstractLayoutCache.java b/javax/swing/tree/AbstractLayoutCache.java
index 772c0c96c..4a6899fbe 100644
--- a/javax/swing/tree/AbstractLayoutCache.java
+++ b/javax/swing/tree/AbstractLayoutCache.java
@@ -149,9 +149,11 @@ public abstract class AbstractLayoutCache
protected Rectangle getNodeDimensions(Object value, int row, int depth,
boolean expanded, Rectangle bounds)
{
- if (nodeDimensions == null)
- throw new InternalError("The NodeDimensions are not set");
- return nodeDimensions.getNodeDimensions(value, row, depth, expanded, bounds);
+ Rectangle d = null;
+ if (nodeDimensions != null)
+ d = nodeDimensions.getNodeDimensions(value, row, depth, expanded,
+ bounds);
+ return d;
}
/**
@@ -224,7 +226,12 @@ public abstract class AbstractLayoutCache
*/
public void setSelectionModel(TreeSelectionModel model)
{
+ if (treeSelectionModel != null)
+ treeSelectionModel.setRowMapper(null);
treeSelectionModel = model;
+ if (treeSelectionModel != null)
+ treeSelectionModel.setRowMapper(this);
+
}
/**
@@ -425,9 +432,13 @@ public abstract class AbstractLayoutCache
*/
public int[] getRowsForPaths(TreePath[] paths)
{
- int[] rows = new int[paths.length];
- for (int i = 0; i < rows.length; i++)
- rows[i] = getRowForPath(paths[i]);
+ int[] rows = null;
+ if (paths != null)
+ {
+ rows = new int[paths.length];
+ for (int i = 0; i < rows.length; i++)
+ rows[i] = getRowForPath(paths[i]);
+ }
return rows;
}
@@ -440,6 +451,6 @@ public abstract class AbstractLayoutCache
*/
protected boolean isFixedRowHeight()
{
- return false;
+ return rowHeight > 0;
}
}