com.mycompany.jsf.renderer
Class TreeRenderer

java.lang.Object
  extended byjavax.faces.render.Renderer
      extended bycom.mycompany.jsf.renderer.TreeRenderer

public class TreeRenderer
extends javax.faces.render.Renderer

This class is a JSF Renderer for the "com.mycompany.Tree" component type. It renders a tree structure for the nodes represented by the component's model using the "openNode", "closedNode" and "leafNode" facets.

Version:
1.0
Author:
Hans Bergsten, Gefion Software

Constructor Summary
TreeRenderer()
           
 
Method Summary
 void encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Calls encodeNodes() to write the HTML elements for all nodes, within a "span" element with an "id" attribute set to the component's client ID if explicitly set.
private  void encodeNodes(javax.faces.context.FacesContext context, javax.faces.context.ResponseWriter out, UITree tree, java.lang.String parentId, int childLevel)
          Iterates over all expanded nodes in the model and processes the appropriate facet for each node.
private  void encodeRecursive(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Calls the appropriate encoding methods on the component and calls itself recursively for all component children.
 boolean getRendersChildren()
          Returns "true".
 
Methods inherited from class javax.faces.render.Renderer
convertClientId, decode, encodeBegin, encodeEnd, getConvertedValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeRenderer

public TreeRenderer()
Method Detail

getRendersChildren

public boolean getRendersChildren()
Returns "true".


encodeChildren

public void encodeChildren(javax.faces.context.FacesContext context,
                           javax.faces.component.UIComponent component)
                    throws java.io.IOException
Calls encodeNodes() to write the HTML elements for all nodes, within a "span" element with an "id" attribute set to the component's client ID if explicitly set.

Throws:
java.io.IOException

encodeNodes

private void encodeNodes(javax.faces.context.FacesContext context,
                         javax.faces.context.ResponseWriter out,
                         UITree tree,
                         java.lang.String parentId,
                         int childLevel)
                  throws java.io.IOException
Iterates over all expanded nodes in the model and processes the appropriate facet for each node. Writes a "br" elements after each node and embeds child nodes within a "blockquote" element.

Throws:
java.io.IOException

encodeRecursive

private void encodeRecursive(javax.faces.context.FacesContext context,
                             javax.faces.component.UIComponent component)
                      throws java.io.IOException
Calls the appropriate encoding methods on the component and calls itself recursively for all component children.

Throws:
java.io.IOException