JSF-Spring

de.mindmatters.faces.application
Class ApplicationImpl

java.lang.Object
  extended by javax.faces.application.Application
      extended by de.mindmatters.faces.application.ApplicationImpl

public final class ApplicationImpl
extends Application

Application represents a per-web-application singleton object where applications based on JavaServer Faces (or implementations wishing to provide extended functionality) can register application-wide singletons that provide functionality required by JavaServer Faces.

This implemetation delegates the management and creation of UIComponents, Converters, Validators and MethodBindings to appropriate factories as follows:

Methods which delegates to Factory of type
Application.addComponent(String, String), Application.addComponent(String, String), Application.addComponent(String, String), Application.addComponent(String, String) ComponentFactory
Application.addConverter(Class, String), Application.addConverter(String, String), Application.createConverter(Class), Application.createConverter(String), Application.getConverterIds(), Application.getConverterTypes() ConverterFactory
Application.addValidator(String, String), Application.createValidator(String), Application.getValidatorIds() ValidatorFactory
Application.createMethodBinding(String, Class[]), Application.createValueBinding(String) MethodBindingFactory

Author:
Andreas Kuhrwahl

Field Summary
static java.lang.String COMPONENT_FACTORY_BEAN_NAME
          Name of the ComponentFactory bean in the factory.
static java.lang.String CONVERTER_FACTORY_BEAN_NAME
          Name of the ConverterFactory bean in the factory.
static java.lang.String METHOD_BINDING_FACTORY_BEAN_NAME
          Name of the MethodBindingFactory bean in the factory.
static java.lang.String VALIDATOR_FACTORY_BEAN_NAME
          Name of the ValidatorFactory bean in the factory.
 
Constructor Summary
ApplicationImpl(Application delegate)
          Creates an application with the given original application delegate.
ApplicationImpl(Application delegate, BeanFactory beanFactory)
          Creates an application with the given original application delegate.
 
Method Summary
 void addComponent(java.lang.String componentType, java.lang.String componentClass)
          Define a new mapping from a logical "component type" to an actual java class name.
 void addConverter(java.lang.Class targetClass, java.lang.String converterClass)
          
 void addConverter(java.lang.String converterId, java.lang.String converterClass)
          
 void addValidator(java.lang.String validatorId, java.lang.String validatorClass)
          
 UIComponent createComponent(java.lang.String componentType)
          Create a new UIComponent subclass, using the mappings defined by previous calls to the addComponent method of this class.
 UIComponent createComponent(ValueBinding componentBinding, FacesContext context, java.lang.String componentType)
          Create an object which has an associating "binding" expression tying the component to a user property.
 Converter createConverter(java.lang.Class targetClass)
          
 Converter createConverter(java.lang.String converterId)
          
 MethodBinding createMethodBinding(java.lang.String ref, java.lang.Class[] params)
          Create an object which can be used to invoke an arbitrary method via an EL expression at a later time.
 Validator createValidator(java.lang.String validatorId)
          
 ValueBinding createValueBinding(java.lang.String ref)
          Create an object which can be used to invoke an arbitrary method via an EL expression at a later time.
 ActionListener getActionListener()
          
 java.util.Iterator getComponentTypes()
          
 java.util.Iterator getConverterIds()
          
 java.util.Iterator getConverterTypes()
          
 java.util.Locale getDefaultLocale()
          
 java.lang.String getDefaultRenderKitId()
          
 java.lang.String getMessageBundle()
          
 NavigationHandler getNavigationHandler()
          Return the NavigationHandler object which is responsible for mapping from a logical (viewid, fromAction, outcome) to the URL of a view to be rendered.
 PropertyResolver getPropertyResolver()
          Get the object used by the VariableResolver to read and write named properties on java beans, Arrays, Lists and Maps.
 StateManager getStateManager()
          
 java.util.Iterator getSupportedLocales()
          
 java.util.Iterator getValidatorIds()
          
 VariableResolver getVariableResolver()
          Get the object used to resolve expressions of form "#{...}".
 ViewHandler getViewHandler()
          
 void setActionListener(ActionListener listener)
          
 void setDefaultLocale(java.util.Locale locale)
          
 void setDefaultRenderKitId(java.lang.String renderKitId)
          
 void setMessageBundle(java.lang.String bundle)
          
 void setNavigationHandler(NavigationHandler handler)
          
 void setPropertyResolver(PropertyResolver resolver)
          
 void setStateManager(StateManager manager)
          
 void setSupportedLocales(java.util.Collection locales)
          
 void setVariableResolver(VariableResolver resolver)
          
 void setViewHandler(ViewHandler handler)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

METHOD_BINDING_FACTORY_BEAN_NAME

public static final java.lang.String METHOD_BINDING_FACTORY_BEAN_NAME
Name of the MethodBindingFactory bean in the factory.

See Also:
Constant Field Values

VALIDATOR_FACTORY_BEAN_NAME

public static final java.lang.String VALIDATOR_FACTORY_BEAN_NAME
Name of the ValidatorFactory bean in the factory.

See Also:
Constant Field Values

CONVERTER_FACTORY_BEAN_NAME

public static final java.lang.String CONVERTER_FACTORY_BEAN_NAME
Name of the ConverterFactory bean in the factory.

See Also:
Constant Field Values

COMPONENT_FACTORY_BEAN_NAME

public static final java.lang.String COMPONENT_FACTORY_BEAN_NAME
Name of the ComponentFactory bean in the factory.

See Also:
Constant Field Values
Constructor Detail

ApplicationImpl

public ApplicationImpl(Application delegate)
Creates an application with the given original application delegate.

Parameters:
delegate - The original application of the underlying JSF implementation

ApplicationImpl

public ApplicationImpl(Application delegate,
                       BeanFactory beanFactory)
Creates an application with the given original application delegate.

Parameters:
delegate - The original application of the underlying JSF implementation
beanFactory - the Beanfactory
Method Detail

getActionListener

public ActionListener getActionListener()

Specified by:
getActionListener in class Application

getDefaultLocale

public java.util.Locale getDefaultLocale()

Specified by:
getDefaultLocale in class Application

getDefaultRenderKitId

public java.lang.String getDefaultRenderKitId()

Specified by:
getDefaultRenderKitId in class Application

getMessageBundle

public java.lang.String getMessageBundle()

Specified by:
getMessageBundle in class Application

getNavigationHandler

public NavigationHandler getNavigationHandler()
Return the NavigationHandler object which is responsible for mapping from a logical (viewid, fromAction, outcome) to the URL of a view to be rendered.

Specified by:
getNavigationHandler in class Application

getPropertyResolver

public PropertyResolver getPropertyResolver()
Get the object used by the VariableResolver to read and write named properties on java beans, Arrays, Lists and Maps. This object is used by the ValueBinding implementation, and during the process of configuring "managed bean" properties.

Specified by:
getPropertyResolver in class Application

getStateManager

public StateManager getStateManager()

Specified by:
getStateManager in class Application

getSupportedLocales

public java.util.Iterator getSupportedLocales()

Specified by:
getSupportedLocales in class Application

getVariableResolver

public VariableResolver getVariableResolver()
Get the object used to resolve expressions of form "#{...}".

Specified by:
getVariableResolver in class Application

getViewHandler

public ViewHandler getViewHandler()

Specified by:
getViewHandler in class Application

setActionListener

public void setActionListener(ActionListener listener)

Specified by:
setActionListener in class Application

setDefaultLocale

public void setDefaultLocale(java.util.Locale locale)

Specified by:
setDefaultLocale in class Application

setDefaultRenderKitId

public void setDefaultRenderKitId(java.lang.String renderKitId)

Specified by:
setDefaultRenderKitId in class Application

setMessageBundle

public void setMessageBundle(java.lang.String bundle)

