1 /* AbstractLayoutCache.java --
2 Copyright (C) 2002, 2004 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax
.swing
.tree
;
41 import java
.awt
.Rectangle
;
42 import java
.util
.Enumeration
;
44 import javax
.swing
.event
.TreeModelEvent
;
47 * class AbstractLayoutCache
49 * @author Andrew Selkirk
51 public abstract class AbstractLayoutCache
implements RowMapper
54 * class NodeDimensions
56 public abstract static class NodeDimensions
59 * Creates <code>NodeDimensions</code> object.
61 public NodeDimensions()
76 public abstract Rectangle
getNodeDimensions(Object value0
, int value1
,
77 int value2
, boolean value3
,
84 protected NodeDimensions nodeDimensions
;
89 protected TreeModel treeModel
;
94 protected TreeSelectionModel treeSelectionModel
;
99 protected boolean rootVisible
;
104 protected int rowHeight
;
107 * Constructor AbstractLayoutCache
109 public AbstractLayoutCache()
117 * @param dimensions TODO
119 public void setNodeDimensions(NodeDimensions dimensions
)
121 nodeDimensions
= dimensions
;
127 * @return NodeDimensions
129 public NodeDimensions
getNodeDimensions()
131 return nodeDimensions
;
145 protected Rectangle
getNodeDimensions(Object value0
, int value1
, int value2
, boolean value3
, Rectangle value4
)
151 * Sets the model that provides the tree data.
155 public void setModel(TreeModel model
)
161 * Returns the model that provides the tree data.
165 public TreeModel
getModel()
173 * @param visible <code>true</code> if root should be visible,
174 * <code>false</code> otherwise
176 public void setRootVisible(boolean visible
)
178 rootVisible
= visible
;
184 * @return <code>true</code> if root is visible,
185 * <code>false</code> otherwise
187 public boolean isRootVisible()
195 * @param height the row height
197 public void setRowHeight(int height
)
205 * @return the row height
207 public int getRowHeight()
215 * @param model the model
217 public void setSelectionModel(TreeSelectionModel model
)
219 treeSelectionModel
= model
;
227 public TreeSelectionModel
getSelectionModel()
229 return treeSelectionModel
;
237 public int getPreferredHeight()
249 public int getPreferredWidth(Rectangle value0
)
261 public abstract boolean isExpanded(TreePath value0
);
271 public abstract Rectangle
getBounds(TreePath value0
, Rectangle value1
);
278 * @return the tree path
280 public abstract TreePath
getPathForRow(int row
);
285 * @param path the tree path
289 public abstract int getRowForPath(TreePath path
);
297 * @return the tree path
299 public abstract TreePath
getPathClosestTo(int value0
, int value1
);
302 * getVisiblePathsFrom
304 * @param path the tree path
306 * @return Enumeration
308 public abstract Enumeration
getVisiblePathsFrom(TreePath path
);
311 * getVisibleChildCount
313 * @param path the tree path
317 public abstract int getVisibleChildCount(TreePath value0
);
326 public abstract void setExpandedState(TreePath value0
, boolean value1
);
331 * @param path the tree path
335 public abstract boolean getExpandedState(TreePath path
);
340 * @return the number of rows
342 public abstract int getRowCount();
347 public abstract void invalidateSizes();
350 * invalidatePathBounds
352 * @param path the tree path
354 public abstract void invalidatePathBounds(TreePath path
);
359 * @param event the event to send
361 public abstract void treeNodesChanged(TreeModelEvent event
);
366 * @param event the event to send
368 public abstract void treeNodesInserted(TreeModelEvent event
);
373 * @param event the event to send
375 public abstract void treeNodesRemoved(TreeModelEvent event
);
378 * treeStructureChanged
380 * @param event the event to send
382 public abstract void treeStructureChanged(TreeModelEvent event
);
387 * @param paths the tree paths
389 * @return an array of rows
391 public int[] getRowsForPaths(TreePath
[] paths
)
401 protected boolean isFixedRowHeight()
403 return false; // TODO