Class PasswordAuthenticationPanel

All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, io.clogr.Clogged, ArrangeContainer, Box, Component, CompositeComponent, Container, LayoutComponent, Panel, Displayable, InfoModel, LabelModel, Model, PresentationModel, DepictedObject, Iterable<Component>

public class PasswordAuthenticationPanel extends ArrangePanel
Panel to gather password authentication information and optionally verify the password. This panel defaults to not verifying the password.
Author:
Garret Wilson
  • Field Details

    • PASSWORD_VERIFIED_PROPERTY

      public static final String PASSWORD_VERIFIED_PROPERTY
      The bound property of the password verification status.
  • Constructor Details

    • PasswordAuthenticationPanel

      public PasswordAuthenticationPanel()
      Default constructor with a default vertical flow layout.
    • PasswordAuthenticationPanel

      public PasswordAuthenticationPanel(Layout<?> layout)
      Layout constructor.
      Parameters:
      layout - The layout definition for the container.
      Throws:
      NullPointerException - if the given layout is null.
  • Method Details

    • isPasswordVerified

      public boolean isPasswordVerified()
      Returns:
      Whether password verification is required, resulting in a separate password verification text input.
    • setPasswordVerified

      public void setPasswordVerified(boolean newPasswordVerified)
      Sets whether password verification is required This is a bound property of type Boolean. This method unconditionally clears the password verification control.
      Parameters:
      newPasswordVerified - Whether password verification is required, resulting in a separate password verification text input.
      See Also:
    • getUsername

      public String getUsername()
      Returns:
      The current username entered, or null if there is no username entered.
    • setUsername

      public void setUsername(String username) throws PropertyVetoException
      Sets the username shown in the panel.
      Parameters:
      username - The username to show.
      Throws:
      PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.
    • getUsernameValidator

      public Validator<String> getUsernameValidator()
      Returns:
      The validator for the username, or null if no validator is installed.
    • setUsernameValidator

      public void setUsernameValidator(Validator<String> newValidator)
      Sets the username validator.
      Parameters:
      newValidator - The validator for the username, or null if no validator should be used.
    • getPassword

      public char[] getPassword()
      Returns:
      The current password entered, or null if there is no password entered.
    • setPassword

      public void setPassword(char[] password) throws PropertyVetoException
      Sets the password shown in the panel.
      Parameters:
      password - The password to show.
      Throws:
      PropertyVetoException - if the provided value is not valid or the change has otherwise been vetoed.
    • getPasswordValidator

      public Validator<char[]> getPasswordValidator()
      Returns:
      The validator for the password, or null if no validator is installed.
    • setPasswordValidator

      public void setPasswordValidator(Validator<char[]> newValidator)
      Sets the password validator.
      Parameters:
      newValidator - The validator for the password, or null if no validator should be used.
    • update

      protected void update()
      Description copied from class: AbstractComponent
      Updates the condition of the component based upon the state. This method is a convenience method for complex components that would like to perform wholesale updates any prototypes, enabled/disabled status, proxied actions, etc. This version does nothing.
      Overrides:
      update in class AbstractComponent
    • isPasswordMatch

      protected boolean isPasswordMatch()
      Returns:
      true if both entered passwords are identical.
    • determineValid

      protected boolean determineValid()
      Checks the state of the component for validity. This version returns true.

      This version calls AbstractCompositeComponent.determineChildrenValid().

      This version ensures the entered passwords match if password verification is enabled.

      Overrides:
      determineValid in class AbstractCompositeComponent
      Returns:
      true if the component and all children passes all validity tests, else false.
    • validate

      public boolean validate()
      Validates the user input of this component and all child components. The component will be updated with error information.

      This version clears all notifications. This version calls AbstractComponent.updateValid().

      This version first calls AbstractCompositeComponent.validateChildren() so that all children will be validated before checks are performed on this component.

      This version adds errors for non-matching passwords if password verification is enabled.

      Specified by:
      validate in interface Component
      Overrides:
      validate in class AbstractCompositeComponent
      Returns:
      The current state of Component.isValid() as a convenience.
    • clearValues

      public void clearValues()
      Clears the username and password values.