Klasse InputControl.State<R>

java.lang.Object
com.dua3.utility.fx.controls.InputControl.State<R>
Typparameter:
R - the type of the value being managed
Umschließende Schnittstelle:
InputControl<T>

public static class InputControl.State<R> extends Object
State class encapsulates a value, validation logic, error message, and validity state.
  • Eigenschaftsdetails

    • value

      public Property<R> valueProperty
      Returns the property representing the value managed by this State.
      Siehe auch:
    • valid

      public ReadOnlyBooleanProperty validProperty
      Provides a read-only boolean property indicating the validity state.
      Siehe auch:
    • error

      public ReadOnlyStringProperty errorProperty
      Returns a read-only string property representing the current error message. If the value is valid, the error message will be an empty string.
      Siehe auch:
  • Konstruktordetails

    • State

      public State(Property<R> value)
      Constructs a State object with the given value.
      Parameter:
      value - the property representing the value managed by this State
    • State

      public State(Property<R> value, Supplier<R> dflt)
      Constructs a State object with the given value and default value supplier.
      Parameter:
      value - the property representing the value managed by this State
      dflt - a supplier that provides the default value for the property
    • State

      public State(Property<R> value, Supplier<? extends R> dflt, Function<? super R,Optional<String>> validate)
      Constructs a State object with the given value, default value supplier, and validation function.
      Parameter:
      value - the property representing the value managed by this State
      dflt - a supplier that provides the default value for the property
      validate - a function that validates the value and returns an optional error message
  • Methodendetails

    • setValidate

      public void setValidate(Function<? super R,Optional<String>> validate)
      Sets the validation function for the State.
      Parameter:
      validate - a function that validates the value and returns an optional error message
    • valueProperty

      public Property<R> valueProperty()
      Returns the property representing the value managed by this State.
      Gibt zurück:
      the property representing the value
    • validProperty

      public ReadOnlyBooleanProperty validProperty()
      Provides a read-only boolean property indicating the validity state.
      Gibt zurück:
      a ReadOnlyBooleanProperty representing whether the current state is valid
    • errorProperty

      public ReadOnlyStringProperty errorProperty()
      Returns a read-only string property representing the current error message. If the value is valid, the error message will be an empty string.
      Gibt zurück:
      ReadOnlyStringProperty representing the error message.
    • setDefault

      public void setDefault(Supplier<? extends R> dflt)
      Sets the default value supplier for this State.
      Parameter:
      dflt - a supplier that provides the default value for the property
    • reset

      public void reset()
      Resets the state to its default value.

      This method sets the current value of the property managed by this state to the default value supplied during the creation of the state.