/* AbstractLayoutCache.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
package javax.swing.tree;
-import gnu.classpath.NotImplementedException;
-
import java.awt.Rectangle;
import java.util.Enumeration;
import javax.swing.event.TreeModelEvent;
-import javax.swing.tree.VariableHeightLayoutCache.NodeRecord;
/**
* 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;
}
/**
*/
public void setSelectionModel(TreeSelectionModel model)
{
+ if (treeSelectionModel != null)
+ treeSelectionModel.setRowMapper(null);
treeSelectionModel = model;
+ if (treeSelectionModel != null)
+ treeSelectionModel.setRowMapper(this);
+
}
/**
for (int i = 0; i < n; i++)
{
TreePath path = getPathForRow(i);
- r.setBounds(0,0,0,0);
+ r.setBounds(0, 0, 0, 0);
r = getBounds(path, r);
if (r.x + r.width > maximalWidth)
maximalWidth = r.x + r.width;
*
* @return Enumeration
*/
- public abstract Enumeration getVisiblePathsFrom(TreePath path);
+ public abstract Enumeration<TreePath> getVisiblePathsFrom(TreePath path);
/**
* getVisibleChildCount
*/
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;
}
*/
protected boolean isFixedRowHeight()
{
- return false;
+ return rowHeight > 0;
}
}