Packageorg.aswing.tree
Classpublic class AbstractLayoutCache
ImplementsRowMapper
SubclassesFixedHeightLayoutCache



Protected Properties
 PropertyDefined by
  nodeDimensions : NodeDimensions
Object responsible for getting the size of a node.
AbstractLayoutCache
  rootVisible : Boolean
True if the root node is displayed, false if its children are the highest visible nodes.
AbstractLayoutCache
  treeModel : TreeModel
Model providing information.
AbstractLayoutCache
  treeSelectionModel : TreeSelectionModel
Selection model.
AbstractLayoutCache
Public Methods
 MethodDefined by
  
Returns a rectangle giving the bounds needed to draw path.
AbstractLayoutCache
  
getExpandedState(path:TreePath):Boolean
Returns true if the path is expanded, and visible.
AbstractLayoutCache
  
Returns the TreeModel that is providing the data.
AbstractLayoutCache
  
Returns the object that renders nodes in the tree, and which is responsible for calculating the dimensions of individual nodes.
AbstractLayoutCache
  
getPathClosestTo(x:int, y:int):TreePath
Returns the path to the node that is closest to x,y.
AbstractLayoutCache
  
Returns the path for passed in row.
AbstractLayoutCache
  
Returns the preferred height.
AbstractLayoutCache
  
Returns the preferred width for the passed in region.
AbstractLayoutCache
  
getRowContainingYLocation(location:int):int
Returns the index of the row containing location.
AbstractLayoutCache
  
Number of rows being displayed.
AbstractLayoutCache
  
Returns the row that the last item identified in path is visible at.
AbstractLayoutCache
  
Returns the height of each row.
AbstractLayoutCache
  
getRowsForPaths(paths:Array):Array
Returns the rows that the TreePath instances in path are being displayed at.
AbstractLayoutCache
  
Returns the model used to maintain the selection.
AbstractLayoutCache
  
Returns the number of visible children for row.
AbstractLayoutCache
  
getVisiblePathsFrom(path:TreePath, totalCount:int):Array
Returns an Enumerator that increments over the visible paths starting at the passed in location.
AbstractLayoutCache
  
Instructs the LayoutCache that the bounds for path are invalid, and need to be updated.
AbstractLayoutCache
  
Informs the TreeState that it needs to recalculate all the sizes it is referencing.
AbstractLayoutCache
  
isExpanded(path:TreePath):Boolean
Returns true if the value identified by row is currently expanded.
AbstractLayoutCache
  
isRootVisible():Boolean
Returns true if the root node of the tree is displayed.
AbstractLayoutCache
  
setExpandedState(path:TreePath, isExpanded:Boolean):void
Marks the path path expanded state to isExpanded.
AbstractLayoutCache
  
setModel(newModel:TreeModel):void
Sets the TreeModel that will provide the data.
AbstractLayoutCache
  
Sets the renderer that is responsible for drawing nodes in the tree and which is threfore responsible for calculating the dimensions of individual nodes.
AbstractLayoutCache
  
setRootVisible(rootVisible:Boolean):void
Determines whether or not the root node from the TreeModel is visible.
AbstractLayoutCache
  
setRowHeight(rowHeight:int):void
Sets the height of each cell.
AbstractLayoutCache
  
Sets the TreeSelectionModel used to manage the selection to new LSM.
AbstractLayoutCache
  

Invoked after a node (or a set of siblings) has changed in some way.

AbstractLayoutCache
  

Invoked after nodes have been inserted into the tree.

e.path() returns the parent of the new nodes

e.childIndices() returns the indices of the new nodes in ascending order.

AbstractLayoutCache
  

Invoked after nodes have been removed from the tree.

AbstractLayoutCache
  

Invoked after the tree has drastically changed structure from a given node down.

AbstractLayoutCache
Protected Methods
 MethodDefined by
  
countNodeDimensions(value:Object, row:int, depth:int, expanded:Boolean, placeIn:IntRectangle):IntRectangle
Returns, by reference in placeIn, the size needed to represent value.
AbstractLayoutCache
Property detail
nodeDimensionsproperty
protected var nodeDimensions:NodeDimensions

Object responsible for getting the size of a node.

rootVisibleproperty 
protected var rootVisible:Boolean

True if the root node is displayed, false if its children are the highest visible nodes.

treeModelproperty 
protected var treeModel:TreeModel

