javax.swing.tree

Class AbstractLayoutCache

public abstract class AbstractLayoutCache extends Object implements RowMapper

class AbstractLayoutCache
Nested Class Summary
abstract static classAbstractLayoutCache.NodeDimensions
class NodeDimensions
Field Summary
protected AbstractLayoutCache.NodeDimensionsnodeDimensions
nodeDimensions
protected booleanrootVisible
rootVisible
protected introwHeight
rowHeight
protected TreeModeltreeModel
treeModel
protected TreeSelectionModeltreeSelectionModel
treeSelectionModel
Constructor Summary
AbstractLayoutCache()
Constructor AbstractLayoutCache
Method Summary
abstract RectanglegetBounds(TreePath value0, Rectangle value1)
getBounds
abstract booleangetExpandedState(TreePath path)
getExpandedState
TreeModelgetModel()
Returns the model that provides the tree data.
AbstractLayoutCache.NodeDimensionsgetNodeDimensions()
getNodeDimensions
protected RectanglegetNodeDimensions(Object value, int row, int depth, boolean expanded, Rectangle bounds)
Get the node dimensions.
abstract TreePathgetPathClosestTo(int value0, int value1)
getPathClosestTo
abstract TreePathgetPathForRow(int row)
getPathForRow
intgetPreferredHeight()
Get the sum of heights for all rows.
intgetPreferredWidth(Rectangle rect)
Get the maximal width.
abstract intgetRowCount()
getRowCount
abstract intgetRowForPath(TreePath path)
getRowForPath
intgetRowHeight()
getRowHeight
int[]getRowsForPaths(TreePath[] paths)
Get the tree row numbers for the given pathes.
TreeSelectionModelgetSelectionModel()
getSelectionModel
abstract intgetVisibleChildCount(TreePath path)
getVisibleChildCount
abstract Enumeration<TreePath>getVisiblePathsFrom(TreePath path)
getVisiblePathsFrom
abstract voidinvalidatePathBounds(TreePath path)
invalidatePathBounds
abstract voidinvalidateSizes()
invalidateSizes
abstract booleanisExpanded(TreePath value0)
isExpanded
protected booleanisFixedRowHeight()
Returns true if this layout supposes that all rows have the fixed height.
booleanisRootVisible()
isRootVisible
abstract voidsetExpandedState(TreePath value0, boolean value1)
setExpandedState
voidsetModel(TreeModel model)
Sets the model that provides the tree data.
voidsetNodeDimensions(AbstractLayoutCache.NodeDimensions dimensions)
setNodeDimensions
voidsetRootVisible(boolean visible)
setRootVisible
voidsetRowHeight(int height)
setRowHeight
voidsetSelectionModel(TreeSelectionModel model)
setSelectionModel
abstract voidtreeNodesChanged(TreeModelEvent event)
treeNodesChanged
abstract voidtreeNodesInserted(TreeModelEvent event)
treeNodesInserted
abstract voidtreeNodesRemoved(TreeModelEvent event)
treeNodesRemoved
abstract voidtreeStructureChanged(TreeModelEvent event)
treeStructureChanged

Field Detail

nodeDimensions

protected AbstractLayoutCache.NodeDimensions nodeDimensions
nodeDimensions

rootVisible

protected boolean rootVisible
rootVisible

rowHeight

protected int rowHeight
rowHeight

treeModel

protected TreeModel treeModel
treeModel

treeSelectionModel

protected TreeSelectionModel treeSelectionModel
treeSelectionModel

Constructor Detail

AbstractLayoutCache

public AbstractLayoutCache()
Constructor AbstractLayoutCache

Method Detail

getBounds

public abstract Rectangle getBounds(TreePath value0, Rectangle value1)
getBounds

Parameters: value0 TODO value1 TODO

Returns: Rectangle

getExpandedState

public abstract boolean getExpandedState(TreePath path)
getExpandedState

Parameters: path the tree path

Returns: boolean

getModel

public TreeModel getModel()
Returns the model that provides the tree data.

Returns: the model

getNodeDimensions

public AbstractLayoutCache.NodeDimensions getNodeDimensions()
getNodeDimensions

Returns: NodeDimensions

getNodeDimensions

