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

java.lang.Object
  extended by javax.faces.view.facelets.TagHandlerDelegate
      extended by org.apache.myfaces.view.facelets.tag.jsf.ConverterTagHandlerDelegate
All Implemented Interfaces:
AttachedObjectHandler, ValueHolderAttachedObjectHandler

public class ConverterTagHandlerDelegate
extends TagHandlerDelegate
implements ValueHolderAttachedObjectHandler

Handles setting a Converter instance on a ValueHolder. Will wire all attributes set to the Converter instance created/fetched. Uses the "binding" attribute for grabbing instances to apply attributes to.

Will only set/create Converter is the passed UIComponent's parent is null, signifying that it wasn't restored from an existing tree.

Since:
2.0
Version:
$Revision: 964310 $ $Date: 2010-07-15 01:17:19 -0500 (Thu, 15 Jul 2010) $
Author:
Leonardo Uribe (latest modification by $Author: lu4242 $)

Constructor Summary
ConverterTagHandlerDelegate(ConverterHandler delegate)
           
 
Method Summary
 void apply(FaceletContext ctx, UIComponent parent)
          Set Converter instance on parent ValueHolder if it's not being restored.
 void applyAttachedObject(FacesContext context, UIComponent parent)
           
protected  Converter createConverter(FaceletContext ctx)
          Create a Converter instance
 MetaRuleset createMetaRuleset(Class type)
           
 String getFor()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConverterTagHandlerDelegate

public ConverterTagHandlerDelegate(ConverterHandler delegate)
Method Detail

apply

public void apply(FaceletContext ctx,
                  UIComponent parent)
           throws IOException
Set Converter instance on parent ValueHolder if it's not being restored.
  1. Cast to ValueHolder
  2. If "binding" attribute was specified, fetch/create and re-bind to expression.
  3. Otherwise, call createConverter.
  4. Call setAttributes on Converter instance.
  5. Set the Converter on the ValueHolder
  6. If the ValueHolder has a localValue, convert it and set the value

Specified by:
apply in class TagHandlerDelegate
Throws:
IOException
See Also:
ValueHolder, Converter, createConverter(FaceletContext), FaceletHandler.apply(javax.faces.view.facelets.FaceletContext, javax.faces.component.UIComponent)

createConverter

protected Converter createConverter(FaceletContext ctx)
Create a Converter instance

Parameters:
ctx - FaceletContext to use
Returns:
Converter instance, cannot be null

createMetaRuleset

public MetaRuleset createMetaRuleset(Class type)
Specified by:
createMetaRuleset in class TagHandlerDelegate

applyAttachedObject

public void applyAttachedObject(FacesContext context,
                                UIComponent parent)
Specified by:
applyAttachedObject in interface AttachedObjectHandler

getFor

public String getFor()
Specified by:
getFor in interface AttachedObjectHandler


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