Package org.apache.tapestry5
Interface ValidationTracker
-
- All Known Implementing Classes:
ValidationTrackerImpl
,ValidationTrackerWrapper
public interface ValidationTracker
Tracks information related to user input validations. This information is:- The input values provided by the user.
- Any validation exceptions associated with input fields.
Field
interfaces) and fields. It is a one to many relationship, because each field may be called upon to render itself multiple times within a request, because ofLoop
or other similar components. Internally, the tracker indexes its information in terms of the control name for each rendering of the component (the mechanics of Tapestry ensures that this is unique within the form). Validation trackers must be serializable, as they will almost always be stored into the HttpSession. Trackers are used by only a single form within a single page; they are not threadsafe.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Clears all information stored by the tracker.getError(Field field)
Returns a previously recorded error message.<>
getErrors()
Returns a list of all error messages.boolean
getHasErrors()
Returns true if any field contains an error.getInput(Field field)
Returns a previously recorded input value.<>
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
errorMessage)
Records an error message that is not associated with any specific field.void
recordError(Field field, errorMessage)
Records an error message for a field.void
recordInput(Field field, input)
Called by a field to record the exact input from the user, prior to any validation.
-
-
-
Method Detail
-
recordInput
void recordInput(Field field, input)
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.- Parameters:
field
- the field recording the inputinput
- the value obtained from the forms submission
-
recordError
void recordError(Field field, errorMessage)
Records an error message for a field. The error message is primarily derived from aValidationException
thrown by aValidator
orTranslator
.- Parameters:
field
-errorMessage
-
-
recordError
void errorMessage)
Records an error message that is not associated with any specific field. This often reflects some amount of cross-form validation.- Parameters:
errorMessage
-
-
inError
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.- Parameters:
field
-- Returns:
- true if an error message is present
-
getHasErrors
boolean getHasErrors()
Returns true if any field contains an error.
-
getErrors
<> getErrors()
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.
-
getUnassociatedErrors
<> getUnassociatedErrors()
Returns just the errors that are not associated with any fields.- Since:
- 5.4
-
clear
void clear()
Clears all information stored by the tracker.
-
-