Class WTimeValidator
- java.lang.Object
-
- 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
-
-
Constructor Summary
Constructors Constructor Description WTimeValidator()Creates a newWTimeValidator.WTimeValidator(java.lang.String format)Creates a newWTimeValidator.WTimeValidator(java.lang.String format, WTime bottom, WTime top)Creates a newWTimeValidator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WTimegetBottom()Returns the lower limit of the valid time range.java.lang.StringgetFormat()Returns the validator current format.java.util.List<java.lang.String>getFormats()Returns the time formats used to parse time strings.WStringgetInvalidNotATimeText()Returns the message displayed when the input is not a time.WStringgetInvalidTooEarlyText()Returns the message displayed when time is too early.WStringgetInvalidTooLateText()Returns the message displayed when time is too late.WStringgetInvalidWrongStepText()Returns the message displayed when the time increment is invalid.java.lang.StringgetJavaScriptValidate()Creates a Javascript object that validates the input.java.time.DurationgetStep()Returns the step (in seconds) between two valid values.WTimegetTop()Returns the upper limit of the valid time range.voidsetBottom(WTime bottom)Sets the lower limit of the valid time range.voidsetFormat(java.lang.String format)Sets the validator format.voidsetFormats(java.util.List<java.lang.String> formats)Sets the time formats used to parse time strings.voidsetInvalidNotATimeText(java.lang.CharSequence text)Sets the message to display when the input is not a time.voidsetInvalidTooEarlyText(java.lang.CharSequence text)Sets the message to display when the time is earlier than bottom.voidsetInvalidTooLateText(java.lang.CharSequence text)Sets the message to display when the time is later than top.voidsetInvalidWrongStepText(java.lang.CharSequence text)Sets the message to display when the time increment is invalid.voidsetStep(java.time.Duration step)Sets the step (in seconds) between two valid values.voidsetTop(WTime top)Sets the upper limit of the valid time range.WValidator.Resultvalidate(java.lang.String input)Validates the given input.-
Methods inherited from class eu.webtoolkit.jwt.WRegExpValidator
getFlags, getInvalidNoMatchText, getRegExp, getRegExpPattern, setFlags, setInvalidNoMatchText, setRegExp
-
Methods inherited from class eu.webtoolkit.jwt.WValidator
getInputFilter, getInvalidBlankText, isMandatory, setInvalidBlankText, setMandatory
-
-
-
-
Constructor Detail
-
WTimeValidator
public WTimeValidator()
Creates a newWTimeValidator.
-
WTimeValidator
public WTimeValidator(java.lang.String format)
Creates a newWTimeValidator.
-
WTimeValidator
public WTimeValidator(java.lang.String format, WTime bottom, WTime top)Creates a newWTimeValidator.The validator will accept only times within the indicated range bottom to top, in the time formate
format
-
-
Method Detail
-
setFormat
public void setFormat(java.lang.String format)
Sets the validator format.
-
getFormat
public java.lang.String getFormat()
Returns the validator current format.- Overrides:
getFormatin 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
public void setBottom(WTime bottom)
Sets the lower limit of the valid time range.The default is a null time constructed using WTime()
-
getBottom
public WTime getBottom()
Returns the lower limit of the valid time range.
-
setTop
public void setTop(WTime top)
Sets the upper limit of the valid time range.The default is a null time constructed using WTime()
-
getTop
public WTime getTop()
Returns the upper limit of the valid time range.
-
setStep
public void setStep(java.time.Duration step)
Sets the step (in seconds) between two valid values.The default value is 0 seconds, meaning any step is accepted.
When the native HTML5 control is used, this sets the step to 1 or 60 automatically, denepding on the format, respectively HH:mm, or HH:mm:ss. Changing this value has no effect.
-
getStep
public java.time.Duration getStep()
Returns the step (in seconds) between two valid values.
-
setInvalidNotATimeText
public void setInvalidNotATimeText(java.lang.CharSequence text)
Sets the message to display when the input is not a time.
-
getInvalidNotATimeText
public WString 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
public WString 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
public WString getInvalidTooLateText()
Returns the message displayed when time is too late.
-
setInvalidWrongStepText
public void setInvalidWrongStepText(java.lang.CharSequence text)
Sets the message to display when the time increment is invalid.
-
getInvalidWrongStepText
public WString getInvalidWrongStepText()
Returns the message displayed when the time increment is invalid.
-
validate
public WValidator.Result validate(java.lang.String input)
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:
validatein classWRegExpValidator
-
getJavaScriptValidate
public java.lang.String getJavaScriptValidate()
Description copied from class:WValidatorCreates 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
messagethat indicates the problem if not valid.
Returns an empty string if the validator does not provide a client-side validation implementationq.
- Overrides:
getJavaScriptValidatein classWRegExpValidator- See Also:
WValidator.getInputFilter()
-
-