|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.tree.AbstractLayoutCache
javax.swing.tree.VariableHeightLayoutCache
javax.swing.tree.FixedHeightLayoutCache
public class FixedHeightLayoutCache
The fixed height tree layout. This class assumes that all cells in the tree have the same fixed height. This may be not the case, for instance, if leaves and branches have different height, of if the tree rows may have arbitrary variable height. This class will also work if the NodeDimensions are not set.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.tree.AbstractLayoutCache |
|---|
AbstractLayoutCache.NodeDimensions |
| Field Summary |
|---|
| Fields inherited from class javax.swing.tree.AbstractLayoutCache |
|---|
nodeDimensions, rootVisible, rowHeight, treeModel, treeSelectionModel |
| Constructor Summary | |
|---|---|
FixedHeightLayoutCache()
Creates the unitialised instance. |
|
| Method Summary | |
|---|---|
Rectangle |
getBounds(TreePath path,
Rectangle rect)
Get bounds for the given tree path. |
boolean |
getExpandedState(TreePath path)
Return the expansion state of the given tree path. |
TreePath |
getPathClosestTo(int x,
int y)
Get the path, closest to the given point. |
TreePath |
getPathForRow(int row)
Get the path, the last element of that is displayed in the given row. |
int |
getPreferredHeight()
Get the sum of heights for all rows. |
int |
getPreferredWidth(Rectangle value)
Get the maximal width. |
int |
getRowCount()
Get the total number of rows in the tree. |
int |
getRowForPath(TreePath path)
Get the row, displaying the last node of the given path. |
int |
getVisibleChildCount(TreePath path)
Get the number of the visible childs for the given tree path. |
Enumeration<TreePath> |
getVisiblePathsFrom(TreePath parentPath)
Get the enumeration over all visible paths that start from the given parent path. |
void |
invalidatePathBounds(TreePath path)
Discard the bound information for the given path. |
void |
invalidateSizes()
Mark all cached information as invalid. |
boolean |
isExpanded(TreePath path)
Get the expanded state for the given tree path. |
protected boolean |
isFixedRowHeight()
Returns true if this layout supposes that all rows have the fixed height. |
void |
setExpandedState(TreePath path,
boolean isExpanded)
Set the expanded state of the given path. |
void |
setModel(TreeModel newModel)
Set the tree model that will provide the data. |
void |
setRootVisible(boolean visible)
Inform the instance if the tree root node is visible. |
void |
treeNodesChanged(TreeModelEvent event)
The listener method, called when the tree nodes are changed. |
void |
treeNodesInserted(TreeModelEvent event)
The listener method, called when the tree nodes are inserted. |
void |
treeNodesRemoved(TreeModelEvent event)
The listener method, called when the tree nodes are removed. |
void |
treeStructureChanged(TreeModelEvent event)
Called when the tree structure has been changed. |
| Methods inherited from class javax.swing.tree.VariableHeightLayoutCache |
|---|
setNodeDimensions, setRowHeight |
| Methods inherited from class javax.swing.tree.AbstractLayoutCache |
|---|
getModel, getNodeDimensions, getNodeDimensions, getRowHeight, getRowsForPaths, getSelectionModel, isRootVisible, setSelectionModel |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FixedHeightLayoutCache()
VariableHeightLayoutCache.setRowHeight(int) and the model must be set
with setModel(TreeModel). The node dimensions may not be set.
| Method Detail |
|---|
public int getRowCount()
getRowCount in class VariableHeightLayoutCachepublic void invalidatePathBounds(TreePath path)
invalidatePathBounds in class VariableHeightLayoutCachepath - the path, for that the bound information must be recomputed.public void invalidateSizes()
invalidateSizes in class VariableHeightLayoutCache
public void setExpandedState(TreePath path,
boolean isExpanded)
setExpandedState in class VariableHeightLayoutCachepath - the tree path, for that the state is being set.isExpanded - the expanded state of the given path.public boolean isExpanded(TreePath path)
isExpanded in class VariableHeightLayoutCachepath - TODO
public Rectangle getBounds(TreePath path,
Rectangle rect)
getBounds in class VariableHeightLayoutCachepath - the tree pathrect - the rectangle that will be reused to return the result.
public TreePath getPathForRow(int row)
getPathForRow in class VariableHeightLayoutCacherow - the row
public int getRowForPath(TreePath path)
getRowForPath in class VariableHeightLayoutCachepath - the path
public TreePath getPathClosestTo(int x,
int y)
getPathClosestTo in class VariableHeightLayoutCachex - the point x coordinatey - the point y coordinate
public int getVisibleChildCount(TreePath path)
getVisibleChildCount in class VariableHeightLayoutCachepath - the tree path
public Enumeration<TreePath> getVisiblePathsFrom(TreePath parentPath)
getVisiblePathsFrom in class VariableHeightLayoutCacheparentPath - the parent path
public boolean getExpandedState(TreePath path)
setExpandedState(TreePath, boolean)
getExpandedState in class VariableHeightLayoutCachepath - the path being checked
public void treeNodesChanged(TreeModelEvent event)
treeNodesChanged in class VariableHeightLayoutCacheevent - the change eventpublic void treeNodesInserted(TreeModelEvent event)
treeNodesInserted in class VariableHeightLayoutCacheevent - the change eventpublic void treeNodesRemoved(TreeModelEvent event)
treeNodesRemoved in class VariableHeightLayoutCacheevent - the change eventpublic void treeStructureChanged(TreeModelEvent event)
treeStructureChanged in class VariableHeightLayoutCacheevent - the change eventpublic void setModel(TreeModel newModel)
setModel in class VariableHeightLayoutCachenewModel - the modelpublic void setRootVisible(boolean visible)
setRootVisible in class VariableHeightLayoutCachevisible - true if the tree root node is visible, false
otherwise.public int getPreferredHeight()
getPreferredHeight in class VariableHeightLayoutCachepublic int getPreferredWidth(Rectangle value)
getPreferredWidth in class VariableHeightLayoutCachevalue - the rectangle that is used during the method workprotected boolean isFixedRowHeight()
isFixedRowHeight in class AbstractLayoutCache
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||