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>
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==maxDateValidator.range
if both min and max are notnull
DateValidator.minimum
if max isnull
DateValidator.maximum
if min isnull
Error Message Variables:
name
: the id ofComponent
that failedlabel
: the label of theComponent
(either comes fromFormComponent.labelModel
or resource key<form-id>.<form-component-id>
input
: the input valueinputdate
: the formatted input valueminimum
: the minimum allowed valuemaximum
: the maximum allowed value
- Author:
- igor
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.wicket.validation.validator.AbstractRangeValidator
AbstractRangeValidator.Mode
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor used for subclasses who want to set the range usingAbstractRangeValidator.setRange(Comparable, Comparable)
DateValidator
(Date minimum, Date maximum) Constructor that sets the minimum and maximum date values.DateValidator
(Date minimum, Date maximum, String format) Constructor that sets the minimum and maximum date values and a custom date formating. -
Method Summary
Modifier and TypeMethodDescriptionprotected IValidationError
decorate
(IValidationError error, IValidatable<Date> validatable) Allows subclasses to decorate reported errorsstatic DateValidator
static DateValidator
static DateValidator
static DateValidator
static DateValidator
static DateValidator
Methods inherited from class org.apache.wicket.validation.validator.RangeValidator
getValue, maximum, minimum, range
Methods inherited from class org.apache.wicket.validation.validator.AbstractRangeValidator
getMaximum, getMinimum, getMode, setRange, validate
Methods inherited from class org.apache.wicket.behavior.Behavior
afterRender, beforeRender, bind, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onComponentTag, onConfigure, onEvent, onException, onRemove, onTag, renderHead, unbind
-
Constructor Details
-
DateValidator
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
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 usingAbstractRangeValidator.setRange(Comparable, Comparable)
-
-
Method Details
-
range
- Parameters:
minimum
- the minimumDate
maximum
- the maximumDate
- Returns:
- a
DateValidator
that validates if a date is between (inclusive) a minimum and maximum
-
range
- Parameters:
minimum
- the minimumDate
maximum
- the maximumDate
format
- 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
- Parameters:
minimum
- the minimumDate
- Returns:
- a
DateValidator
that validates if a date is after or equal to a minimum date
-
minimum
- Parameters:
minimum
- the minimumDate
format
- 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
- Parameters:
maximum
- the maximumDate
- Returns:
- a
DateValidator
that validates if a date is before or equal to a maximum date
-
maximum
- Parameters:
maximum
- the maximumDate
format
- 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
Description copied from class:AbstractRangeValidator
Allows subclasses to decorate reported errors- Overrides:
decorate
in classAbstractRangeValidator<Date,
Date> - Returns:
- decorated error
-