org.apache.tapestry5
Class ValidationTrackerWrapper

java.lang.Object
  extended by org.apache.tapestry5.ValidationTrackerWrapper
All Implemented Interfaces:
ValidationTracker

public class ValidationTrackerWrapper
extends Object
implements ValidationTracker

Wrapper around a ValidationTracker that delegates all methods to the wrapped instance. Subclasses will often override specific methods.

Since:
5.2.0

Constructor Summary
ValidationTrackerWrapper(ValidationTracker delegate)
           
 
Method Summary
 void clear()
          Clears all information stored by the tracker.
protected  ValidationTracker getDelegate()
          Returns the instance to which methods are delegated.
 String getError(Field field)
          Returns a previously recorded error message.
 List<String> getErrors()
          Returns a list of all error messages.
 boolean getHasErrors()
          Returns true if any field contains an error.
 String getInput(Field field)
          Returns a previously recorded input value.
 boolean inError(Field field)
          For a given field, determines if the field is "in error", meaning that an error message has been previously recorded for the field.
 void recordError(Field field, String errorMessage)
          Records an error message for a field.
 void recordError(String errorMessage)
          Records an error message that is not associated with any specific field.
 void recordInput(Field field, String input)
          Called by a field to record the exact input from the user, prior to any validation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationTrackerWrapper

public ValidationTrackerWrapper(ValidationTracker delegate)
Method Detail

clear

public void clear()
Description copied from interface: ValidationTracker
Clears all information stored by the tracker.

Specified by:
clear in interface ValidationTracker

getError

public String getError(Field field)
Description copied from interface: ValidationTracker
Returns a previously recorded error message.

Specified by:
getError in interface ValidationTracker

getErrors

public List<String> getErrors()
Description copied from interface: ValidationTracker
Returns a list of all error messages. The messages are stored in the order that they were added to the tracker, except that unassociated errors (unassociated with any field) are listed first.

Specified by:
getErrors in interface ValidationTracker

getHasErrors

public boolean getHasErrors()
Description copied from interface: ValidationTracker
Returns true if any field contains an error.

Specified by:
getHasErrors in interface ValidationTracker

getInput

public String getInput(Field field)
Description copied from interface: ValidationTracker
Returns a previously recorded input value.

Specified by:
getInput in interface ValidationTracker

inError

public boolean inError(Field field)
Description copied from interface: ValidationTracker
For a given field, determines if the field is "in error", meaning that an error message has been previously recorded for the field.

Specified by:
inError in interface ValidationTracker
Returns:
true if an error message is present

recordError

public void recordError(Field field,
                        String errorMessage)
Description copied from interface: ValidationTracker
Records an error message for a field. The error message is primarily derived from a ValidationException thrown by a Validator or Translator.

Specified by:
recordError in interface ValidationTracker

recordError

public void recordError(String errorMessage)
Description copied from interface: ValidationTracker
Records an error message that is not associated with any specific field. This often reflects some amount of cross-form validation.

Specified by:
recordError in interface ValidationTracker

recordInput

public void recordInput(Field field,
                        String input)
Description copied from interface: ValidationTracker
Called by a field to record the exact input from the user, prior to any validation. If the form is redisplayed (to present errors), the input value will be sent back to the user for correction.

Specified by:
recordInput in interface ValidationTracker
Parameters:
field - the field recording the input
input - the value obtained from the forms submission

getDelegate

protected ValidationTracker getDelegate()
Returns the instance to which methods are delegated.



Copyright © 2003-2012 The Apache Software Foundation.