protected Rectangle getNodeDimensions(Object value, int row, int depth, boolean expanded, Rectangle bounds)
Get the node dimensions. The NodeDimensions property must be set (unless the method is overridden, like if {@link FixedHeightLayoutCache}. If the method is not overridden and the property is not set, the InternalError is thrown.

Parameters: value the last node in the path row the node row depth the indentation depth expanded true if this node is expanded, false otherwise bounds the area where the tree is displayed

getPathClosestTo

public abstract TreePath getPathClosestTo(int value0, int value1)
getPathClosestTo

Parameters: value0 TODO value1 TODO

Returns: the tree path

getPathForRow

public abstract TreePath getPathForRow(int row)
getPathForRow

Parameters: row the row

Returns: the tree path

getPreferredHeight

public int getPreferredHeight()
Get the sum of heights for all rows. This class provides a general not optimized implementation that is overridded in derived classes ({@link VariableHeightLayoutCache}, {@link FixedHeightLayoutCache}) for the better performance.

getPreferredWidth

public int getPreferredWidth(Rectangle rect)
Get the maximal width. This class provides a general not optimized implementation that is overridded in derived classes ({@link VariableHeightLayoutCache}, {@link FixedHeightLayoutCache}) for the better performance.

Parameters: rect the rectangle that is used during the method work

getRowCount

public abstract int getRowCount()
getRowCount

Returns: the number of rows

getRowForPath

public abstract int getRowForPath(TreePath path)
getRowForPath

Parameters: path the tree path

Returns: the row

getRowHeight

public int getRowHeight()
getRowHeight

Returns: the row height

getRowsForPaths

public int[] getRowsForPaths(TreePath[] paths)
Get the tree row numbers for the given pathes. This method performs the "bulk" conversion that may be faster than mapping pathes one by one. To have the benefit from the bulk conversion, the method must be overridden in the derived classes. The default method delegates work to the {@link #getRowForPath(TreePath)}.

Parameters: paths the tree paths the array of the tree pathes.

Returns: the array of the matching tree rows.

getSelectionModel

public TreeSelectionModel getSelectionModel()
getSelectionModel

Returns: the model

getVisibleChildCount

public abstract int getVisibleChildCount(TreePath path)
getVisibleChildCount

Parameters: path the tree path

Returns: int

getVisiblePathsFrom

public abstract Enumeration<TreePath> getVisiblePathsFrom(TreePath path)
getVisiblePathsFrom

Parameters: path the tree path

Returns: Enumeration

invalidatePathBounds

public abstract void invalidatePathBounds(TreePath path)
invalidatePathBounds

Parameters: path the tree path

invalidateSizes

public abstract void invalidateSizes()
invalidateSizes

isExpanded

public abstract boolean isExpanded(TreePath value0)
isExpanded

Parameters: value0 TODO

Returns: boolean

isFixedRowHeight

protected boolean isFixedRowHeight()
Returns true if this layout supposes that all rows have the fixed height.

Returns: boolean true if all rows in the tree must have the fixed height (false by default).

isRootVisible

public boolean isRootVisible()
isRootVisible

Returns: true if root is visible, false otherwise

setExpandedState

public abstract void setExpandedState(TreePath value0, boolean value1)
setExpandedState

Parameters: value0 TODO value1 TODO

setModel

public void setModel(TreeModel model)
Sets the model that provides the tree data.

Parameters: model the model

setNodeDimensions

public void setNodeDimensions(AbstractLayoutCache.NodeDimensions dimensions)
setNodeDimensions

Parameters: dimensions TODO

setRootVisible

public void setRootVisible(boolean visible)
setRootVisible

Parameters: visible true if root should be visible, false otherwise

setRowHeight

public void setRowHeight(int height)
setRowHeight

Parameters: height the row height

setSelectionModel

public void setSelectionModel(TreeSelectionModel model)
setSelectionModel

Parameters: model the model

treeNodesChanged

public abstract void treeNodesChanged(TreeModelEvent event)
treeNodesChanged

Parameters: event the event to send

treeNodesInserted

public abstract void treeNodesInserted(TreeModelEvent event)
treeNodesInserted

Parameters: event the event to send

treeNodesRemoved

public abstract void treeNodesRemoved(TreeModelEvent event)
treeNodesRemoved

Parameters: event the event to send

treeStructureChanged

public abstract void treeStructureChanged(TreeModelEvent event)
treeStructureChanged

Parameters: event the event to send