com.sun.rave.web.ui.renderer.template
Class TemplateRenderer

java.lang.Object
  extended by javax.faces.render.Renderer
      extended by com.sun.rave.web.ui.renderer.template.TemplateRenderer

public class TemplateRenderer
extends javax.faces.render.Renderer

This renderer is a generic "template-based" renderer. It uses a LayoutElement tree as its template and walks this tree. This renderer will actually delegate the encode functionality to the LayoutDefinition object, which is the top of the LayoutElement in the tree.

This renderer also has the feature of registering Resource objects to the Request scope prior to rendering its output. This allows Resource objects such as ResourceBundles to be added to the Request scope for easy access.

See Also:
LayoutDefinition, LayoutElement, Resource

Constructor Summary
TemplateRenderer()
           
 
Method Summary
 void decode(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           Decode any new state of the specified UIComponent from the request contained in the specified FacesContext, and store that state on the UIComponent.
 void encodeBegin(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           This method initializes the Resources so they will be available for children.
 void encodeChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           This method prevents the super class's default functionality of rendering the child UIComponents.
 void encodeEnd(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           This method performs the rendering for the TemplateRenderer.
 boolean getRendersChildren()
           This method returns true.
 
Methods inherited from class javax.faces.render.Renderer
convertClientId, getConvertedValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateRenderer

public TemplateRenderer()
Method Detail

getRendersChildren

public boolean getRendersChildren()

This method returns true. This method indicates that this Renderer will assume resposibilty for rendering its own children.

Overrides:
getRendersChildren in class javax.faces.render.Renderer
Returns:
true
See Also:
encodeChildren(FacesContext, UIComponent)

encodeBegin

public void encodeBegin(javax.faces.context.FacesContext context,
                        javax.faces.component.UIComponent component)
                 throws java.io.IOException

This method initializes the Resources so they will be available for children. It then calls encodeBegin on the superclass.

Overrides:
encodeBegin in class javax.faces.render.Renderer
Parameters:
context - The FacesContext
component - The UIComponent, should be a TemplateComponent
Throws:
java.io.IOException

encodeChildren

public void encodeChildren(javax.faces.context.FacesContext context,
                           javax.faces.component.UIComponent component)

This method prevents the super class's default functionality of rendering the child UIComponents. This Renderer implementation requires that the children be explicitly rendered. This method does nothing.

Overrides:
encodeChildren in class javax.faces.render.Renderer
Parameters:
context - The FacesContext
component - The UIComponent

encodeEnd

public void encodeEnd(javax.faces.context.FacesContext context,
                      javax.faces.component.UIComponent component)
               throws java.io.IOException

This method performs the rendering for the TemplateRenderer. It expects that component be an instanceof TemplateComponent. It obtains the LayoutDefinition from the TemplateComponent, initializes the Resource objects defined by the LayoutDefinition (if any), and finally delegates the encoding to the LayoutDefinition#encode(FacesContext, TemplateComponent) method of the LayoutDefinition.

Overrides:
encodeEnd in class javax.faces.render.Renderer
Parameters:
context - The FacesContext object
component - The TemplateComponent
Throws:
java.io.IOException

decode

public void decode(javax.faces.context.FacesContext context,
                   javax.faces.component.UIComponent component)

Decode any new state of the specified UIComponent from the request contained in the specified FacesContext, and store that state on the UIComponent.

During decoding, events may be queued for later processing (by event listeners that have registered an interest), by calling queueEvent() on the associated UIComponent.

This implementation of this method invokes the super class and then any handlers that have been registered to process decode functionality. The execution of these handlers is delegated to the LayoutDefinition.

Overrides:
decode in class javax.faces.render.Renderer
Parameters:
context - FacesContext for the request we are processing
component - UIComponent to be decoded.
Throws:
java.lang.NullPointerException - if context or component is null