org.apache.myfaces.view.facelets.tag.jsf
Class ComponentTagHandlerDelegate

java.lang.Object
  extended by javax.faces.view.facelets.TagHandlerDelegate
      extended by org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate

public class ComponentTagHandlerDelegate
extends javax.faces.view.facelets.TagHandlerDelegate

Implementation of the tag logic used in the JSF specification.

Since:
2.0
Version:
$Revision: 1100245 $ $Date: 2011-05-06 10:01:20 -0500 (Fri, 06 May 2011) $
Author:
Leonardo Uribe (latest modification by $Author: lu4242 $)
See Also:
ComponentHandler

Constructor Summary
ComponentTagHandlerDelegate(javax.faces.view.facelets.ComponentHandler delegate)
           
 
Method Summary
 void apply(javax.faces.view.facelets.FaceletContext ctx, javax.faces.component.UIComponent parent)
          Method handles UIComponent tree creation in accordance with the JSF 1.2 spec.
protected  javax.faces.component.UIComponent createComponent(javax.faces.view.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.
 javax.faces.view.facelets.MetaRuleset createMetaRuleset(java.lang.Class type)
           
protected  java.lang.String getFacetName(javax.faces.view.facelets.FaceletContext ctx, javax.faces.component.UIComponent parent)
          Return the Facet name we are scoped in, otherwise null
protected  java.lang.String getId(javax.faces.view.facelets.FaceletContext ctx)
          If the id TagAttribute was specified, get it's value, otherwise generate a unique id from our tagId.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentTagHandlerDelegate

public ComponentTagHandlerDelegate(javax.faces.view.facelets.ComponentHandler delegate)
Method Detail

apply

public void apply(javax.faces.view.facelets.FaceletContext ctx,
                  javax.faces.component.UIComponent parent)
           throws java.io.IOException
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.

Specified by:
apply in class javax.faces.view.facelets.TagHandlerDelegate
Throws:
javax.faces.view.facelets.TagException - if the UIComponent parent is null
java.io.IOException
See Also:
FaceletHandler.apply(javax.faces.view.facelets.FaceletContext, javax.faces.component.UIComponent)

getFacetName

protected final java.lang.String getFacetName(javax.faces.view.facelets.FaceletContext ctx,
                                              javax.faces.component.UIComponent parent)
Return the Facet name we are scoped in, otherwise null

Parameters:
ctx -
Returns:

createComponent

protected javax.faces.component.UIComponent createComponent(javax.faces.view.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(javax.faces.view.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

public javax.faces.view.facelets.MetaRuleset createMetaRuleset(java.lang.Class type)
Specified by:
createMetaRuleset in class javax.faces.view.facelets.TagHandlerDelegate


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.