net.sourceforge.formview
Class FormViewResources

java.lang.Object
  extended by net.sourceforge.formview.FormViewResources
All Implemented Interfaces:
java.io.Serializable

public class FormViewResources
extends java.lang.Object
implements java.io.Serializable

Description : Form view Resources wich load file form-view.xml and merge field with validator (validation.xml)

Author:
Angelo ZERR
See Also:
Serialized Form

Field Summary
protected  java.util.Map contextValuesMap
          Map of context values with the name of the constant as the key.
protected  org.apache.commons.collections.FastHashMap hDisplayers
          FastHashMap of displayers with the name of the constant as the key.
protected  org.apache.commons.collections.FastHashMap hHTMLDisplayers
           
protected  org.apache.commons.collections.FastHashMap hRolesDefinition
          FastHashMap of role definition with the name of the constant as the key.
protected  org.apache.commons.collections.FastHashMap hStates
          FastHashMap of global constant values with the name of the constant as the key.
protected  java.util.List lHTMLDisplayers
           
protected static org.apache.commons.logging.Log log
           
 
Constructor Summary
FormViewResources(java.io.InputStream in)
          Create a FormViewResources object from an InputStream.
FormViewResources(java.io.InputStream[] streams)
          Create a FormViewResources object from an InputStream.
 
Method Summary
 void addContextValue(java.lang.String key, java.lang.String value)
           
 void addDisplayer(Displayer displayer)
           
 void addDisplayer(java.lang.String name, java.lang.String className)
          Add a displayer to the resource.
 void addDisplayerClass(IHTMLDisplayer htmlDisplayer)
           
 void addForm(FormView formView)
          Add a FormSet to this FormViewResources object.
 void addRoleDefinition(RoleDefinition roleDefinition)
           
 void addRoleDefinition(java.lang.String name, RoleDefinition roleDefinition)
          Add a role definition to the resource.
 void addState(State state)
           
 void addState(java.lang.String name, java.lang.String behaviour)
          Add a global state to the resource.
 java.util.Map getContextValuesMap(FieldView field)
           
 java.lang.String getDefaultBehaviour(java.lang.String defaultState)
           
 java.lang.String getErrorBehaviour()
           
 FormView getForm(java.lang.String formKey, java.lang.String state)
           
 FormSetView getFormSet()
           
 FormView getFormView(java.lang.String formName, java.lang.String state)
           
 FormView getFormView(java.lang.String formName, java.lang.String state, java.util.Map roles)
           
 FormView getFormView(java.lang.String formName, java.lang.String state, java.lang.String[] roles)
           
 void mergeDisplayersWithDisplayerConfig(DisplayersConfigResources displayersResources)
           
 void mergeFormSetWithValidator(ExtendedValidatorResources validatorResources)
           
 java.lang.String processHtmlContent(FormView form, java.lang.String state, IPermissionsAdapter permissionsAdapter, java.lang.String htmlContent)
           
 void setErrorBehaviour(java.lang.String errorBehaviour)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

hStates

protected org.apache.commons.collections.FastHashMap hStates
FastHashMap of global constant values with the name of the constant as the key.


hRolesDefinition

protected org.apache.commons.collections.FastHashMap hRolesDefinition
FastHashMap of role definition with the name of the constant as the key.


hDisplayers

protected org.apache.commons.collections.FastHashMap hDisplayers
FastHashMap of displayers with the name of the constant as the key.


hHTMLDisplayers

protected org.apache.commons.collections.FastHashMap hHTMLDisplayers

lHTMLDisplayers

protected java.util.List lHTMLDisplayers

contextValuesMap

protected java.util.Map contextValuesMap
Map of context values with the name of the constant as the key. In this Map user can put name with value and use this value into your DisplayerConfig (eg : put context of WEB Application with key contextPath => and after you can use value into displayers like this

Constructor Detail

FormViewResources

public FormViewResources(java.io.InputStream in)
                  throws java.io.IOException,
                         org.xml.sax.SAXException
Create a FormViewResources object from an InputStream.

Parameters:
in - InputStream to a formview-config.xml configuration file. It's the client's responsibility to close this stream.
Throws:
java.io.IOException
org.xml.sax.SAXException - if the formview-config. XML files are not valid or well formed.

FormViewResources

public FormViewResources(java.io.InputStream[] streams)
                  throws java.io.IOException,
                         org.xml.sax.SAXException
Create a FormViewResources object from an InputStream.

Parameters:
streams - An array of InputStreams to several formview-config.xml configuration files that will be read in order and merged into this object. It's the client's responsibility to close these streams.
Throws:
java.io.IOException
org.xml.sax.SAXException - if the formview-config XML files are not valid or well formed.
Method Detail

mergeFormSetWithValidator

public void mergeFormSetWithValidator(ExtendedValidatorResources validatorResources)

addContextValue

public void addContextValue(java.lang.String key,
                            java.lang.String value)

addState

public void addState(State state)

addState

public void addState(java.lang.String name,
                     java.lang.String behaviour)
Add a global state to the resource.


addRoleDefinition

public void addRoleDefinition(RoleDefinition roleDefinition)

addRoleDefinition

public void addRoleDefinition(java.lang.String name,
                              RoleDefinition roleDefinition)
Add a role definition to the resource.


addDisplayer

public void addDisplayer(Displayer displayer)

addDisplayer

public void addDisplayer(java.lang.String name,
                         java.lang.String className)
Add a displayer to the resource.


mergeDisplayersWithDisplayerConfig

public void mergeDisplayersWithDisplayerConfig(DisplayersConfigResources displayersResources)

addDisplayerClass

public void addDisplayerClass(IHTMLDisplayer htmlDisplayer)

addForm

public void addForm(FormView formView)
Add a FormSet to this FormViewResources object.


getFormSet

public FormSetView getFormSet()

getForm

public FormView getForm(java.lang.String formKey,
                        java.lang.String state)

getDefaultBehaviour

public java.lang.String getDefaultBehaviour(java.lang.String defaultState)

getFormView

public FormView getFormView(java.lang.String formName,
                            java.lang.String state)

getFormView

public FormView getFormView(java.lang.String formName,
                            java.lang.String state,
                            java.lang.String[] roles)

getFormView

public FormView getFormView(java.lang.String formName,
                            java.lang.String state,
                            java.util.Map roles)
Returns:

processHtmlContent

public java.lang.String processHtmlContent(FormView form,
                                           java.lang.String state,
                                           IPermissionsAdapter permissionsAdapter,
                                           java.lang.String htmlContent)

getContextValuesMap

public java.util.Map getContextValuesMap(FieldView field)

getErrorBehaviour

public java.lang.String getErrorBehaviour()

setErrorBehaviour

public void setErrorBehaviour(java.lang.String errorBehaviour)


Copyright 2006 null. All Rights Reserved.