|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.formproc.Form
A form represents a collection of fields which can be validated. Every form has a name which corresponds to a form definition in the formproc.xml file. In addition every form has a target object. When a form is processed each field is written to the target object either through a setxxx() method or through a method defined in the form's XML configuration file.
Field Summary | |
protected ValidationResultMap |
validationResults
|
Constructor Summary | |
Form()
Construct a new form. |
|
Form(java.lang.String name,
java.lang.Object target)
Construct a new form with the given form name and target object. |
Method Summary | |
void |
configure(FormConfiguration formConfiguration)
Configure this form from the given FormConfiguration. |
protected java.lang.Object |
convert(FormElement formElement,
java.lang.Object value,
java.util.Locale locale)
Convert the given value from one type to another using the converter assigned to the given FormElement. |
java.lang.String |
getErrorMessage(java.lang.String name)
Get the last error message for the given field. |
java.lang.String |
getErrorMessage(java.lang.String name,
java.util.Locale locale)
Get the last error message for the given field using the given Locale. |
protected FormConfiguration |
getFormConfiguration()
Get the FormConfiguration for this form. |
java.lang.String |
getMessage(java.lang.String name)
Get a message for the given field using the default Locale. |
java.lang.String |
getMessage(java.lang.String name,
java.util.Locale locale)
Get a message for the given field using the given Locale. |
java.lang.String |
getName()
Get the form name. |
java.lang.Object |
getTarget()
Get the target object. |
java.lang.String |
getWriteMethod(java.lang.String name)
Get the write method for the given field name. |
FormResult |
process(FormData[] formData)
Process the given FormData objects. |
FormResult |
process(FormData[] formData,
java.util.Locale locale)
Process the given FormData objects. |
protected ValidationResult |
process(FormElement formElement,
FormData formData,
java.util.Locale locale)
Process the given FormData object. |
FormResult |
process(java.util.List formData)
Process the given FormData objects. |
FormResult |
process(java.util.List formData,
java.util.Locale locale)
Process the given FormData objects. |
void |
setName(java.lang.String name)
Set the form name. |
void |
setTarget(java.lang.Object target)
Set the target object. |
protected void |
store(FormElement formElement,
java.lang.Object value,
java.util.Locale locale)
Store the value for the named field in the target object. |
protected ValidationResult |
validate(FormElement formElement,
FormData formData,
java.util.Locale locale)
Validate the given form data. |
protected ValidationResultMap |
validateGroups(FormData[] formData,
java.util.Locale locale)
Validate all of the FormElementGroups defined for this form. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ValidationResultMap validationResults
Constructor Detail |
public Form()
public Form(java.lang.String name, java.lang.Object target)
name
- The form nametarget
- The target objectMethod Detail |
public java.lang.String getName()
public void setName(java.lang.String name)
name
- The form namepublic java.lang.Object getTarget()
public void setTarget(java.lang.Object target)
target
- The target objectpublic java.lang.String getMessage(java.lang.String name)
name
- The field name
public java.lang.String getMessage(java.lang.String name, java.util.Locale locale)
name
- The field namelocale
- The Locale
public java.lang.String getErrorMessage(java.lang.String name)
name
- The field name
public java.lang.String getErrorMessage(java.lang.String name, java.util.Locale locale)
name
- The field namelocale
- The Locale
public java.lang.String getWriteMethod(java.lang.String name)
For example: given a field called address and no defined write method, the method will be setAddress. Given a field firstName, the write method is setFirstName. Given a field firstname, the write method is setFirstname.
name
- The field name
public void configure(FormConfiguration formConfiguration)
formConfiguration
- The FormConfigurationpublic FormResult process(FormData[] formData) throws java.lang.Exception
formData
- An array of FormData objects
java.lang.Exception
- Any exceptionpublic FormResult process(FormData[] formData, java.util.Locale locale) throws java.lang.Exception
formData
- An array of FormData objectslocale
- The current locale
java.lang.Exception
- Any exceptionpublic FormResult process(java.util.List formData) throws java.lang.Exception
formData
- An List of FormData objects
java.lang.Exception
- Any exceptionpublic FormResult process(java.util.List formData, java.util.Locale locale) throws java.lang.Exception
formData
- An List of FormData objectslocale
- The current locale
java.lang.Exception
- Any exceptionprotected ValidationResult process(FormElement formElement, FormData formData, java.util.Locale locale) throws java.lang.Exception
formData
- The FormData object
java.lang.Exception
- Any exceptionprotected ValidationResult validate(FormElement formElement, FormData formData, java.util.Locale locale) throws java.lang.Exception
formElement
- The FormElementformData
- The form datalocale
- The Locale
java.lang.Exception
- Any exceptionprotected ValidationResultMap validateGroups(FormData[] formData, java.util.Locale locale) throws java.lang.Exception
formData
- The FormData arraylocale
- The Locale
java.lang.Exception
protected java.lang.Object convert(FormElement formElement, java.lang.Object value, java.util.Locale locale) throws java.lang.Exception
formElement
- The FormElementvalue
- The valuelocale
- The locale
java.lang.Exception
- Any exceptionprotected void store(FormElement formElement, java.lang.Object value, java.util.Locale locale) throws java.lang.Exception
formElement
- The FormElementvalue
- The valuelocale
- The locale
java.lang.Exception
- Any exceptionprotected FormConfiguration getFormConfiguration()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |