net.sf.springlayout.web.layout
Class LayoutFieldDefinition

java.lang.Object
  extended by net.sf.springlayout.web.layout.LayoutFieldDefinition
All Implemented Interfaces:
FieldDefinition

public class LayoutFieldDefinition
extends java.lang.Object
implements FieldDefinition

Defines a field for a panel providing information such as it's name, whether it's mandatory and an optional array of validation rules. Validation is called via the LayoutPanelFormGroup from controller.

Author:
Rob Monie, Adam Boas

Constructor Summary
LayoutFieldDefinition()
           
LayoutFieldDefinition(FieldDefinition defaultField)
           
 
Method Summary
 java.util.List getAlternateFieldKeysForError()
          Gets the alternateFieldKeysForError for this LayoutFieldDefinition.
 java.lang.String getFieldKey()
           
 Condition getMandatoryCondition()
          Retrieves all mandatory conditions which this Field definition contains.
 int getMaxLength()
          looks inside validation rules and returns maxLength if such a validation rule is defined
 java.util.List getValidationRules()
           
 boolean isFailedMandatory(org.springframework.beans.BeanWrapper wrappedObject, java.lang.String fieldId)
           
 boolean isMandatory()
           
 boolean isMandatory(org.springframework.beans.BeanWrapper wrappedObject, java.lang.String fieldId)
          is the current field status mandatory
 void setAlternateFieldKeysForError(java.util.List dependentValidationFieldKeys)
          Retrieves the alternateFieldKeysForError for this LayoutFieldDefinition.
 void setFieldKey(java.lang.String fieldKey)
           
 void setMandatory(boolean mandatory)
           
 void setMandatoryCondition(Condition mandatoryCondition)
           
 void setValidationRules(java.util.List validationRules)
           
 void validate(javax.servlet.http.HttpServletRequest request, NestedPathResolver resolver, org.springframework.beans.BeanWrapper wrapper, org.springframework.validation.Errors errors)
          Validates a field based on whether it is mandatory, and then iterates through any custom validators defined for the field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutFieldDefinition

public LayoutFieldDefinition()

LayoutFieldDefinition

public LayoutFieldDefinition(FieldDefinition defaultField)
Method Detail

getFieldKey

public java.lang.String getFieldKey()
Specified by:
getFieldKey in interface FieldDefinition
Returns:
Returns the fieldKey.

setFieldKey

public void setFieldKey(java.lang.String fieldKey)
Specified by:
setFieldKey in interface FieldDefinition
Parameters:
fieldKey - The fieldKey to set.

isMandatory

public boolean isMandatory()
Specified by:
isMandatory in interface FieldDefinition
Returns:
if the field is currently mandatory.

setMandatory

public void setMandatory(boolean mandatory)
Specified by:
setMandatory in interface FieldDefinition
Parameters:
mandatory - The mandatory to set.

setMandatoryCondition

public void setMandatoryCondition(Condition mandatoryCondition)
Specified by:
setMandatoryCondition in interface FieldDefinition

getMandatoryCondition

public Condition getMandatoryCondition()
Description copied from interface: FieldDefinition
Retrieves all mandatory conditions which this Field definition contains.

Specified by:
getMandatoryCondition in interface FieldDefinition
Returns:
mandatory condition which this Field definition contains.

getValidationRules

public java.util.List getValidationRules()
Specified by:
getValidationRules in interface FieldDefinition
Returns:
Returns the validationRules.

setValidationRules

public void setValidationRules(java.util.List validationRules)
Specified by:
setValidationRules in interface FieldDefinition
Parameters:
validationRules - The validationRules to set.

getAlternateFieldKeysForError

public java.util.List getAlternateFieldKeysForError()
Description copied from interface: FieldDefinition
Gets the alternateFieldKeysForError for this LayoutFieldDefinition.

Specified by:
getAlternateFieldKeysForError in interface FieldDefinition

setAlternateFieldKeysForError

public void setAlternateFieldKeysForError(java.util.List dependentValidationFieldKeys)
Description copied from interface: FieldDefinition
Retrieves the alternateFieldKeysForError for this LayoutFieldDefinition.

Specified by:
setAlternateFieldKeysForError in interface FieldDefinition

getMaxLength

public int getMaxLength()
Description copied from interface: FieldDefinition
looks inside validation rules and returns maxLength if such a validation rule is defined

Specified by:
getMaxLength in interface FieldDefinition
Returns:

validate

public void validate(javax.servlet.http.HttpServletRequest request,
                     NestedPathResolver resolver,
                     org.springframework.beans.BeanWrapper wrapper,
                     org.springframework.validation.Errors errors)
Validates a field based on whether it is mandatory, and then iterates through any custom validators defined for the field. Validation occurs on all possible concrete paths represented by the field definition

Specified by:
validate in interface FieldDefinition
Parameters:
request -
obj -
errors -
See Also:
net.sf.springlayout.web.panel.FieldDefinition#validate(javax.servlet.http.HttpServletRequest, java.lang.Object, org.springframework.validation.Errors)

isFailedMandatory

public boolean isFailedMandatory(org.springframework.beans.BeanWrapper wrappedObject,
                                 java.lang.String fieldId)

isMandatory

public boolean isMandatory(org.springframework.beans.BeanWrapper wrappedObject,
                           java.lang.String fieldId)
is the current field status mandatory

Returns:


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