Model providing information.

treeSelectionModelproperty 
protected var treeSelectionModel:TreeSelectionModel

Selection model.

Method detail
countNodeDimensions()method
protected function countNodeDimensions(value:Object, row:int, depth:int, expanded:Boolean, placeIn:IntRectangle):IntRectangle

Returns, by reference in placeIn, the size needed to represent value. If inPlace is null, a newly created IntRectangle should be returned, otherwise the value should be placed in inPlace and returned. This will return null if there is no renderer.

Parameters
value:Object — the value to be represented
 
row:int — row being queried
 
depth:int — the depth of the row
 
expanded:Boolean — true if row is expanded, false otherwise
 
placeIn:IntRectangle — a IntRectangle containing the size needed to represent value

Returns
IntRectangle — a IntRectangle containing the node dimensions, or null if node has no dimension
getBounds()method 
public function getBounds(path:TreePath, placeIn:IntRectangle):IntRectangle

Returns a rectangle giving the bounds needed to draw path.

Parameters
path:TreePath — a TreePath specifying a node
 
placeIn:IntRectangle — a IntRectangle object giving the available space

Returns
IntRectangle — a IntRectangle object specifying the space to be used
getExpandedState()method 
public function getExpandedState(path:TreePath):Boolean

Returns true if the path is expanded, and visible.

Parameters
path:TreePath — the path being queried

Returns
Boolean — true if the path is expanded and visible, false otherwise
getModel()method 
public function getModel():TreeModel

Returns the TreeModel that is providing the data.

Returns
TreeModel — the TreeModel that is providing the data
getNodeDimensions()method 
public function getNodeDimensions():NodeDimensions

Returns the object that renders nodes in the tree, and which is responsible for calculating the dimensions of individual nodes.

Returns
NodeDimensions — the NodeDimensions object
getPathClosestTo()method 
public function getPathClosestTo(x:int, y:int):TreePath

Returns the path to the node that is closest to x,y. If there is nothing currently visible this will return null, otherwise it'll always return a valid path. If you need to test if the returned object is exactly at x, y you should get the bounds for the returned path and test x, y against that.

Parameters
x:int — the horizontal component of the desired location
 
y:int — the vertical component of the desired location

Returns
TreePath — the TreePath closest to the specified point
getPathForRow()method 
public function getPathForRow(row:int):TreePath

Returns the path for passed in row. If row is not visible null is returned.

Parameters
row:int — the row being queried

Returns
TreePath — the TreePath for the given row
getPreferredHeight()method 
public function getPreferredHeight():int

Returns the preferred height.

Returns
int — the preferred height
getPreferredWidth()method 
public function getPreferredWidth(bounds:IntRectangle):int

Returns the preferred width for the passed in region. The region is defined by the path closest to (bounds.x, bounds.y) and ends at bounds.height + bounds.y. If bounds is null, the preferred width for all the nodes will be returned (and this may be a VERY expensive computation).

Parameters
bounds:IntRectangle — the region being queried

Returns
int — the preferred width for the passed in region
getRowContainingYLocation()method 
public function getRowContainingYLocation(location:int):int

Returns the index of the row containing location. If there are no rows, -1 is returned. If location is beyond the last row index, the last row index is returned.

Parameters
location:int

Returns
int
getRowCount()method 
public function getRowCount():int

Number of rows being displayed.

Returns
int — the number of rows being displayed
getRowForPath()method 
public function getRowForPath(path:TreePath):int

Returns the row that the last item identified in path is visible at. Will return -1 if any of the elements in path are not currently visible.

Parameters
path:TreePath — the TreePath being queried

Returns
int — the row where the last item in path is visible or -1 if any elements in path aren't currently visible
getRowHeight()method 
public function getRowHeight():int

Returns the height of each row. If the returned value is less than or equal to 0 the height for each row is determined by the renderer.

Returns
int
getRowsForPaths()method 
public function getRowsForPaths(paths:Array):Array

Returns the rows that the TreePath instances in path are being displayed at. This method should return an array of the same length as that passed in, and if one of the TreePaths in path is not valid its entry in the array should be set to -1.

Parameters
paths:Array — the array of TreePaths being queried

Returns
Array — an array of the same length that is passed in containing the rows that each corresponding where each TreePath is displayed; if paths is null, null is returned
getSelectionModel()method 
public function getSelectionModel():TreeSelectionModel

