net.sf.click.extras.tree
Interface Tree.JavascriptHandler

All Superinterfaces:
TreeListener
All Known Implementing Classes:
Tree.CookieHandler, Tree.SessionHandler
Enclosing interface:
Tree

protected static interface Tree.JavascriptHandler
extends TreeListener

Please note this class is not meant for public use.

Provides the contract for pluggable javascript handlers.

One of the main tasks the handler must perform is keeping track of which nodes changed state after the user interacted with the tree in the browser. This is also the reason why the handler extends TreeListener to be informed of any changes to node state via other means.


Method Summary
 void destroy()
          Called to indicate the user request cycle is complete.
 Tree.JavascriptRenderer getJavascriptRenderer()
          Returns the javascript renderer associated with this handler.
 void init(Context context)
          Initialize the handler state.
 boolean renderAsExpanded(TreeNode treeNode)
          Queries the handler if the specified node should be rendered as a expanded node.
 
Methods inherited from interface net.sf.click.extras.tree.TreeListener
nodeCollapsed, nodeDeselected, nodeExpanded, nodeSelected
 

Method Detail

init

public void init(Context context)
Initialize the handler state.

Parameters:
context - provides information for initializing the handler.

renderAsExpanded

public boolean renderAsExpanded(TreeNode treeNode)
Queries the handler if the specified node should be rendered as a expanded node.

The reason for this is that the handler might be keeping track of state that the node is not aware of. For example certain state could be stored in the session or cookies.

Parameters:
treeNode - the specified node to query for
Returns:
true if the node should be rendered as if it was expanded, false otherwise

destroy

public void destroy()
Called to indicate the user request cycle is complete. Any last minute tasks can be performed here.


getJavascriptRenderer

public Tree.JavascriptRenderer getJavascriptRenderer()
Returns the javascript renderer associated with this handler.

Returns:
renderer associated with this handler