Class WTimeValidator

    • Constructor Detail

      • WTimeValidator

        public WTimeValidator()
        Creates a new WTimeValidator.
      • WTimeValidator

        public WTimeValidator​(java.lang.String format)
        Creates a new WTimeValidator.
      • WTimeValidator

        public WTimeValidator​(java.lang.String format,
                              WTime bottom,
                              WTime top)
        Creates a new WTimeValidator.

        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:
        getFormat in class WValidator
      • 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:
        validate in class WRegExpValidator
      • 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.

        Overrides:
        getJavaScriptValidate in class WRegExpValidator
        See Also:
        WValidator.getInputFilter()