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

All Known Implementing Classes:
Tree.AbstractJavascriptRenderer
Enclosing interface:
Tree

protected static interface Tree.JavascriptRenderer

Please note this class is not meant for public use.

Provides the contract for pluggable javascript renderers for the Tree.


Method Summary
 void init(TreeNode node)
          Called to initialize the renderer.
 void renderExpandAndCollapseAction(HtmlStringBuffer buffer)
          Called when the expand and collapse action is rendered.
 void renderIcon(HtmlStringBuffer buffer)
          Called when the tree icon is rendered.
 void renderTreeNodeStart(HtmlStringBuffer buffer)
          Called before a tree node is rendered.
 

Method Detail

init

public void init(TreeNode node)
Called to initialize the renderer.

Parameters:
node - the current node rendered

renderTreeNodeStart

public void renderTreeNodeStart(HtmlStringBuffer buffer)
Called before a tree node is rendered. Enables the renderer to add attributes needed by javascript functionality for example something like:
      buffer.appendAttribute("id",expandId);
 
The code above adds a id attribute to the element, to enable the javascript code to lookup the html element by its id.

The above attribute is appended to whichever element the tree is currently rendering at the time renderTreeNodeStart is called.

Parameters:
buffer - string buffer containing the markup

renderExpandAndCollapseAction

public void renderExpandAndCollapseAction(HtmlStringBuffer buffer)
Called when the expand and collapse action is rendered. Enables the renderer to add attributes needed by javascript functionality for example something like:
      buffer.append("onclick=\"handleNodeExpansion(this,event)\"");
 
The code above adds a javascript function call to the element.

The code above is appended to whichever element the tree is currently rendering at the time renderTreeNodeStart is called.

Parameters:
buffer - string buffer containing the markup

renderIcon

public void renderIcon(HtmlStringBuffer buffer)
Called when the tree icon is rendered. Enables the renderer to add attributes needed by javascript functionality for example something like:
      buffer.appendAttribute("id",iconId);
 
The code above adds a id attribute to the element, to enable the javascript code to lookup the html element by its id.

The above attribute is appended to whichever element the tree is currently rendering at the time renderTreeNodeStart is called.

Parameters:
buffer - string buffer containing the markup