|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WValidator
eu.webtoolkit.jwt.WDateValidator
public class WDateValidator
A validator for date input.
This validator accepts input in the given date format, and optionally checks if the date is within a given range.
The format string used for validating user input are the same as those used
by WDate#fromString().
The strings used in the WDateValidator can be translated by
overriding the default values for the following localization keys:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WValidator |
|---|
WValidator.Result, WValidator.State |
| Constructor Summary | |
|---|---|
WDateValidator()
Creates a date validator. |
|
WDateValidator(java.lang.String format)
Creates a date validator. |
|
WDateValidator(java.lang.String format,
WDate bottom,
WDate top)
Creates a date validator. |
|
WDateValidator(java.lang.String format,
WDate bottom,
WDate top,
WObject parent)
Creates a date validator. |
|
WDateValidator(java.lang.String format,
WObject parent)
Creates a date validator. |
|
WDateValidator(WDate bottom,
WDate top)
Creates a date validator. |
|
WDateValidator(WDate bottom,
WDate top,
WObject parent)
Creates a date validator. |
|
WDateValidator(WObject parent)
Creates a date validator. |
|
| Method Summary | |
|---|---|
WDate |
getBottom()
Returns the bottom date of the valid range. |
java.lang.String |
getFormat()
Returns the format string used to parse date strings. |
java.util.List<java.lang.String> |
getFormats()
Returns the date formats used to parse date strings. |
WString |
getInvalidNotADateText()
Returns the message displayed when the input is not a date. |
WString |
getInvalidTooEarlyText()
Returns the message displayed when date is too early. |
WString |
getInvalidTooLateText()
Returns the message displayed when the date is too late. |
java.lang.String |
getJavaScriptValidate()
Creates a Javascript object that validates the input. |
WDate |
getTop()
Returns the top date of the valid range. |
void |
setBottom(WDate bottom)
Sets the bottom of the valid date range. |
void |
setFormat(java.lang.String format)
Sets the date format used to parse date strings. |
void |
setFormats(java.util.List<java.lang.String> formats)
Sets the date formats used to parse date strings. |
void |
setInvalidNotADateText(java.lang.CharSequence text)
Sets the message to display when the input is not a date. |
void |
setInvalidTooEarlyText(java.lang.CharSequence text)
Sets the message to display when the date is earlier than bottom. |
void |
setInvalidTooLateText(java.lang.CharSequence text)
Sets the message to display when the date is later than top. |
void |
setTop(WDate top)
Sets the top of the valid date range. |
WValidator.Result |
validate(java.lang.String input)
Validates the given input. |
| Methods inherited from class eu.webtoolkit.jwt.WValidator |
|---|
fixup, getInputFilter, getInvalidBlankText, isMandatory, setInvalidBlankText, setMandatory |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
addChild, getId, getObjectName, remove, setObjectName, tr |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WDateValidator(WObject parent)
The validator will accept any date of the format 'yyyy-MM-dd'.
public WDateValidator()
Calls this((WObject)null)
public WDateValidator(WDate bottom,
WDate top,
WObject parent)
The validator will accept dates in the indicated range in the format 'yyyy-MM-dd'.
public WDateValidator(WDate bottom,
WDate top)
Calls this(bottom, top, (WObject)null)
public WDateValidator(java.lang.String format,
WObject parent)
The validator will accept dates in the date format format.
The syntax for format is as in
WDate#fromString()
public WDateValidator(java.lang.String format)
Calls this(format,
(WObject)null)
public WDateValidator(java.lang.String format,
WDate bottom,
WDate top,
WObject parent)
The validator will accept only dates within the indicated range
bottom to top, in the date format format.
The syntax for format is as in
WDate#fromString()
public WDateValidator(java.lang.String format,
WDate bottom,
WDate top)
Calls
this(format, bottom, top, (WObject)null)
| Method Detail |
|---|
public void setBottom(WDate bottom)
The default is a null date constructed using WDate().
public WDate getBottom()
public void setTop(WDate top)
The default is a null date constructed using WDate().
public WDate getTop()
public void setFormat(java.lang.String format)
WDate.fromString(String s)public java.lang.String getFormat()
setFormat(String format)public void setFormats(java.util.List<java.lang.String> formats)
public java.util.List<java.lang.String> getFormats()
public WValidator.Result validate(java.lang.String input)
The input is considered valid only when it is blank for a non-mandatory field, or represents a date in the given format, and within the valid range.
validate in class WValidatorpublic void setInvalidNotADateText(java.lang.CharSequence text)
The default message is "The date must be of the format {1}", with as first argument the format string.
public WString getInvalidNotADateText()
setInvalidNotADateText(CharSequence text)public void setInvalidTooEarlyText(java.lang.CharSequence text)
The default message is "The date must be between {1} and {2}" or "The date must be after {1}".
public WString getInvalidTooEarlyText()
setInvalidTooEarlyText(CharSequence text)public void setInvalidTooLateText(java.lang.CharSequence text)
Depending on whether getBottom() and
getTop() are defined, the default message
is "The date must be between {1} and {2}" or "The date
must be before {2}".
public WString getInvalidTooLateText()
setInvalidTooLateText(CharSequence text)public java.lang.String getJavaScriptValidate()
WValidator
The JavaScript expression should evaluate to an object which contains a
validate(text) function, which returns an object that
contains the following two fields:
message that indicates the problem if not valid.Returns an empty string if the validator does not provide a client-side validation implementationq.
Note: The signature and contract changed changed in JWt 3.1.9.
getJavaScriptValidate in class WValidatorWValidator.getInputFilter()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||