Interface ValueTranslator<M,​V>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      FxComponent getComponent()
      Gets the component.
      boolean isLenient()
      Returns whether parsing to model should be lenient.
      default boolean needsToModelTwice()
      Returns whether toModel must be invoked twice.
      An example is a DoubleStringTranslator:
      let fraction number input be 1.211111 and formatting scale 2.
      default M toModel​(V value)
      Converts a view value to a model value.
      java.util.function.Function<V,​M> toModelFunction()
      Function to translate a view value to a model value.
      default V toView​(M value)
      Converts a model value to a view value.
      java.util.function.Function<M,​V> toViewFunction()
      Function to translate a model value to a view value.
    • Method Detail

      • getComponent

        FxComponent getComponent()
        Gets the component.
        Returns:
        the component
      • toViewFunction

        java.util.function.Function<M,​V> toViewFunction()
        Function to translate a model value to a view value.
        Returns:
        the function
      • toModelFunction

        java.util.function.Function<V,​M> toModelFunction()
        Function to translate a view value to a model value.
        Returns:
        the function
      • isLenient

        boolean isLenient()
        Returns whether parsing to model should be lenient.
        Returns:
        true if lenient, false is default
      • needsToModelTwice

        default boolean needsToModelTwice()
        Returns whether toModel must be invoked twice.
        An example is a DoubleStringTranslator:
        let fraction number input be 1.211111 and formatting scale 2.
        • after first updateModel the model contains 1.211111
        • after formatting and updateView, the view contains 1.21 but the model still contains 1.211111
        • after second updateModel the model contains the correct value 1.21
        Returns:
        true if needs a second translation roundtrip
      • toView

        default V toView​(M value)
        Converts a model value to a view value.
        Parameters:
        value - the model's value
        Returns:
        the view's value
      • toModel

        default M toModel​(V value)
        Converts a view value to a model value.
        Parameters:
        value - the view's value
        Returns:
        the model's value