Specified by:
setMessageBundle in class Application

setNavigationHandler

public void setNavigationHandler(NavigationHandler handler)

Specified by:
setNavigationHandler in class Application

setPropertyResolver

public void setPropertyResolver(PropertyResolver resolver)

Specified by:
setPropertyResolver in class Application

setStateManager

public void setStateManager(StateManager manager)

Specified by:
setStateManager in class Application

setSupportedLocales

public void setSupportedLocales(java.util.Collection locales)

Specified by:
setSupportedLocales in class Application

setVariableResolver

public void setVariableResolver(VariableResolver resolver)

Specified by:
setVariableResolver in class Application

setViewHandler

public void setViewHandler(ViewHandler handler)

Specified by:
setViewHandler in class Application

addComponent

public void addComponent(java.lang.String componentType,
                         java.lang.String componentClass)
Define a new mapping from a logical "component type" to an actual java class name. This controls what type is created when method createComponent of this class is called.

Param componentClass must be the fully-qualified class name of some class extending the UIComponent class. The class must have a default constructor, as instances of it will be created using Class.newInstance.

It is permitted to override a previously defined mapping, ie to call this method multiple times with the same componentType string. The createComponent method will simply use the last defined mapping.

Specified by:
addComponent in class Application

createComponent

public UIComponent createComponent(java.lang.String componentType)
Create a new UIComponent subclass, using the mappings defined by previous calls to the addComponent method of this class.

Specified by:
createComponent in class Application

createComponent

public UIComponent createComponent(ValueBinding componentBinding,
                                   FacesContext context,
                                   java.lang.String componentType)
Create an object which has an associating "binding" expression tying the component to a user property.

First the specified value-binding is evaluated; if it returns a non-null value then the component "already exists" and so the resulting value is simply returned.

Otherwise a new UIComponent instance is created using the specified componentType, and the new object stored via the provided value-binding before being returned.

Specified by:
createComponent in class Application

getComponentTypes

public java.util.Iterator getComponentTypes()

Specified by:
getComponentTypes in class Application

addConverter

public void addConverter(java.lang.Class targetClass,
                         java.lang.String converterClass)

Specified by:
addConverter in class Application

addConverter

public void addConverter(java.lang.String converterId,
                         java.lang.String converterClass)

Specified by:
addConverter in class Application

createConverter

public Converter createConverter(java.lang.Class targetClass)

Specified by:
createConverter in class Application

createConverter

public Converter createConverter(java.lang.String converterId)

Specified by:
createConverter in class Application

getConverterIds

public java.util.Iterator getConverterIds()

Specified by:
getConverterIds in class Application

getConverterTypes

public java.util.Iterator getConverterTypes()

Specified by:
getConverterTypes in class Application

createMethodBinding

public MethodBinding createMethodBinding(java.lang.String ref,
                                         java.lang.Class[] params)
Create an object which can be used to invoke an arbitrary method via an EL expression at a later time. This is similar to createValueBinding except that it can invoke an arbitrary method (with parameters) rather than just get/set a javabean property.

This is used to invoke ActionListener method, and ValueChangeListener methods.

Specified by:
createMethodBinding in class Application

createValueBinding

public ValueBinding createValueBinding(java.lang.String ref)
Create an object which can be used to invoke an arbitrary method via an EL expression at a later time. This is similar to createValueBinding except that it can invoke an arbitrary method (with parameters) rather than just get/set a javabean property.

This is used to invoke ActionListener method, and ValueChangeListener methods.

Specified by:
createValueBinding in class Application

addValidator

public void addValidator(java.lang.String validatorId,
                         java.lang.String validatorClass)

Specified by:
addValidator in class Application

createValidator

public Validator createValidator(java.lang.String validatorId)

Specified by:
createValidator in class Application

getValidatorIds

public java.util.Iterator getValidatorIds()

Specified by:
getValidatorIds in class Application

JSF-Spring

Copyright © 2006 mindmatters GmbH & Co. KG