org.apache.tapestry.valid
Class FieldTracking

java.lang.Object
  extended by org.apache.tapestry.valid.FieldTracking
All Implemented Interfaces:
Serializable, IFieldTracking

public class FieldTracking
extends Object
implements IFieldTracking, Serializable

Default implementation of IFieldTracking.

Since:
1.0.8
Author:
Howard Lewis Ship
See Also:
Serialized Form

Method Summary
 IFormComponent getComponent()
          Returns the field component.
 ValidationConstraint getConstraint()
          Returns the validation constraint that was violated by the input.
 IRender getErrorRenderer()
          Returns an object that will render the error message.
 String getFieldName()
          Returns the name of the field, that is, the name assigned by the form (this will differ from the component's id when any kind of looping operation is in effect).
 String getInput()
          Returns the invalid input recorded for the field.
 boolean getRenderError()
          Whether or not any errors found should cause field decoration / error renderers to render.
 boolean isInError()
          Returns true if the field is in error (that is, if it has an error message renderer.
 void setConstraint(ValidationConstraint constraint)
           
 void setErrorRenderer(IRender value)
           
 void setInput(String value)
           
 void setRenderError(boolean value)
          Sets whether or not to render errors for this tracking.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getComponent

public IFormComponent getComponent()
Description copied from interface: IFieldTracking
Returns the field component. This may return null if the error is not associated with any particular field. Note: may return null after the field tracking object is serialized and deserialized (the underlying component reference is transient); this metehod is primarily used for testing.

Specified by:
getComponent in interface IFieldTracking
Returns:
The associated component, or null if not specific to a component.

getErrorRenderer

public IRender getErrorRenderer()
Description copied from interface: IFieldTracking
Returns an object that will render the error message. The renderer must implement a simple toString() that does not produce markup, but is a simple message.

Specified by:
getErrorRenderer in interface IFieldTracking
Returns:
The IRender responsible for rendering the error, or null if none is set.
See Also:
ValidatorException.ValidatorException(String, IRender, ValidationConstraint)

setErrorRenderer

public void setErrorRenderer(IRender value)

getInput

public String getInput()
Description copied from interface: IFieldTracking
Returns the invalid input recorded for the field. This is stored so that, on a subsequent render, the smae invalid input can be presented to the client to be corrected.

Specified by:
getInput in interface IFieldTracking
Returns:
The original input value.

setInput

public void setInput(String value)

getFieldName

public String getFieldName()
Description copied from interface: IFieldTracking
Returns the name of the field, that is, the name assigned by the form (this will differ from the component's id when any kind of looping operation is in effect).

Specified by:
getFieldName in interface IFieldTracking
Returns:
The name of the field within the form.

getConstraint

public ValidationConstraint getConstraint()
Description copied from interface: IFieldTracking
Returns the validation constraint that was violated by the input. This may be null if the constraint isn't known.

Specified by:
getConstraint in interface IFieldTracking
Returns:
The associated ValidationConstraint that caused the field error.

setConstraint

public void setConstraint(ValidationConstraint constraint)

isInError

public boolean isInError()
Description copied from interface: IFieldTracking
Returns true if the field is in error (that is, if it has an error message renderer.

Specified by:
isInError in interface IFieldTracking
Returns:
Whether or not field is in error.
Since:
3.0 *

getRenderError

public boolean getRenderError()
Description copied from interface: IFieldTracking
Whether or not any errors found should cause field decoration / error renderers to render. This is set to false on form submissions (such as a refresh submit) where validation shouldn't cause errors to be rendererd.

Specified by:
getRenderError in interface IFieldTracking
Returns:
Whether or not to render errors, default is true.

setRenderError

public void setRenderError(boolean value)
Description copied from interface: IFieldTracking
Sets whether or not to render errors for this tracking. Gets set to false on form refresh submits.

Specified by:
setRenderError in interface IFieldTracking
Parameters:
value - Whether or not to render errors.


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.