com.alee.laf.tree
Class TreeState

java.lang.Object
  extended by com.alee.laf.tree.TreeState
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

@XStreamConverter(value=TreeStateConverter.class)
public class TreeState
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This object might contain tree selection and expand states for all loaded tree nodes. Usually this object is constructed through TreeUtils automatically and could be applied to some tree using these utilities aswell.

Author:
Mikle Garin
See Also:
TreeUtils, Serialized Form

Field Summary
protected  java.util.Map<java.lang.String,NodeState> states
          Tree node states.
 
Constructor Summary
TreeState()
          Constructs new object instance with empty states.
TreeState(java.util.Map<java.lang.String,NodeState> states)
          Constructs new object instance with specified states.
 
Method Summary
 void addState(java.lang.String nodeId, boolean expanded, boolean selected)
          Adds node state.
 TreeState clone()
          Returns cloned states object.
 java.util.Map<java.lang.String,NodeState> getStates()
          Returns all node states.
 boolean isExpanded(java.lang.String nodeId)
          Returns whether node with the specified ID is expanded or not.
 boolean isSelected(java.lang.String nodeId)
          Returns whether node with the specified ID is selected or not.
 void setStates(java.util.Map<java.lang.String,NodeState> states)
          Sets all node states.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

states

protected java.util.Map<java.lang.String,NodeState> states
Tree node states.

Constructor Detail

TreeState

public TreeState()
Constructs new object instance with empty states.


TreeState

public TreeState(java.util.Map<java.lang.String,NodeState> states)
Constructs new object instance with specified states.

Parameters:
states - node states
Method Detail

getStates

public java.util.Map<java.lang.String,NodeState> getStates()
Returns all node states.

Returns:
all node states

setStates

public void setStates(java.util.Map<java.lang.String,NodeState> states)
Sets all node states.

Parameters:
states - all node states

addState

public void addState(java.lang.String nodeId,
                     boolean expanded,
                     boolean selected)
Adds node state.

Parameters:
nodeId - node ID
expanded - expansion state
selected - selection state

isExpanded

public boolean isExpanded(java.lang.String nodeId)
Returns whether node with the specified ID is expanded or not.

Parameters:
nodeId - node ID
Returns:
true if node with the specified ID is expanded, false otherwise

isSelected

public boolean isSelected(java.lang.String nodeId)
Returns whether node with the specified ID is selected or not.

Parameters:
nodeId - node ID
Returns:
true if node with the specified ID is expanded, false otherwise

clone

public TreeState clone()
Returns cloned states object.

Overrides:
clone in class java.lang.Object
Returns:
cloned states object