Class SecretField

All Implemented Interfaces:
Styleable, EventTarget

public class SecretField extends HBox
A secret/password field with a toggle to show/hide the value and an optional in-place encoder (mode combobox) that encodes the password using the application's security key (unique key by default).

The encoder is enabled when a mode > 0 is selected; encoding uses the unique security key (app.getUniqueSecurityKey()) unless internalEncryption is true.

  • Property Details

  • Method Details

    • create

      public static SecretField create(BaseApp app, ch.autumo.commons.application.LicensedApplication licApp)
      Creates a secret field with unique-key encryption (default).
      Parameters:
      app - the application
      licApp - licensed application from autumo commons or null
      Returns:
      the new secret field
    • create

      public static SecretField create(BaseApp app)
      Creates a secret field with unique-key encryption (default).
      Parameters:
      app - the application
      Returns:
      the new secret field
    • create

      public static SecretField create(BaseApp app, ch.autumo.commons.application.LicensedApplication licApp, boolean internalEncryption)
      Creates a secret field.
      Parameters:
      app - the application
      licApp - licensed application from autumo commons or null
      internalEncryption - if true, use the internal security key
      Returns:
      the new secret field
    • create

      public static SecretField create(BaseApp app, boolean internalEncryption)
      Creates a secret field.
      Parameters:
      app - the application
      internalEncryption - if true, use the internal security key
      Returns:
      the new secret field
    • getText

      public String getText()
      Returns the current text value.
      Returns:
      the text
    • setText

      public void setText(String text)
      Sets the text value.
      Parameters:
      text - the text to set
    • textProperty

      public StringProperty textProperty()
      Returns the text property.
      Returns:
      text property
      See Also:
    • getEncMode

      public int getEncMode()
      Returns the selected encryption mode.

      0 if nothing is encoded.

      Returns:
      the encryption mode
    • encModeProperty

      public ReadOnlyIntegerProperty encModeProperty()
      Returns the encryption mode property.

      It changes when the mode of the field changes - also when it is set with setEncMode(int).

      Returns:
      the encryption mode property
      See Also:
    • setEncMode

      public void setEncMode(int mode)
      Selects an encryption mode without encoding the value.

      Used when a configuration is loaded: the value is already encoded, it must not be encoded again. The mode is selected in the list of the field, a mode that is not one of the standard ones is added to the list.

      Parameters:
      mode - the encryption mode (0 for none)
    • setEditable

      public void setEditable(boolean editable)
      Sets whether the field is editable.
      Parameters:
      editable - true if editable
    • isEditable

      public boolean isEditable()
      Returns whether the field is editable.
      Returns:
      true if editable