net.sf.springlayout.web.layout
Class LayoutForm

java.lang.Object
  extended by net.sf.springlayout.web.layout.LayoutForm
All Implemented Interfaces:
Form, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
LayoutPanelForm

public class LayoutForm
extends java.lang.Object
implements Form, org.springframework.beans.factory.InitializingBean

Default implementation of a Form

Author:
Rob Monie

Field Summary
protected  java.lang.String controllerBeanName
           
protected  java.util.Map fieldDefinitions
           
protected  java.lang.String formAction
           
protected  java.lang.String formName
           
 
Constructor Summary
LayoutForm()
           
 
Method Summary
 void afterPropertiesSet()
          Test to ensure that a controller has been provided to the class and all field definitions keys match the map key.
 java.lang.String getControllerBeanName()
          Retrieves the controllerBeanName for this LayoutForm.
 java.util.Map getErrors(org.springframework.validation.Errors errors)
          Gets errors for the current panel by retrieving all errors relating to fields defined for this panel from the errors object.
 FieldDefinition getFieldDefinition(java.lang.String path)
          Gets a field definition from the fieldDefinitions map by the field path passed in.
 java.util.Map getFieldDefinitions()
           
 java.lang.String getFormAction()
          Gets the url for this panel
 java.lang.String getFormName()
           
 boolean hasErrors(org.springframework.validation.Errors errors)
          Checks the current panel for errors
 void setControllerBeanName(java.lang.String controllerBeanName)
          Sets the controllerBeanName for this LayoutForm.
 void setFieldDefinitions(java.util.Map fieldDefinitions)
           
 void setFormAction(java.lang.String formAction)
          Sets the url for this panel.
 void setFormName(java.lang.String formName)
           
 void validate(javax.servlet.http.HttpServletRequest request, java.lang.Object obj, org.springframework.validation.Errors errors)
          Calls validate on all validation rules associated with the fieldDefinitions for this panel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldDefinitions

protected java.util.Map fieldDefinitions

formName

protected java.lang.String formName

formAction

protected java.lang.String formAction

controllerBeanName

protected java.lang.String controllerBeanName
Constructor Detail

LayoutForm

public LayoutForm()
Method Detail

getFieldDefinitions

public java.util.Map getFieldDefinitions()
Specified by:
getFieldDefinitions in interface Form
Returns:
Returns the fields.

setFieldDefinitions

public void setFieldDefinitions(java.util.Map fieldDefinitions)
Specified by:
setFieldDefinitions in interface Form
Parameters:
fieldDefinitions - The fields to set.

getFieldDefinition

public FieldDefinition getFieldDefinition(java.lang.String path)
Description copied from interface: Form
Gets a field definition from the fieldDefinitions map by the field path passed in. Indexed fields with paths that traverse collections such as commandObject.list[2].fieldName match against a non-indexed key in a format such as commandObject.list.fieldName. This way single field definition is used for all elements within a collection resulting in a fully dynamic solution.

Specified by:
getFieldDefinition in interface Form
Parameters:
path - the path of the property in the object graph
Returns:
a field definition for the path

validate

public void validate(javax.servlet.http.HttpServletRequest request,
                     java.lang.Object obj,
                     org.springframework.validation.Errors errors)
Description copied from interface: Form
Calls validate on all validation rules associated with the fieldDefinitions for this panel.

Specified by:
validate in interface Form
Parameters:
request - the current HttpServletRequest
obj - the current command object to be validated
errors - the current errors for this request

getErrors

public java.util.Map getErrors(org.springframework.validation.Errors errors)
Description copied from interface: Form
Gets errors for the current panel by retrieving all errors relating to fields defined for this panel from the errors object.

Specified by:
getErrors in interface Form
Parameters:
errors - the current page errors
Returns:
a map of errors for this panel

hasErrors

public boolean hasErrors(org.springframework.validation.Errors errors)
Description copied from interface: Form
Checks the current panel for errors

Specified by:
hasErrors in interface Form
Parameters:
errors - the current page errors
Returns:
true if errors present for this panel group

afterPropertiesSet

public void afterPropertiesSet()
Test to ensure that a controller has been provided to the class and all field definitions keys match the map key.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean

getFormName

public java.lang.String getFormName()
Specified by:
getFormName in interface Form
Returns:
Returns the formName.

setFormName

public void setFormName(java.lang.String formName)
Specified by:
setFormName in interface Form

getFormAction

public java.lang.String getFormAction()
Description copied from interface: Form
Gets the url for this panel

Specified by:
getFormAction in interface Form
Returns:

setFormAction

public void setFormAction(java.lang.String formAction)
Description copied from interface: Form
Sets the url for this panel. The url should match that used to map to the controller used by this panel.

Specified by:
setFormAction in interface Form

getControllerBeanName

public java.lang.String getControllerBeanName()
Description copied from interface: Form
Retrieves the controllerBeanName for this LayoutForm.

Specified by:
getControllerBeanName in interface Form
Returns:
Returns the controllerBeanName for this LayoutForm.

setControllerBeanName

public void setControllerBeanName(java.lang.String controllerBeanName)
Description copied from interface: Form
Sets the controllerBeanName for this LayoutForm.

Specified by:
setControllerBeanName in interface Form
Parameters:
controllerBeanName - Sets the controllerBeanName for this LayoutForm.


Copyright © 2005-2007 Spring Layout Team. All Rights Reserved.