org.apache.wicket.markup.html.form.validation
Class AbstractFormValidator

java.lang.Object
  extended by org.apache.wicket.behavior.Behavior
      extended by org.apache.wicket.markup.html.form.validation.AbstractFormValidator
All Implemented Interfaces:
java.io.Serializable, IClusterable, IComponentAwareEventSink, IFormValidator, IComponentAwareHeaderContributor
Direct Known Subclasses:
EqualInputValidator

public abstract class AbstractFormValidator
extends Behavior
implements IFormValidator

Base class for IFormValidators.

Author:
Igor Vaynberg (ivaynberg)
See Also:
Serialized Form

Constructor Summary
AbstractFormValidator()
           
 
Method Summary
 void error(FormComponent<?> fc)
          Reports an error against validatable using the map returned by variablesMap()for variable interpolations and message key returned by resourceKey().
 void error(FormComponent<?> fc, java.util.Map<java.lang.String,java.lang.Object> vars)
          Reports an error against the validatable using the given map for variable interpolations and message resource key provided by resourceKey()
 void error(FormComponent<?> fc, java.lang.String resourceKey)
          Reports an error against the validatable using the given resource key
 void error(FormComponent<?> fc, java.lang.String resourceKey, java.util.Map<java.lang.String,java.lang.Object> vars)
          Reports an error against the validatable using the specified resource key and variable map
protected  java.lang.String resourceKey()
          Gets the resource key for validator's error message from the ApplicationSettings class.
protected  java.util.Map<java.lang.String,java.lang.Object> variablesMap()
          Gets the default variables for interpolation.
 
Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, bind, canCallListenerInterface, detach, getStatelessHint, isEnabled, isTemporary, onComponentTag, onConfigure, onEvent, onException, 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 Detail

AbstractFormValidator

public AbstractFormValidator()
Method Detail

error

public void error(FormComponent<?> fc)
Reports an error against validatable using the map returned by variablesMap()for variable interpolations and message key returned by resourceKey().

Parameters:
fc - form component against which the error is reported

error

public void error(FormComponent<?> fc,
                  java.lang.String resourceKey)
Reports an error against the validatable using the given resource key

Parameters:
fc - form component against which the error is reported
resourceKey - The message resource key to use

error

public void error(FormComponent<?> fc,
                  java.util.Map<java.lang.String,java.lang.Object> vars)
Reports an error against the validatable using the given map for variable interpolations and message resource key provided by resourceKey()

Parameters:
fc - form component against which the error is reported
vars - variables for variable interpolation

error

public void error(FormComponent<?> fc,
                  java.lang.String resourceKey,
                  java.util.Map<java.lang.String,java.lang.Object> vars)
Reports an error against the validatable using the specified resource key and variable map

Parameters:
fc - form component against which the error is reported
resourceKey - The message resource key to use
vars - The model for variable interpolation

variablesMap

protected java.util.Map<java.lang.String,java.lang.Object> variablesMap()
Gets the default variables for interpolation. These are for every component:

Returns:
a map with the variables for interpolation

resourceKey

protected java.lang.String resourceKey()
Gets the resource key for validator's error message from the ApplicationSettings class.

Returns:
the resource key based on the form component


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