- java.lang.Object
-
- org.tentackle.fx.translate.AbstractValueTranslator<java.lang.String,javafx.scene.paint.Color>
-
- org.tentackle.fx.translate.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 Summary
Fields Modifier and Type Field Description static intCOLOR_LENGTHThe fixed color string length.
-
Constructor Summary
Constructors Constructor Description StringColorTranslator(FxComponent component)Creates the translator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.function.Function<javafx.scene.paint.Color,java.lang.String>toModelFunction()Function to translate a view value to a model value.java.util.function.Function<java.lang.String,javafx.scene.paint.Color>toViewFunction()Function to translate a model value to a view value.-
Methods inherited from class org.tentackle.fx.translate.AbstractValueTranslator
getComponent, isLenient, setLenient
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.tentackle.fx.ValueTranslator
bindingPropertiesUpdated, needsToModelTwice, toModel, toView
-
-
-
-
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:ValueTranslatorFunction 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:ValueTranslatorFunction to translate a view value to a model value.- Returns:
- the function
-
-