Package org.apache.tapestry5
Class ValidationTrackerWrapper
- java.lang.Object
-
- org.apache.tapestry5.ValidationTrackerWrapper
-
- All Implemented Interfaces:
ValidationTracker
public class ValidationTrackerWrapper extends Object implements ValidationTracker
Wrapper around aValidationTracker
that delegates all methods to the wrapped instance. Subclasses will often override specific methods.- Since:
- 5.2.0
-
-
Constructor Summary
Constructors Constructor Description ValidationTrackerWrapper(ValidationTracker delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.List<String>
getUnassociatedErrors()
Returns just the errors that are not associated with any fields.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(String errorMessage)
Records an error message that is not associated with any specific field.void
recordError(Field field, String errorMessage)
Records an error message for a field.void
recordInput(Field field, String input)
Called by a field to record the exact input from the user, prior to any validation.
-
-
-
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 interfaceValidationTracker
-
getError
public String getError(Field field)
Description copied from interface:ValidationTracker
Returns a previously recorded error message.- Specified by:
getError
in interfaceValidationTracker
-
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 interfaceValidationTracker
-
getUnassociatedErrors
public List<String> getUnassociatedErrors()
Description copied from interface:ValidationTracker
Returns just the errors that are not associated with any fields.- Specified by:
getUnassociatedErrors
in interfaceValidationTracker
-
getHasErrors
public boolean getHasErrors()
Description copied from interface:ValidationTracker
Returns true if any field contains an error.- Specified by:
getHasErrors
in interfaceValidationTracker
-
getInput
public String getInput(Field field)
Description copied from interface:ValidationTracker
Returns a previously recorded input value.- Specified by:
getInput
in interfaceValidationTracker
-
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 interfaceValidationTracker
- 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 aValidationException
thrown by aValidator
orTranslator
.- Specified by:
recordError
in interfaceValidationTracker
-
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 interfaceValidationTracker
-
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 interfaceValidationTracker
- Parameters:
field
- the field recording the inputinput
- the value obtained from the forms submission
-
getDelegate
protected ValidationTracker getDelegate()
Returns the instance to which methods are delegated.
-
-