Class WTimeValidator


public class WTimeValidator
extends WRegExpValidator
A time validator.

See Also:
WTimeEdit, WTime
  • Constructor Details

  • 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 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.
    • 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.
    • 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.

      Note: The signature and contract changed changed in JWt 3.1.9.

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