Class WTimeValidator


public class WTimeValidator extends WRegExpValidator
A time validator.

See Also:
  • Constructor Details

    • WTimeValidator

      public WTimeValidator()
      Creates a new WTimeValidator.
    • WTimeValidator

      public WTimeValidator(String format)
      Creates a new WTimeValidator.
    • WTimeValidator

      public WTimeValidator(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 Details

    • setFormat

      public void setFormat(String format)
      Sets the validator format.
    • getFormat

      public String getFormat()
      Returns the validator current format.
      Overrides:
      getFormat in class WValidator
    • setFormats

      public void setFormats(List<String> formats)
      Sets the time formats used to parse time strings.
    • getFormats

      public List<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(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(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(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(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 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: