org.richfaces.taglib
Class ComponentHandler

java.lang.Object
  extended by com.sun.facelets.tag.TagHandler
      extended by com.sun.facelets.tag.MetaTagHandler
          extended by org.richfaces.taglib.ComponentHandler
All Implemented Interfaces:
com.sun.facelets.FaceletHandler
Direct Known Subclasses:
ColumnsTagHandler

public class ComponentHandler
extends com.sun.facelets.tag.MetaTagHandler

Implementation of the tag logic used in the JSF specification. This is your golden hammer for wiring UIComponents to Facelets.

Version:
$Id: ComponentHandler.java,v 1.12 2006/01/11 05:40:56 jhook Exp $
Author:
Jacob Hookom

Field Summary
 
Fields inherited from class com.sun.facelets.tag.TagHandler
nextHandler, tag, tagId
 
Constructor Summary
ComponentHandler(com.sun.facelets.tag.jsf.ComponentConfig config)
           
 
Method Summary
 void apply(com.sun.facelets.FaceletContext ctx, javax.faces.component.UIComponent parent)
          Method handles UIComponent tree creation in accordance with the JSF 1.2 spec.
protected  void applyNextHandler(com.sun.facelets.FaceletContext ctx, javax.faces.component.UIComponent c)
           
protected  javax.faces.component.UIComponent createComponent(com.sun.facelets.FaceletContext ctx)
          If the binding attribute was specified, use that in conjuction with our componentType String variable to call createComponent on the Application, otherwise just pass the componentType String.
protected  com.sun.facelets.tag.MetaRuleset createMetaRuleset(java.lang.Class type)
           
protected  java.lang.String getId(com.sun.facelets.FaceletContext ctx)
          If the id TagAttribute was specified, get it's value, otherwise generate a unique id from our tagId.
protected  void onComponentCreated(com.sun.facelets.FaceletContext ctx, javax.faces.component.UIComponent c, javax.faces.component.UIComponent parent)
          A hook method for allowing developers to do additional processing once Facelets creates the component.
 
Methods inherited from class com.sun.facelets.tag.MetaTagHandler
setAttributes
 
Methods inherited from class com.sun.facelets.tag.TagHandler
findNextByType, getAttribute, getRequiredAttribute, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComponentHandler

public ComponentHandler(com.sun.facelets.tag.jsf.ComponentConfig config)
Method Detail

apply

public void apply(com.sun.facelets.FaceletContext ctx,
                  javax.faces.component.UIComponent parent)
           throws java.io.IOException,
                  javax.faces.FacesException,
                  javax.el.ELException
Method handles UIComponent tree creation in accordance with the JSF 1.2 spec.
  1. First determines this UIComponent's id by calling getId(FaceletContext).
  2. Search the parent for an existing UIComponent of the id we just grabbed
  3. If found, mark its children for deletion.
  4. If not found, call createComponent.
    1. Only here do we apply attributes
    2. Set the UIComponent's id
    3. Set the RendererType of this instance
  5. Now apply the nextHandler, passing the UIComponent we've created/found.
  6. Now add the UIComponent to the passed parent
  7. Lastly, if the UIComponent already existed (found), then finalize for deletion.

Throws:
com.sun.facelets.tag.TagException - if the UIComponent parent is null
java.io.IOException
javax.faces.FacesException
javax.el.ELException
See Also:
FaceletHandler.apply(com.sun.facelets.FaceletContext, javax.faces.component.UIComponent)

applyNextHandler

protected void applyNextHandler(com.sun.facelets.FaceletContext ctx,
                                javax.faces.component.UIComponent c)
                         throws java.io.IOException,
                                javax.faces.FacesException,
                                javax.el.ELException
Throws:
java.io.IOException
javax.faces.FacesException
javax.el.ELException

createComponent

protected javax.faces.component.UIComponent createComponent(com.sun.facelets.FaceletContext ctx)
If the binding attribute was specified, use that in conjuction with our componentType String variable to call createComponent on the Application, otherwise just pass the componentType String.

If the binding was used, then set the ValueExpression "binding" on the created UIComponent.

Parameters:
ctx - FaceletContext to use in creating a component
Returns:
See Also:
Application.createComponent(javax.faces.el.ValueBinding, javax.faces.context.FacesContext, java.lang.String), Application.createComponent(java.lang.String)

getId

protected java.lang.String getId(com.sun.facelets.FaceletContext ctx)
If the id TagAttribute was specified, get it's value, otherwise generate a unique id from our tagId.

Parameters:
ctx - FaceletContext to use
Returns:
what should be a unique Id
See Also:
TagAttribute.getValue(FaceletContext)

createMetaRuleset

protected com.sun.facelets.tag.MetaRuleset createMetaRuleset(java.lang.Class type)
Overrides:
createMetaRuleset in class com.sun.facelets.tag.MetaTagHandler

onComponentCreated

protected void onComponentCreated(com.sun.facelets.FaceletContext ctx,
                                  javax.faces.component.UIComponent c,
                                  javax.faces.component.UIComponent parent)
A hook method for allowing developers to do additional processing once Facelets creates the component. The 'setAttributes' method is still perferred, but this method will provide the parent UIComponent before it's been added to the tree and before any children have been added to the newly created UIComponent.

Parameters:
ctx -
c -
parent -


Copyright © 2008. All Rights Reserved.