Module org.apache.wicket.core
Class AbstractFormValidator
java.lang.Object
org.apache.wicket.behavior.Behavior
org.apache.wicket.markup.html.form.validation.AbstractFormValidator
- All Implemented Interfaces:
Serializable
,IComponentAwareEventSink
,IFormValidator
,IComponentAwareHeaderContributor
,IClusterable
- Direct Known Subclasses:
EqualInputValidator
Base class for
IFormValidator
s.- Author:
- Igor Vaynberg (ivaynberg)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Can be bound toForm
s only.void
error
(FormComponent<?> fc) Reports an error against validatable using the map returned byvariablesMap()
for variable interpolations and message key returned byresourceKey()
.void
error
(FormComponent<?> fc, String resourceKey) Reports an error against the validatable using the given resource keyvoid
Reports an error against the validatable using the specified resource key and variable mapvoid
error
(FormComponent<?> fc, Map<String, Object> vars) Reports an error against the validatable using the given map for variable interpolations and message resource key provided byresourceKey()
protected String
Gets the resource key for validator's error message from the ApplicationSettings class.Gets the default variables for interpolation.Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onComponentTag, onConfigure, onEvent, onException, onRemove, onTag, renderHead, unbind
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.wicket.markup.html.form.validation.IFormValidator
getDependentFormComponents, validate
-
Constructor Details
-
AbstractFormValidator
public AbstractFormValidator()
-
-
Method Details
-
bind
Can be bound toForm
s only.- Overrides:
bind
in classBehavior
- Parameters:
component
- the component to bind to- Throws:
WicketRuntimeException
- if component is not a form
-
error
Reports an error against validatable using the map returned byvariablesMap()
for variable interpolations and message key returned byresourceKey()
.- Parameters:
fc
- form component against which the error is reported
-
error
Reports an error against the validatable using the given resource key- Parameters:
fc
- form component against which the error is reportedresourceKey
- The message resource key to use
-
error
Reports an error against the validatable using the given map for variable interpolations and message resource key provided byresourceKey()
- Parameters:
fc
- form component against which the error is reportedvars
- variables for variable interpolation
-
error
Reports an error against the validatable using the specified resource key and variable map- Parameters:
fc
- form component against which the error is reportedresourceKey
- The message resource key to usevars
- The model for variable interpolation
-
variablesMap
Gets the default variables for interpolation. These are for every component:- ${input(n)}: the user's input
- ${name(n)}: the name of the component
- ${label(n)}: the label of the component - either comes from FormComponent.labelModel or resource key [form-id].[form-component-id] in that order
- Returns:
- a map with the variables for interpolation
-
resourceKey
Gets the resource key for validator's error message from the ApplicationSettings class.- Returns:
- the resource key based on the form component
-