public class

ExpandedState

extends Object
implements Serializable
java.lang.Object
   ↳ org.apache.myfaces.tobago.model.ExpandedState

Class Overview

Manages the expanded state of an tree.

Summary

Public Constructors
ExpandedState(int defaultExpandedLevels)
Creates a new state object to store which nodes of a tree are expanded and collapsed in a view.
Public Methods
void collapse(int level)
Collapses all nodes that level are higher or equals the parameter level.
void collapse(TreeNode node)
Collapses a single node.
void collapse(TreePath path)
Collapses a single node.
void collapseAll()
Collapses a nodes of the tree.
void collapseAllButRoot()
Collapses a nodes of the tree.
void expand(int level)
Expands all nodes that level are lower or equals the parameter level.
void expand(TreeNode node)
Expands a single node.
void expand(TreePath path)
Expands a single node.
void expandAll()
Expands a nodes of the tree.
Set<TreePath> getCollapsedSet()
Set<TreePath> getExpandedSet()
boolean isExpanded(TreeNode node)
Checks if a node is expanded.
boolean isExpanded(TreePath path)
Checks if a node is expanded.
void reset()
Resets the state to the defaults.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ExpandedState (int defaultExpandedLevels)

Creates a new state object to store which nodes of a tree are expanded and collapsed in a view.

Parameters
defaultExpandedLevels All nodes up to this level are expanded by default.

Public Methods

public void collapse (int level)

Collapses all nodes that level are higher or equals the parameter level.

Parameters
level The level to expand.

public void collapse (TreeNode node)

Collapses a single node.

Parameters
node The node to collapse.

public void collapse (TreePath path)

Collapses a single node.

Parameters
path The path of the node to collapse.

public void collapseAll ()

Collapses a nodes of the tree.

public void collapseAllButRoot ()

Collapses a nodes of the tree. The root node will be expanded.

public void expand (int level)

Expands all nodes that level are lower or equals the parameter level.

Parameters
level The level to expand.

public void expand (TreeNode node)

Expands a single node.

Parameters
node The node to expand.

public void expand (TreePath path)

Expands a single node.

Parameters
path The path of the node to expand.

public void expandAll ()

Expands a nodes of the tree.

public Set<TreePath> getCollapsedSet ()

Returns
  • A unmodifiable set of paths of the collapsed nodes.

public Set<TreePath> getExpandedSet ()

Returns
  • A unmodifiable set of paths of the expanded nodes.

public boolean isExpanded (TreeNode node)

Checks if a node is expanded.

Parameters
node The node to check.
Returns
  • Is the node expanded?

public boolean isExpanded (TreePath path)

Checks if a node is expanded.

Parameters
path The path of the node to check.
Returns
  • Is the node behind this path is expanded?

public void reset ()

Resets the state to the defaults. After this call, the nodes with level smaller than defaultExpandedLevels are expanded, the other ones are collapsed.