Class PasswordInput<T extends PasswordInput<T>>


public class PasswordInput<T extends PasswordInput<T>> extends Input<T>
HTML password input element for secure password entry.

This class extends Input to provide a password field that masks entered characters. It includes text selection support, input completion events, and optional value change tracking to avoid redundant event firing.

Features:

  • Password masking for secure entry
  • Text selection and focus management
  • Input completion event support
  • Text retrieval and validation methods

Usage:

 PasswordInput password = new PasswordInput("password");
 password.setPlaceholder("Enter password");
 password.setMaxLength(128);
 password.setRequired(true);
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • PasswordInput

      public PasswordInput()
      Creates a new PasswordInput with no name.
    • PasswordInput

      public PasswordInput(String name)
      Creates a new PasswordInput with the specified name.
      Parameters:
      name - The name attribute for the password input.
  • Method Details

    • setIgnoreValueNonchanges

      public void setIgnoreValueNonchanges(boolean ignoreValueNonchanges)
      Sets whether to ignore input completion events when the value hasn't changed.

      When true (the default), InputCompleteEvent is only sent when the value actually changed during the focus session. When false, the event is sent on every blur regardless of whether the value changed.

      Parameters:
      ignoreValueNonchanges - true to suppress events when value unchanged, false to fire events on every blur.
    • selectText

      public final void selectText()
      Selects all text in the password input.
    • focusAndSelect

      public final void focusAndSelect()
      Focuses the password input and selects all text.
    • getText

      public final String getText()
      Returns the current text value of the password input.
      Returns:
      The current password text, or null if no value has been set.
    • hasText

      public final boolean hasText()
      Returns whether the password input contains any text.
      Returns:
      true if the input contains non-empty text, false otherwise.
    • inputComplete

      public final void inputComplete()
      Called when input is completed in the password field.

      Dispatches an InputCompleteEvent and calls the onInputComplete() hook.

    • onInputComplete

      protected void onInputComplete()
      Called after an input complete event is dispatched. Subclasses can override this to perform additional processing when input is completed.