org.omnifaces.taghandler
Class Converter

java.lang.Object
  extended by javax.faces.view.facelets.TagHandler
      extended by javax.faces.view.facelets.MetaTagHandler
          extended by javax.faces.view.facelets.DelegatingMetaTagHandler
              extended by javax.faces.view.facelets.FaceletsAttachedObjectHandler
                  extended by javax.faces.view.facelets.ConverterHandler
                      extended by org.omnifaces.taghandler.Converter
All Implemented Interfaces:
javax.faces.view.AttachedObjectHandler, javax.faces.view.facelets.FaceletHandler, javax.faces.view.ValueHolderAttachedObjectHandler

public class Converter
extends javax.faces.view.facelets.ConverterHandler

The <o:converter> basically extends the <f:converter> tag family with the possibility to evaluate the value expression in all attributes on a per request basis instead of on a per view build time basis. This allows the developer to change the attributes on a per request basis.

When you specify for example the standard <f:convertDateTime> by converterId="javax.faces.DateTime", then you'll be able to use all its attributes such as pattern and locale as per its documentation, but then with the possibility to supply request based value expressions.

 <o:converter converterId="javax.faces.DateTime" pattern="#{item.pattern}" locale="#{item.locale}" />
 

Author:
Bauke Scholtz

Nested Class Summary
protected static class Converter.RenderTimeConverter
          So that we can have a serializable converter.
 
Field Summary
 
Fields inherited from class javax.faces.view.facelets.DelegatingMetaTagHandler
delegateFactory
 
Fields inherited from class javax.faces.view.facelets.TagHandler
nextHandler, tag, tagId
 
Constructor Summary
Converter(javax.faces.view.facelets.ConverterConfig config)
          The constructor.
 
Method Summary
 void apply(javax.faces.view.facelets.FaceletContext context, javax.faces.component.UIComponent parent)
          Create a Converter based on the binding and/or converterId attributes as per the standard JSF <f:converter> implementation and collect the render time attributes.
<T> T
create(javax.faces.application.Application application, java.lang.String id)
          Create the concrete Converter or Validator.
 javax.faces.view.facelets.TagAttribute getTagAttribute(java.lang.String name)
          Just return TagHandler#getAttribute() via a public method (it's by default protected and otherwise thus unavailable inside collectRenderTimeAttributes().
protected  javax.faces.view.facelets.TagHandlerDelegate getTagHandlerDelegate()
           
 boolean isDisabled(javax.faces.view.facelets.FaceletContext context)
           
 
Methods inherited from class javax.faces.view.facelets.ConverterHandler
getConverterId
 
Methods inherited from class javax.faces.view.facelets.FaceletsAttachedObjectHandler
applyAttachedObject, getAttachedObjectHandlerHelper, getFor
 
Methods inherited from class javax.faces.view.facelets.DelegatingMetaTagHandler
applyNextHandler, createMetaRuleset, getBinding, getTag, getTagId, setAttributes
 
Methods inherited from class javax.faces.view.facelets.TagHandler
getAttribute, getRequiredAttribute, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.faces.view.AttachedObjectHandler
applyAttachedObject, getFor
 

Constructor Detail

Converter

public Converter(javax.faces.view.facelets.ConverterConfig config)
The constructor.

Parameters:
config - The converter config.
Method Detail

apply

public void apply(javax.faces.view.facelets.FaceletContext context,
                  javax.faces.component.UIComponent parent)
           throws java.io.IOException
Create a Converter based on the binding and/or converterId attributes as per the standard JSF <f:converter> implementation and collect the render time attributes. Then create an anonymous Converter implementation which wraps the created Converter and delegates the methods to it after setting the render time attributes. Finally set the anonymous implementation on the parent component.

Specified by:
apply in interface javax.faces.view.facelets.FaceletHandler
Overrides:
apply in class javax.faces.view.facelets.DelegatingMetaTagHandler
Parameters:
context - The involved facelet context.
parent - The parent component to set the Converter on.
Throws:
java.io.IOException - If something fails at I/O level.

create

public <T> T create(javax.faces.application.Application application,
                    java.lang.String id)
Create the concrete Converter or Validator.


getTagAttribute

public javax.faces.view.facelets.TagAttribute getTagAttribute(java.lang.String name)
Just return TagHandler#getAttribute() via a public method (it's by default protected and otherwise thus unavailable inside collectRenderTimeAttributes().

Overrides:
getTagAttribute in class javax.faces.view.facelets.DelegatingMetaTagHandler

getTagHandlerDelegate

protected javax.faces.view.facelets.TagHandlerDelegate getTagHandlerDelegate()
Overrides:
getTagHandlerDelegate in class javax.faces.view.facelets.ConverterHandler

isDisabled

public boolean isDisabled(javax.faces.view.facelets.FaceletContext context)
Overrides:
isDisabled in class javax.faces.view.facelets.DelegatingMetaTagHandler