Returns the model used to maintain the selection.

Returns
TreeSelectionModel — the treeSelectionModel
getVisibleChildCount()method 
public function getVisibleChildCount(path:TreePath):int

Returns the number of visible children for row.

Parameters
path:TreePath — the path being queried

Returns
int — the number of visible children for the specified path
getVisiblePathsFrom()method 
public function getVisiblePathsFrom(path:TreePath, totalCount:int):Array

Returns an Enumerator that increments over the visible paths starting at the passed in location. The ordering of the enumeration is based on how the paths are displayed. The first element of the returned enumeration will be path, unless it isn't visible, in which case null will be returned.

Parameters
path:TreePath — the starting location for the enumeration
 
totalCount:int — the total number of path to contains.

Returns
Array — the Enumerator starting at the desired location
invalidatePathBounds()method 
public function invalidatePathBounds(path:TreePath):void

Instructs the LayoutCache that the bounds for path are invalid, and need to be updated.

Parameters
path:TreePath — the path being updated
invalidateSizes()method 
public function invalidateSizes():void

Informs the TreeState that it needs to recalculate all the sizes it is referencing.

isExpanded()method 
public function isExpanded(path:TreePath):Boolean

Returns true if the value identified by row is currently expanded.

Parameters
path:TreePath

Returns
Boolean
isRootVisible()method 
public function isRootVisible():Boolean

Returns true if the root node of the tree is displayed.

Returns
Boolean — true if the root node of the tree is displayed
setExpandedState()method 
public function setExpandedState(path:TreePath, isExpanded:Boolean):void

Marks the path path expanded state to isExpanded.

Parameters
path:TreePath — the path being expanded or collapsed
 
isExpanded:Boolean — true if the path should be expanded, false otherwise
setModel()method 
public function setModel(newModel:TreeModel):void

Sets the TreeModel that will provide the data.

Parameters
newModel:TreeModel — the TreeModel that is to provide the data
setNodeDimensions()method 
public function setNodeDimensions(nd:NodeDimensions):void

Sets the renderer that is responsible for drawing nodes in the tree and which is threfore responsible for calculating the dimensions of individual nodes.

Parameters
nd:NodeDimensions — a NodeDimensions object
setRootVisible()method 
public function setRootVisible(rootVisible:Boolean):void

Determines whether or not the root node from the TreeModel is visible.

Parameters
rootVisible:Boolean — true if the root node of the tree is to be displayed
setRowHeight()method 
public function setRowHeight(rowHeight:int):void

Sets the height of each cell. If the specified value is less than or equal to zero the current cell renderer is queried for each row's height.

Parameters
rowHeight:int — the height of each cell, in pixels
setSelectionModel()method 
public function setSelectionModel(newLSM:TreeSelectionModel):void

Sets the TreeSelectionModel used to manage the selection to new LSM.

Parameters
newLSM:TreeSelectionModel — the new TreeSelectionModel
treeNodesChanged()method 
public function treeNodesChanged(e:TreeModelEvent):void

Invoked after a node (or a set of siblings) has changed in some way. The node(s) have not changed locations in the tree or altered their children arrays, but other attributes have changed and may affect presentation. Example: the name of a file has changed, but it is in the same location in the file system.

e.path() returns the path the parent of the changed node(s).

e.childIndices() returns the index(es) of the changed node(s).

Parameters
e:TreeModelEvent — the TreeModelEvent
treeNodesInserted()method 
public function treeNodesInserted(e:TreeModelEvent):void

Invoked after nodes have been inserted into the tree.

e.path() returns the parent of the new nodes

e.childIndices() returns the indices of the new nodes in ascending order.

Parameters
e:TreeModelEvent — the TreeModelEvent
treeNodesRemoved()method 
public function treeNodesRemoved(e:TreeModelEvent):void

Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree, this method may only be invoked once for the root of the removed subtree, not once for each individual set of siblings removed.

e.path() returns the former parent of the deleted nodes.

e.childIndices() returns the indices the nodes had before they were deleted in ascending order.

Parameters
e:TreeModelEvent — the TreeModelEvent
treeStructureChanged()method 
public function treeStructureChanged(e:TreeModelEvent):void

Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.

e.path() holds the path to the node.

e.childIndices() returns null.

Parameters
e:TreeModelEvent — the TreeModelEvent