Package org.apache.myfaces.tobago.model
Class ExpandedState
- java.lang.Object
-
- org.apache.myfaces.tobago.model.ExpandedState
-
- All Implemented Interfaces:
Serializable
public class ExpandedState extends Object implements Serializable
Manages the expanded state of an tree.- Since:
- 2.0.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ExpandedState(int defaultExpandedLevels)Creates a new state object to store which nodes of a tree are expanded and collapsed in a view.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollapse(int level)Collapses all nodes that level are higher or equals the parameter level.voidcollapse(TreeNode node)Collapses a single node.voidcollapse(TreePath path)Collapses a single node.voidcollapseAll()Collapses a nodes of the tree.voidcollapseAllButRoot()Collapses a nodes of the tree.voidexpand(int level)Expands all nodes that level are lower or equals the parameter level.voidexpand(TreeNode node)Expands a single node.voidexpand(TreeNode node, boolean parents)Expands a single node.voidexpand(TreePath path)Expands a single node.voidexpand(TreePath path, boolean parents)Expands a single node.voidexpandAll()Expands a nodes of the tree.Set<TreePath>getCollapsedSet()Set<TreePath>getExpandedSet()booleanisExpanded(TreeNode node)Checks if a node is expanded.booleanisExpanded(TreePath path)Checks if a node is expanded.voidreset()Resets the state to the defaults.
-
-
-
Method Detail
-
isExpanded
public boolean isExpanded(TreeNode node)
Checks if a node is expanded.- Parameters:
node- The node to check.- Returns:
- Is the node expanded?
-
isExpanded
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?
-
expand
public void expand(TreeNode node)
Expands a single node.- Parameters:
node- The node to expand. Also the parents will be expanded since Tobago 3.0.0.
-
expand
public void expand(TreeNode node, boolean parents)
Expands a single node.- Parameters:
node- The node to expand.parents- Should the parents also be expanded?
-
expand
public void expand(TreePath path)
Expands a single node.- Parameters:
path- The path of the node to expand. Also the parents will be expanded since Tobago 3.0.0.
-
expand
public void expand(TreePath path, boolean parents)
Expands a single node.- Parameters:
path- The path of the node to expand.parents- Should the parents also be expanded?
-
expand
public void expand(int level)
Expands all nodes that level are lower or equals the parameter level.- Parameters:
level- The level to expand.
-
expandAll
public void expandAll()
Expands a nodes of the tree.
-
collapse
public void collapse(TreeNode node)
Collapses a single node.- Parameters:
node- The node to collapse.
-
collapse
public void collapse(TreePath path)
Collapses a single node.- Parameters:
path- The path of the node to collapse.
-
collapse
public void collapse(int level)
Collapses all nodes that level are higher or equals the parameter level.- Parameters:
level- The level to expand.
-
collapseAll
public void collapseAll()
Collapses a nodes of the tree.
-
collapseAllButRoot
public void collapseAllButRoot()
Collapses a nodes of the tree. The root node will be expanded.
-
reset
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.
-
getExpandedSet
public Set<TreePath> getExpandedSet()
- Returns:
- A unmodifiable set of paths of the expanded nodes.
-
-