wicket.markup.html.form.validation
Class DateValidator

java.lang.Object
  extended by wicket.markup.html.form.validation.AbstractValidator
      extended by wicket.markup.html.form.validation.DateValidator
All Implemented Interfaces:
java.io.Serializable, IValidator

public abstract class DateValidator
extends AbstractValidator

A validator for dates that can be used for subclassing or use one of the static factory methods to get the default date validators as range, maximum or minimum.

Author:
Jonathan Locke, Johan Compagner
See Also:
Serialized Form

Constructor Summary
DateValidator()
           
 
Method Summary
static DateValidator maximum(java.util.Date maximum)
          Gets a Date maximum validator to check if a date is smaller then the given maximum value.
static DateValidator minimum(java.util.Date minimum)
          Gets a Date minimum validator to check if a date is greater then the given minimum value.
abstract  void onValidate(FormComponent formComponent, java.util.Date value)
          Subclasses should override this method to validate the string value for a component.
static DateValidator range(java.util.Date minimum, java.util.Date maximum)
          Gets a Date range validator to check if the date is between the minimum and maximum dates.
 void validate(FormComponent formComponent)
           Instead of subclassing IValidator, you should use one of the existing validators, which cover a huge number of cases, or if none satisfies your need, subclass one of the Type validators like StringValidator, NumberValidator or DateValidator
 
Methods inherited from class wicket.markup.html.form.validation.AbstractValidator
error, error, error, error, messageModel, resourceKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateValidator

public DateValidator()
Method Detail

range

public static DateValidator range(java.util.Date minimum,
                                  java.util.Date maximum)
Gets a Date range validator to check if the date is between the minimum and maximum dates. If that is not the case then an error message will be generated with the key "DateValidator.range" and the messages keys that can be used are:

Parameters:
minimum - The minimum date.
maximum - The maximum date.
Returns:
The DateValidator

minimum

public static DateValidator minimum(java.util.Date minimum)
Gets a Date minimum validator to check if a date is greater then the given minimum value. If that is not the case then an error message will be generated with the key "DateValidator.minimum" and the messages keys that can be used are:

Parameters:
minimum - The minimum length of the string.
Returns:
The DateValidator

maximum

public static DateValidator maximum(java.util.Date maximum)
Gets a Date maximum validator to check if a date is smaller then the given maximum value. If that is not the case then an error message will be generated with the key "DateValidator.maximum" and the messages keys that can be used are:

Parameters:
maximum - The maximum date.
Returns:
The DateValidator

validate

public void validate(FormComponent formComponent)
Description copied from interface: IValidator

Instead of subclassing IValidator, you should use one of the existing validators, which cover a huge number of cases, or if none satisfies your need, subclass one of the Type validators like StringValidator, NumberValidator or DateValidator

Validates the given input. The input corresponds to the input from the request for a component.

Parameters:
formComponent - Component to validate
See Also:
IValidator.validate(wicket.markup.html.form.FormComponent)

onValidate

public abstract void onValidate(FormComponent formComponent,
                                java.util.Date value)
Subclasses should override this method to validate the string value for a component.

Parameters:
formComponent - form component
value - The string value to validate


Copyright © 2004-2007 Wicket developers. All Rights Reserved.