GNU Classpath (0.95) | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.swing.tree.AbstractLayoutCache
javax.swing.tree.VariableHeightLayoutCache
javax.swing.tree.FixedHeightLayoutCache
public class FixedHeightLayoutCache
extends VariableHeightLayoutCache
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 | |
|
Method Summary | |
Rectangle | |
boolean |
|
TreePath |
|
TreePath |
|
int |
|
int |
|
int |
|
int |
|
int |
|
Enumeration |
|
void |
|
void |
|
boolean |
|
protected boolean |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public FixedHeightLayoutCache()
Creates the unitialised instance. Before using the class, the row height must be set with thesetRowHeight(int)
and the model must be set withsetModel(TreeModel)
. The node dimensions may not be set.
public Rectangle getBounds(TreePath path, Rectangle rect)
Get bounds for the given tree path.
- Overrides:
- getBounds in interface VariableHeightLayoutCache
- Parameters:
path
- the tree pathrect
- the rectangle that will be reused to return the result.
- Returns:
- Rectangle the bounds of the last line, defined by the given path.
public boolean getExpandedState(TreePath path)
Return the expansion state of the given tree path. The expansion state must be previously set with thesetExpandedState(TreePath,boolean)
- Overrides:
- getExpandedState in interface VariableHeightLayoutCache
- Parameters:
path
- the path being checked
- Returns:
- true if the last node of the path is expanded, false otherwise.
public TreePath getPathClosestTo(int x, int y)
Get the path, closest to the given point.
- Overrides:
- getPathClosestTo in interface VariableHeightLayoutCache
- Parameters:
x
- the point x coordinatey
- the point y coordinate
- Returns:
- the tree path, closest to the the given point
public TreePath getPathForRow(int row)
Get the path, the last element of that is displayed in the given row.
- Overrides:
- getPathForRow in interface VariableHeightLayoutCache
- Parameters:
row
- the row
- Returns:
- TreePath the path
public int getPreferredHeight()
Get the sum of heights for all rows.
- Overrides:
- getPreferredHeight in interface VariableHeightLayoutCache
public int getPreferredWidth(Rectangle value)
Get the maximal width.
- Overrides:
- getPreferredWidth in interface VariableHeightLayoutCache
public int getRowCount()
Get the total number of rows in the tree. Every displayed node occupies the single row. The root node row is included if the root node is set as visible (false by default).
- Overrides:
- getRowCount in interface VariableHeightLayoutCache
- Returns:
- int the number of the displayed rows.
public int getRowForPath(TreePath path)
Get the row, displaying the last node of the given path.
- Overrides:
- getRowForPath in interface VariableHeightLayoutCache
- Parameters:
path
- the path
- Returns:
- int the row number or -1 if the end of the path is not visible.
public int getVisibleChildCount(TreePath path)
Get the number of the visible childs for the given tree path. If the node is not expanded, 0 is returned. Otherwise, the number of children is obtained from the model as the number of children for the last path component.
- Overrides:
- getVisibleChildCount in interface VariableHeightLayoutCache
- Parameters:
path
- the tree path
- Returns:
- int the number of the visible childs (for row).
public EnumerationgetVisiblePathsFrom(TreePath parentPath)
Get the enumeration over all visible pathes that start from the given parent path.
- Overrides:
- getVisiblePathsFrom in interface VariableHeightLayoutCache
- Parameters:
parentPath
- the parent path
- Returns:
- the enumeration over pathes
public void invalidatePathBounds(TreePath path)
Discard the bound information for the given path.
- Overrides:
- invalidatePathBounds in interface VariableHeightLayoutCache
- Parameters:
path
- the path, for that the bound information must be recomputed.
public void invalidateSizes()
Mark all cached information as invalid.
- Overrides:
- invalidateSizes in interface VariableHeightLayoutCache
public boolean isExpanded(TreePath path)
Get the expanded state for the given tree path.
- Overrides:
- isExpanded in interface VariableHeightLayoutCache
- Returns:
- true if the given path is expanded, false otherwise.
protected boolean isFixedRowHeight()
Returns true if this layout supposes that all rows have the fixed height.
- Overrides:
- isFixedRowHeight in interface AbstractLayoutCache
- Returns:
- boolean true if all rows in the tree must have the fixed height (true by default).
public void setExpandedState(TreePath path, boolean isExpanded)
Set the expanded state of the given path. The expansion states must be always updated when expanding and colapsing the tree nodes. Otherwise other methods will not work correctly after the nodes are collapsed or expanded.
- Overrides:
- setExpandedState in interface VariableHeightLayoutCache
- Parameters:
path
- the tree path, for that the state is being set.isExpanded
- the expanded state of the given path.
public void setModel(TreeModel newModel)
Set the tree model that will provide the data.
- Overrides:
- setModel in interface VariableHeightLayoutCache
public void setRootVisible(boolean visible)
Inform the instance if the tree root node is visible. If this method is not called, it is assumed that the tree root node is not visible.
- Overrides:
- setRootVisible in interface VariableHeightLayoutCache
- Parameters:
visible
- true if the tree root node is visible, false otherwise.
public void treeNodesChanged(TreeModelEvent event)
The listener method, called when the tree nodes are changed.
- Overrides:
- treeNodesChanged in interface VariableHeightLayoutCache
- Parameters:
event
- the change event
public void treeNodesInserted(TreeModelEvent event)
The listener method, called when the tree nodes are inserted.
- Overrides:
- treeNodesInserted in interface VariableHeightLayoutCache
- Parameters:
event
- the change event
public void treeNodesRemoved(TreeModelEvent event)
The listener method, called when the tree nodes are removed.
- Overrides:
- treeNodesRemoved in interface VariableHeightLayoutCache
- Parameters:
event
- the change event
public void treeStructureChanged(TreeModelEvent event)
Called when the tree structure has been changed.
- Overrides:
- treeStructureChanged in interface VariableHeightLayoutCache
- Parameters:
event
- the change event
GNU Classpath (0.95) |