Package eu.webtoolkit.jwt
Class WTimeValidator
java.lang.Object
eu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WValidator
eu.webtoolkit.jwt.WRegExpValidator
eu.webtoolkit.jwt.WTimeValidator
public class WTimeValidator extends WRegExpValidator
A time validator.
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WValidator
WValidator.Result, WValidator.State
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Constructor Summary
Constructors Constructor Description WTimeValidator()
Creates a newWTimeValidator
.WTimeValidator(WObject parent)
Creates a newWTimeValidator
.WTimeValidator(java.lang.String format)
Creates a newWTimeValidator
.WTimeValidator(java.lang.String format, WObject parent)
Creates a newWTimeValidator
.WTimeValidator(java.lang.String format, WTime bottom, WTime top)
Creates a newWTimeValidator
.WTimeValidator(java.lang.String format, WTime bottom, WTime top, WObject parent)
Creates a newWTimeValidator
. -
Method Summary
Modifier and Type Method Description WTime
getBottom()
Returns the lower limit of the valid time range.java.lang.String
getFormat()
Returns the validator current format.java.util.List<java.lang.String>
getFormats()
Returns the time formats used to parse time strings.WString
getInvalidNotATimeText()
Returns the message displayed when the input is not a time.WString
getInvalidTooEarlyText()
Returns the message displayed when time is too early.WString
getInvalidTooLateText()
Returns the message displayed when time is too late.java.lang.String
getJavaScriptValidate()
Creates a Javascript object that validates the input.WTime
getTop()
Returns the upper limit of the valid time range.void
setBottom(WTime bottom)
Sets the lower limit of the valid time range.void
setFormat(java.lang.String format)
Sets the validator format.void
setFormats(java.util.List<java.lang.String> formats)
Sets the time formats used to parse time strings.void
setInvalidNotATimeText(java.lang.CharSequence text)
Sets the message to display when the input is not a time.void
setInvalidTooEarlyText(java.lang.CharSequence text)
Sets the message to display when the time is earlier than bottom.void
setInvalidTooLateText(java.lang.CharSequence text)
Sets the message to display when the time is later than top.void
setTop(WTime top)
Sets the upper limit of the valid time range.WValidator.Result
validate(java.lang.String input)
Validates the given input.Methods inherited from class eu.webtoolkit.jwt.WRegExpValidator
getFlags, getInvalidNoMatchText, getRegExp, setFlags, setInvalidNoMatchText, setNoMatchText, setRegExp
Methods inherited from class eu.webtoolkit.jwt.WValidator
getInputFilter, getInvalidBlankText, isMandatory, setInvalidBlankText, setMandatory
Methods inherited from class eu.webtoolkit.jwt.WObject
addChild, getId, getObjectName, remove, setFormData, setObjectName, tr
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
WTimeValidator
Creates a newWTimeValidator
. -
WTimeValidator
public WTimeValidator()Creates a newWTimeValidator
.Calls
this((WObject)null)
-
WTimeValidator
Creates a newWTimeValidator
. -
WTimeValidator
public WTimeValidator(java.lang.String format)Creates a newWTimeValidator
. -
WTimeValidator
Creates a newWTimeValidator
.The validator will accept only times within the indicated range bottom to top, in the time formate
format
-
WTimeValidator
Creates a newWTimeValidator
.
-
-
Method Details
-
setFormat
public void setFormat(java.lang.String format)Sets the validator format. -
getFormat
public java.lang.String getFormat()Returns the validator current format.- Overrides:
getFormat
in classWValidator
-
setFormats
public void setFormats(java.util.List<java.lang.String> formats)Sets the time formats used to parse time strings. -
getFormats
public java.util.List<java.lang.String> getFormats()Returns the time formats used to parse time strings. -
setBottom
Sets the lower limit of the valid time range.The default is a null time constructed using WTime()
-
getBottom
Returns the lower limit of the valid time range. -
setTop
Sets the upper limit of the valid time range.The default is a null time constructed using WTime()
-
getTop
Returns the upper limit of the valid time range. -
setInvalidNotATimeText
public void setInvalidNotATimeText(java.lang.CharSequence text)Sets the message to display when the input is not a time. -
getInvalidNotATimeText
Returns the message displayed when the input is not a time. -
setInvalidTooEarlyText
public void setInvalidTooEarlyText(java.lang.CharSequence text)Sets the message to display when the time is earlier than bottom. -
getInvalidTooEarlyText
Returns the message displayed when time is too early. -
setInvalidTooLateText
public void setInvalidTooLateText(java.lang.CharSequence text)Sets the message to display when the time is later than top. -
getInvalidTooLateText
Returns the message displayed when time is too late. -
validate
Validates the given input.The input is considered valid only when it is blank for a non-mandatory field, or represents a time in the given format, and within the valid range.
- Overrides:
validate
in classWRegExpValidator
-
getJavaScriptValidate
public java.lang.String getJavaScriptValidate()Description copied from class:WValidator
Creates a Javascript object that validates the input.The JavaScript expression should evaluate to an object which contains a
validate(text)
function, which returns an object that contains the following two fields:- fields: a boolean valid,
- a
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.
- Overrides:
getJavaScriptValidate
in classWRegExpValidator
- See Also:
WValidator.getInputFilter()
-