org.apache.wicket.markup.html.tree
Class DefaultTreeState

java.lang.Object
  extended by org.apache.wicket.markup.html.tree.DefaultTreeState
All Implemented Interfaces:
java.io.Serializable, IClusterable, ITreeState

public class DefaultTreeState
extends java.lang.Object
implements ITreeState, IClusterable

Default implementation of TreeState.

This implementation tries to be as lightweight as possible. By default all nodes are collapsed.

Author:
Matej Knopp
See Also:
Serialized Form

Constructor Summary
DefaultTreeState()
           
 
Method Summary
 void addTreeStateListener(ITreeStateListener l)
          Adds a tree state listener.
 void collapseAll()
          Collapses all nodes of the tree.
 void collapseNode(javax.swing.tree.TreeNode node)
          Collapses the given node.
 void expandAll()
          Expands all nodes of the tree.
 void expandNode(javax.swing.tree.TreeNode node)
          Expands the given node.
 java.util.Collection getSelectedNodes()
          Returns the collection of all selected nodes.
 boolean isAllowSelectMultiple()
          Returns whether multiple nodes can be selected.
 boolean isNodeExpanded(javax.swing.tree.TreeNode node)
          Returns true if the given node is expanded.
 boolean isNodeSelected(javax.swing.tree.TreeNode node)
          Returns true if the given node is selected, false otherwise.
 void removeTreeStateListener(ITreeStateListener l)
          Removes a tree state listener.
 void selectNode(javax.swing.tree.TreeNode node, boolean selected)
          Marks given node as selected (or unselected) according to the selected value.
 void setAllowSelectMultiple(boolean value)
          Sets whether multiple nodes can be selected.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTreeState

public DefaultTreeState()
Method Detail

addTreeStateListener

public void addTreeStateListener(ITreeStateListener l)
Description copied from interface: ITreeState
Adds a tree state listener. On state change events on the listener are fired.

Specified by:
addTreeStateListener in interface ITreeState
Parameters:
l - Listener to add
See Also:
ITreeState.addTreeStateListener(org.apache.wicket.markup.html.tree.ITreeStateListener)

collapseAll

public void collapseAll()
Description copied from interface: ITreeState
Collapses all nodes of the tree.

Specified by:
collapseAll in interface ITreeState
See Also:
ITreeState.collapseAll()

collapseNode

public void collapseNode(javax.swing.tree.TreeNode node)
Description copied from interface: ITreeState
Collapses the given node.

Specified by:
collapseNode in interface ITreeState
Parameters:
node - Node to collapse
See Also:
ITreeState.collapseNode(javax.swing.tree.TreeNode)

expandAll

public void expandAll()
Description copied from interface: ITreeState
Expands all nodes of the tree.

Specified by:
expandAll in interface ITreeState
See Also:
ITreeState.expandAll()

expandNode

public void expandNode(javax.swing.tree.TreeNode node)
Description copied from interface: ITreeState
Expands the given node.

Specified by:
expandNode in interface ITreeState
Parameters:
node - Node to expand
See Also:
ITreeState.expandNode(javax.swing.tree.TreeNode)

getSelectedNodes

public java.util.Collection getSelectedNodes()
Description copied from interface: ITreeState
Returns the collection of all selected nodes.

Specified by:
getSelectedNodes in interface ITreeState
Returns:
The collection of selected nodes
See Also:
ITreeState.getSelectedNodes()

isAllowSelectMultiple

public boolean isAllowSelectMultiple()
Description copied from interface: ITreeState
Returns whether multiple nodes can be selected.

Specified by:
isAllowSelectMultiple in interface ITreeState
Returns:
True if multiple nodes can be selected
See Also:
ITreeState.isAllowSelectMultiple()

isNodeExpanded

public boolean isNodeExpanded(javax.swing.tree.TreeNode node)
Description copied from interface: ITreeState
Returns true if the given node is expanded.

Specified by:
isNodeExpanded in interface ITreeState
Parameters:
node - The node to inspect
Returns:
True if the node is expanded
See Also:
ITreeState.isNodeExpanded(javax.swing.tree.TreeNode)

isNodeSelected

public boolean isNodeSelected(javax.swing.tree.TreeNode node)
Description copied from interface: ITreeState
Returns true if the given node is selected, false otherwise.

Specified by:
isNodeSelected in interface ITreeState
Parameters:
node - The node to inspect
Returns:
True if the node is selected
See Also:
ITreeState.isNodeSelected(javax.swing.tree.TreeNode)

removeTreeStateListener

public void removeTreeStateListener(ITreeStateListener l)
Description copied from interface: ITreeState
Removes a tree state listener.

Specified by:
removeTreeStateListener in interface ITreeState
Parameters:
l - The listener to remove
See Also:
ITreeState.removeTreeStateListener(org.apache.wicket.markup.html.tree.ITreeStateListener)

selectNode

public void selectNode(javax.swing.tree.TreeNode node,
                       boolean selected)
Description copied from interface: ITreeState
Marks given node as selected (or unselected) according to the selected value.

If tree is in single selection mode and a new node is selected, old node is automatically unselected (and the event is fired on listeners).

Specified by:
selectNode in interface ITreeState
Parameters:
node - The node to select or deselect
selected - If true, the node will be selected, otherwise, the node will be unselected
See Also:
ITreeState.selectNode(javax.swing.tree.TreeNode, boolean)

setAllowSelectMultiple

public void setAllowSelectMultiple(boolean value)
Description copied from interface: ITreeState
Sets whether multiple nodes can be selected.

Specified by:
setAllowSelectMultiple in interface ITreeState
Parameters:
value - If true, multiple nodes can be selected. If false, only one node at a time can be selected
See Also:
ITreeState.setAllowSelectMultiple(boolean)


Copyright © 2004-2009 Apache Software Foundation. All Rights Reserved.