java.lang.Object
javafx.css.StyleConverter<F,T> 
- Type Parameters:
- F- the type of the parsed value
- T- the converted type of the ParsedValueImpl
- Direct Known Subclasses:
- BooleanConverter,- ColorConverter,- CursorConverter,- DeriveColorConverter,- DeriveSizeConverter,- DurationConverter,- EffectConverter,- EnumConverter,- FontConverter,- FontConverter.FontSizeConverter,- FontConverter.FontStyleConverter,- FontConverter.FontWeightConverter,- InsetsConverter,- InsetsConverter.SequenceConverter,- LadderConverter,- PaintConverter,- PaintConverter.ImagePatternConverter,- PaintConverter.LinearGradientConverter,- PaintConverter.RadialGradientConverter,- PaintConverter.RepeatingImagePatternConverter,- PaintConverter.SequenceConverter,- ShapeConverter,- SizeConverter,- SizeConverter.SequenceConverter,- StopConverter,- StringConverter,- StringConverter.SequenceConverter,- URLConverter,- URLConverter.SequenceConverter
StyleConverter converts 
ParsedValue<F,T>
 from type F to type T. The
 CssMetaData API requires a StyleConverter which is used
 when computing a value for the StyleableProperty. There are
 a number of predefined converters which are accessible by the static
 methods of this class.
 F is the type of the parsed value and T is the converted type of
 the ParsedValueImpl. For example, a converter from String to Color would
 be declared
     
 public Color convert(ParsedValueImpl<String,Color> value, Font font)
 
- Since:
- JavaFX 8.0
- See Also:
- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidcacheValue(ParsedValue key, Object value) Cache the value for the specified key.static voidClear the cache.convert(Map<CssMetaData<? extends Styleable, ?>, Object> convertedValues) Convert from the constituent values to the target property type.convert(ParsedValue<F, T> value, Font font) Convert from the parsed CSS value to the target property type.static StyleConverter<String,Boolean> Return aStyleConverterthat converts "true" or "false" toBoolean.protected TGet the cached value for the specified key.static StyleConverter<String,Color> Return aStyleConverterthat converts a String representation of a web color to aColor.static StyleConverter<?,Duration> Return aStyleConverterthat converts a String representation of a duration to aDuration.static StyleConverter<ParsedValue[],Effect> Return aStyleConverterthat converts a parsed representation of anEffectto anEffectstatic <E extends Enum<E>>
 StyleConverter<String,E> getEnumConverter(Class<E> enumClass) Return aStyleConverterthat converts a String representation of anEnumto anEnum.static StyleConverter<ParsedValue[],Font> Return aStyleConverterthat converts a parsed representation of aFontto anFont.static StyleConverter<ParsedValue[],Insets> Return aStyleConverterthat converts a [<length> | <percentage>]{1,4} to anInsets.static StyleConverter<ParsedValue<?,Paint>, Paint> Return aStyleConverterthat converts a parsed representation of aPaintto aPaint.static StyleConverter<?,Number> CSS length and number values are parsed into a Size object that is converted to a Number before the value is applied.static StyleConverter<String,String> A converter for quoted strings which may have embedded unicode characters.static StyleConverter<ParsedValue[],String> A converter for URL strings.static StyleConverter<?,?> readBinary(DataInputStream is, String[] strings) Read binary data stream.voidwriteBinary(DataOutputStream os, StyleConverter.StringStore sstore) Write binary data.
- 
Constructor Details- 
StyleConverterpublic StyleConverter()Creates aStyleConverter.
 
- 
- 
Method Details- 
convertConvert from the parsed CSS value to the target property type.- Parameters:
- value- The- ParsedValueto convert
- font- The- Fontto use when converting a relative value.
- Returns:
- the converted target property type
 
- 
getBooleanConverterReturn aStyleConverterthat converts "true" or "false" toBoolean.- Returns:
- A StyleConverterthat converts "true" or "false" toBoolean
- See Also:
 
- 
getDurationConverterReturn aStyleConverterthat converts a String representation of a duration to aDuration.- Returns:
- A StyleConverterthat converts a String representation of a duration to aDuration
- Since:
- JavaFX 8u40
 
- 
getColorConverterReturn aStyleConverterthat converts a String representation of a web color to aColor.- Returns:
- A StyleConverterthat converts a String representation of a web color to aColor
- See Also:
 
- 
getEffectConverterReturn aStyleConverterthat converts a parsed representation of anEffectto anEffect- Returns:
- A StyleConverterthat converts a parsed representation of anEffectto anEffect
- See Also:
 
- 
getEnumConverterReturn aStyleConverterthat converts a String representation of anEnumto anEnum.- Type Parameters:
- E- the type of the- Enum
- Parameters:
- enumClass- the enum Class
- Returns:
- A StyleConverterthat converts a String representation of anEnumto anEnum
- See Also:
 
- 
getFontConverterReturn aStyleConverterthat converts a parsed representation of aFontto anFont.- Returns:
- A StyleConverterthat converts a parsed representation of aFontto anFont
- See Also:
 
- 
getInsetsConverterReturn aStyleConverterthat converts a [<length> | <percentage>]{1,4} to anInsets.- Returns:
- A StyleConverterthat converts a [<length> | <percentage>]{1,4} to anInsets
 
- 
getPaintConverterReturn aStyleConverterthat converts a parsed representation of aPaintto aPaint.- Returns:
- A StyleConverterthat converts a parsed representation of aPaintto aPaint
 
- 
getSizeConverterCSS length and number values are parsed into a Size object that is converted to a Number before the value is applied. If the property is aNumbertype other thanDouble, the set method of (CssMetaDatacan be overridden to convert theNumberto the correct type. For example, if the property is anIntegerProperty:@Override public void set(MyNode node, Number value, Origin origin) { if (value != null) { super.set(node, value.intValue(), origin); } else { super.set(node, value, origin); } }- Returns:
- A StyleConverterthat converts a parsed representation of a CSS length or number value to aNumberthat is an instance ofDouble
 
- 
getStringConverterA converter for quoted strings which may have embedded unicode characters.- Returns:
- A StyleConverterthat converts a representation of a CSS string value to aString
 
- 
getUrlConverterA converter for URL strings.- Returns:
- A StyleConverterthat converts a representation of a CSS URL value to aString
 
- 
convertConvert from the constituent values to the target property type. Implemented by Types that have Keys with subKeys.- Parameters:
- convertedValues- the constituent values
- Returns:
- the target property type
- Since:
- 9
 
- 
writeBinaryWrite binary data.- Parameters:
- os- the data output stream
- sstore- the string store
- Throws:
- IOException- the exception
- Since:
- 9
 
- 
clearCachepublic static void clearCache()Clear the cache.- Since:
- 9
 
- 
getCachedValueGet the cached value for the specified key.- Parameters:
- key- the key
- Returns:
- the cached value
- Since:
- 9
 
- 
cacheValueCache the value for the specified key.- Parameters:
- key- the key
- value- the value
- Since:
- 9
 
- 
readBinarypublic static StyleConverter<?,?> readBinary(DataInputStream is, String[] strings) throws IOException Read binary data stream.- Parameters:
- is- the data input stream
- strings- the strings
- Returns:
- the style converter
- Throws:
- IOException- the exception
- Since:
- 9
 
 
-