|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A FormMap is used to provide a virtual representation of a form. It can contain any number of unique FormElements, and it can also be associated with FormValidators. The primary function of a form map is to:
Method Summary | |
void |
defineElement(FormElement element)
This defines an element to be mapped by this form, using the key from the FormElement. |
void |
defineElement(java.lang.String key,
FormElement element)
This defines an element to be mapped by this form. |
void |
defineValidator(FormValidator validator)
This defines a validator for the entire form. |
boolean |
exists(java.lang.String key)
Return true if an element exists (not null) |
FormElement |
getElement(java.lang.String key)
Get an element by key |
java.util.Map |
getElements()
return a map with containing all the elements in this form map |
java.lang.Object |
getVal(java.lang.String key)
Get the value for a given key. |
FormMap |
map(javax.servlet.ServletRequest req)
This is where we actually take an incoming form (in the form of a ServletRequest) and map it using the definitions supplied by all the FormElements. |
FormMap |
map(javax.servlet.ServletRequest req,
java.util.Locale loc)
This is where we actually take an incoming form (in the form of a ServletRequest) and map it using the definitions supplied by all the FormElements. |
FormMap |
map(javax.servlet.ServletRequest req,
java.lang.String prefix)
This is where we actually take an incoming form (in the form of a ServletRequest) and map it using the definitions supplied by all the FormElements. |
FormMap |
map(javax.servlet.ServletRequest req,
java.lang.String prefix,
java.util.Locale loc)
This is where we actually take an incoming form (in the form of a ServletRequest) and map it using the definitions supplied by all the FormElements. |
FormMap |
map(StateMap map)
This is where we actually take an incoming form (in the form of a StateMap) and map it using the definitions supplied by all the FormElements. |
FormMap |
map(StateMap map,
java.util.Locale loc)
This is where we actually take an incoming form (in the form of a StateMap) and map it using the definitions supplied by all the FormElements. |
FormMap |
map(StateMap map,
java.lang.String prefix)
This is where we actually take an incoming form (in the form of a StateMap) and map it using the definitions supplied by all the FormElements. |
FormMap |
map(StateMap map,
java.lang.String prefix,
java.util.Locale loc)
This is where we actually take an incoming form (in the form of a StateMap) and map it using the definitions supplied by all the FormElements. |
FormElement |
mapElement(java.lang.String key,
java.lang.Object origVal)
This allows you to map a single value (as opposed to passing in a whole statemap or request). |
FormElement |
mapElement(java.lang.String key,
java.lang.Object origVal,
java.util.Locale loc)
This allows you to map a single value (as opposed to passing in a whole statemap or request). |
void |
setVal(java.lang.String key,
java.lang.Object val)
Manually set the value of an element. |
FormMap |
validate(boolean deferExceptions)
Validate the entire form (both form level and elements). |
FormMap |
validateElements(boolean deferExceptions)
Validate just the elements (not the form) |
FormMap |
validateForm(boolean deferExceptions)
Validate just the form (not the individual elements) |
Methods inherited from interface org.enhydra.barracuda.core.util.data.StateMap |
getState, getStateKeys, getStateValues, putState, removeState |
Method Detail |
public void defineElement(FormElement element)
element
- a FormElement to be mapped by this formpublic void defineElement(java.lang.String key, FormElement element)
key
- the key which uniquely identifies this FormElementelement
- a FormElement to be mapped by this formpublic void defineValidator(FormValidator validator)
validator
- a form validator to be applied to the entire formpublic FormMap map(javax.servlet.ServletRequest req)
req
- the ServletRequest to map paramters from based on
all defined FormElements
MappingException
- if for some reason the value cannot
be mapped successfullypublic FormMap map(javax.servlet.ServletRequest req, java.util.Locale loc)
req
- the ServletRequest to map paramters from based on
all defined FormElementsloc
- the locale to use when parsing Dates and other locale dependend
values.
MappingException
- if for some reason the value cannot
be mapped successfullypublic FormMap map(StateMap map)
map
- the StateMap to map properties from based on
all defined FormElements
MappingException
- if for some reason the value cannot
be mapped successfullypublic FormMap map(StateMap map, java.util.Locale loc)
map
- the StateMap to map properties from based on
all defined FormElementsloc
- the locale to use when parsing Dates and other locale dependend
values.
MappingException
- if for some reason the value cannot
be mapped successfullypublic FormMap map(StateMap map, java.lang.String prefix)
map
- the StateMap to map properties from based on
all defined FormElementsprefix
- the prefix to use when mapping parameters
MappingException
- if for some reason the value cannot
be mapped successfullypublic FormMap map(StateMap map, java.lang.String prefix, java.util.Locale loc)
map
- the StateMap to map properties from based on
all defined FormElementsprefix
- the prefix to use when mapping parametersloc
- the locale to use when parsing Dates and other locale dependend
values.
MappingException
- if for some reason the value cannot
be mapped successfullypublic FormMap map(javax.servlet.ServletRequest req, java.lang.String prefix, java.util.Locale loc)
req
- the ServletRequest to map paramters from based on
all defined FormElementsprefix
- the prefix to use when mapping parametersloc
- the locale to use when parsing Dates and other locale dependend
values.
MappingException
- if for some reason the value cannot
be mapped successfullypublic FormMap map(javax.servlet.ServletRequest req, java.lang.String prefix)
req
- the ServletRequest to map paramters from based on
all defined FormElementsprefix
- the prefix to use when mapping parameters
MappingException
- if for some reason the value cannot
be mapped successfullypublic FormElement mapElement(java.lang.String key, java.lang.Object origVal)
key
- the name of the element we wish to map toorigVal
- the original value to be mapped
public FormElement mapElement(java.lang.String key, java.lang.Object origVal, java.util.Locale loc)
key
- the name of the element we wish to map toorigVal
- the original value to be mappedloc
- the locale to use when parsing Dates and other locale dependant values.
public FormMap validate(boolean deferExceptions) throws ValidationException
deferExceptions
- do we want to deferValidation exceptions
and attempt to validate all elements so that we can process
all the exceptions at once
ValidationException
- if the form (or any element within it)
is invalidpublic FormMap validateElements(boolean deferExceptions) throws ValidationException
deferExceptions
- do we want to deferValidation exceptions
and attempt to validate all elements so that we can process
all the exceptions at once
ValidationException
- if the form (or any element within it)
is invalidpublic FormMap validateForm(boolean deferExceptions) throws ValidationException
deferExceptions
- do we want to deferValidation exceptions
and attempt to validate all elements so that we can process
all the exceptions at once
ValidationException
- if the form (or any element within it)
is invalidpublic boolean exists(java.lang.String key)
key
- the key which uniquely identifies this FormElement
public FormElement getElement(java.lang.String key)
key
- the key which uniquely identifies this FormElement
public java.util.Map getElements()
public void setVal(java.lang.String key, java.lang.Object val)
key
- the keyval
- the value for the keypublic java.lang.Object getVal(java.lang.String key)
key
- the key which uniquely identifies this FormElement
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |