Class StringColorTranslator

  • All Implemented Interfaces:
    ValueTranslator<java.lang.String,​javafx.scene.paint.Color>

    @ValueTranslatorService(modelClass=java.lang.String.class,
                            viewClass=javafx.scene.paint.Color.class)
    public class StringColorTranslator
    extends AbstractValueTranslator<java.lang.String,​javafx.scene.paint.Color>
    A string/color translator.
    Useful for color pickers bound to a string in the model.
    Author:
    harald
    • Field Detail

      • COLOR_LENGTH

        public static final int COLOR_LENGTH
        The fixed color string length. Ex.: "0xffffffff" for WHITE.
        See Also:
        Constant Field Values
    • Constructor Detail

      • StringColorTranslator

        public StringColorTranslator​(FxComponent component)
        Creates the translator.
        Parameters:
        component - the component
    • Method Detail

      • toViewFunction

        public java.util.function.Function<java.lang.String,​javafx.scene.paint.Color> toViewFunction()
        Description copied from interface: ValueTranslator
        Function to translate a model value to a view value.
        Returns:
        the function
      • toModelFunction

        public java.util.function.Function<javafx.scene.paint.Color,​java.lang.String> toModelFunction()
        Description copied from interface: ValueTranslator
        Function to translate a view value to a model value.
        Returns:
        the function