org.apache.wicket.validation.validator
Class DateValidator
java.lang.Object
org.apache.wicket.behavior.Behavior
org.apache.wicket.validation.validator.AbstractRangeValidator<Z,Z>
org.apache.wicket.validation.validator.RangeValidator<Date>
org.apache.wicket.validation.validator.DateValidator
- All Implemented Interfaces:
- Serializable, IComponentAwareEventSink, IComponentAwareHeaderContributor, IClusterable, IValidator<Date>
public class DateValidator
- extends RangeValidator<Date>
Validator for checking if a given date falls within [min,max] range.
If either min or max are null they are not checked.
Resource keys:
DateValidator.exact if min==max
DateValidator.range if both min and max are not null
DateValidator.minimum if max is null
DateValidator.maximum if min is null
Error Message Variables:
name: the id of Component that failed
label: the label of the Component (either comes from
FormComponent.labelModel or resource key <form-id>.<form-component-id>
input: the input value
inputdate: the formatted input value
minimum: the minimum allowed value
maximum: the maximum allowed value
- Author:
- igor
- See Also:
- Serialized Form
| Methods inherited from class org.apache.wicket.behavior.Behavior |
afterRender, beforeRender, bind, canCallListenerInterface, detach, getStatelessHint, isEnabled, isTemporary, onComponentTag, onConfigure, onEvent, onException, onRemove, renderHead, unbind |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DateValidator
public DateValidator(Date minimum,
Date maximum,
String format)
- Constructor that sets the minimum and maximum date values and a custom date formating.
- Parameters:
minimum - the minimum datemaximum - the maximum dateformat - The format string used to format the date with SimpleDateFormat
DateValidator
public DateValidator(Date minimum,
Date maximum)
- Constructor that sets the minimum and maximum date values.
- Parameters:
minimum - the minimum datemaximum - the maximum date
DateValidator
protected DateValidator()
- Constructor used for subclasses who want to set the range using
AbstractRangeValidator.setRange(Comparable, Comparable)
range
public static DateValidator range(Date minimum,
Date maximum)
- Parameters:
minimum - the minimum Datemaximum - the maximum Date
- Returns:
- a
DateValidator that validates if a date is between (inclusive) a minimum and
maximum
range
public static DateValidator range(Date minimum,
Date maximum,
String format)
- Parameters:
minimum - the minimum Datemaximum - the maximum Dateformat - The format string used to format the date with SimpleDateFormat
- Returns:
- a
DateValidator that validates if a date is between (inclusive) a minimum and
maximum
minimum
public static DateValidator minimum(Date minimum)
- Parameters:
minimum - the minimum Date
- Returns:
- a
DateValidator that validates if a date is after or equal to a minimum date
minimum
public static DateValidator minimum(Date minimum,
String format)
- Parameters:
minimum - the minimum Dateformat - The format string used to format the date with SimpleDateFormat
- Returns:
- a
DateValidator that validates if a date is after or equal to a minimum date
maximum
public static DateValidator maximum(Date maximum)
- Parameters:
maximum - the maximum Date
- Returns:
- a
DateValidator that validates if a date is before or equal to a maximum date
maximum
public static DateValidator maximum(Date maximum,
String format)
- Parameters:
maximum - the maximum Dateformat - The format string used to format the date with SimpleDateFormat
- Returns:
- a
DateValidator that validates if a date is before or equal to a maximum date
decorate
protected ValidationError decorate(ValidationError error,
IValidatable<Date> validatable)
- Description copied from class:
AbstractRangeValidator
- Allows subclasses to decorate reported errors
- Overrides:
decorate in class RangeValidator<Date>
- Returns:
- decorated error
Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.