JSF-Spring

de.mindmatters.faces.application
Class IdForcingComponentFactory

java.lang.Object
  extended by de.mindmatters.faces.application.IdForcingComponentFactory
All Implemented Interfaces:
ComponentFactory

public final class IdForcingComponentFactory
extends java.lang.Object
implements ComponentFactory

ComponentFactory that generates "clean" client ids (in fact they are equal to their component id) for input components within a HtmlForm.

Author:
Andreas Kuhrwahl

Constructor Summary
IdForcingComponentFactory()
           
 
Method Summary
 void addComponent(Application application, java.lang.String componentType, java.lang.String componentClassName)
          Register a new mapping of component type to the name of the corresponding UIComponent class.
 UIComponent createComponent(Application application, java.lang.String componentType)
          Instantiate and return a new UIComponent instance of the class specified by a previous call to addComponent() for the specified component type.
 UIComponent createComponent(Application application, ValueBinding componentBinding, FacesContext context, java.lang.String componentType)
          Call the getValue() method on the specified ValueBinding.
 java.util.Iterator getComponentTypes(Application application)
          Return an Iterator over the set of currently defined component types for this Application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdForcingComponentFactory

public IdForcingComponentFactory()
Method Detail

addComponent

public void addComponent(Application application,
                         java.lang.String componentType,
                         java.lang.String componentClassName)
Register a new mapping of component type to the name of the corresponding UIComponent class. This allows subsequent calls to createComponent() to serve as a factory for UIComponent instances.

Specified by:
addComponent in interface ComponentFactory
Parameters:
application - the original Application of the underlying JSF implementation
componentType - The component type to be registered
componentClassName - The fully qualified class name of the corresponding UIComponent implementation

createComponent

public UIComponent createComponent(Application application,
                                   java.lang.String componentType)
Instantiate and return a new UIComponent instance of the class specified by a previous call to addComponent() for the specified component type.

Specified by:
createComponent in interface ComponentFactory
Parameters:
application - the original Application of the underlying JSF implementation
componentType - The component type for which to create and return a new UIComponent instance
Returns:
The created component

createComponent

public UIComponent createComponent(Application application,
                                   ValueBinding componentBinding,
                                   FacesContext context,
                                   java.lang.String componentType)
Call the getValue() method on the specified ValueBinding. If it returns a UIComponent instance, return it as the value of this method. If it does not, instantiate a new UIComponent instance of the specified component type, pass the new component to the setValue() method of the specified ValueBinding, and return it.

Specified by:
createComponent in interface ComponentFactory
Parameters:
application - the original Application of the underlying JSF implementation
componentBinding - ValueBinding representing a component value binding expression (typically specified by the component attribute of a custom tag)
context - FacesContext for the current request
componentType - Component type to create if the ValueBinding does not return a component instance
Returns:
The created component

getComponentTypes

public java.util.Iterator getComponentTypes(Application application)
Return an Iterator over the set of currently defined component types for this Application.

Specified by:
getComponentTypes in interface ComponentFactory
Parameters:
application - the original Application of the underlying JSF implementation
Returns:
An Iterator over the set of currently defined component types

JSF-Spring

Copyright © 2006 mindmatters GmbH & Co. KG