Class WPasswordEdit


public class WPasswordEdit extends WLineEdit
A password edit.

A password edit is a line edit where the character are hidden.

The widget corresponds to the HTML <input type="password"> tag.

  • Constructor Details

  • Method Details

    • setMaxLength

      public void setMaxLength(int length)
      Description copied from class: WLineEdit
      Specifies the maximum length of text that can be entered.

      A value <= 0 indicates that there is no limit.

      The default value is -1.

      Overrides:
      setMaxLength in class WLineEdit
    • setNativeControl

      public void setNativeControl(boolean nativeControl)
      Changes whether a native HTML5 control is used.

      When enabled the browser's native attribute for password input (<input type="password">) will be used instead of a validator.

      This option is set to false by default. @see WPasswordEdit#isNativeControl()

    • isNativeControl

      public boolean isNativeControl()
      Returns whether a native HTML5 control is used.

      See Also:
    • setMinLength

      public void setMinLength(int length)
      Specifies the minimum length of text that can be entered.

      The default value is 0.

    • getMinLength

      public int getMinLength()
      Returns the minimum length of text that can be entered.

      See Also:
    • setRequired

      public void setRequired(boolean required)
      Specifies if the password is required.

      If true, the password cannot be empty.

      The default value is true.

    • isRequired

      public boolean isRequired()
      Return if the password is required.

      See Also:
    • setPattern

      public void setPattern(String newPattern)
      Specifies the pattern that the password must match.

      The default value is "".

    • getPattern

      public WString getPattern()
      Return the pattern the password must match.

      See Also:
    • setInvalidTooLongText

      public void setInvalidTooLongText(CharSequence text)
      Sets the message to display when the password is too long.

      The default value is "Password too long".

    • getInvalidTooLongText

      public WString getInvalidTooLongText()
      Returns the message displayed when the password is too long.

      See Also:
    • setInvalidTooShortText

      public void setInvalidTooShortText(CharSequence text)
      Sets the message to display when the password is too small.

      The default value is "Password too small".

    • getInvalidTooShortText

      public WString getInvalidTooShortText()
      Returns the message displayed when the password is too small.

      See Also:
    • setInvalidNoMatchText

      public void setInvalidNoMatchText(CharSequence text)
      Sets the message to display when the password does not match the pattern.

      The default value is "Invalid input".

    • getInvalidNoMatchText

      public WString getInvalidNoMatchText()
      Returns the message displayed when the password does not match the pattern.

      See Also:
    • setInvalidBlankText

      public void setInvalidBlankText(CharSequence text)
      Sets the message to display when the password is empty and required.

      The default value is "This field cannot be empty".

    • getInvalidBlankText

      public WString getInvalidBlankText()
      Returns the message displayed when the password is empty and required.

      See Also:
    • setValidator

      public void setValidator(WValidator validator)
      Description copied from class: WFormWidget
      Sets a validator for this field.

      The validator is used to validate the current input.

      The default value is null.

      Overrides:
      setValidator in class WFormWidget
      See Also:
    • getValidator

      public WValidator getValidator()
      Description copied from class: WFormWidget
      Returns the validator.
      Overrides:
      getValidator in class WFormWidget
    • validate

      public ValidationState validate()
      Description copied from class: WFormWidget
      Validates the field.

      Overrides:
      validate in class WLineEdit
      See Also:
    • getType

      protected String getType()
      Overrides:
      getType in class WLineEdit
    • getRealValidator

      protected WValidator getRealValidator()
      Overrides:
      getRealValidator in class WFormWidget