Class DurationConverter

java.lang.Object
javafx.css.StyleConverter<Number, javafx.util.Duration>
com.dlsc.gemsfx.util.DurationConverter

public class DurationConverter extends javafx.css.StyleConverter<Number, javafx.util.Duration>
A CSS StyleConverter that converts a numeric millisecond value to a Duration.

Usage in CSS:

  -fx-animation-duration: 300;   /* 300 milliseconds */

In Java:

  new CssMetaData<>("-fx-animation-duration", DurationConverter.getInstance(), Duration.millis(200)) { … }
  • Nested Class Summary

    Nested classes/interfaces inherited from class javafx.css.StyleConverter

    javafx.css.StyleConverter.StringStore
  • Method Summary

    Modifier and Type
    Method
    Description
    javafx.util.Duration
    convert(javafx.css.ParsedValue<Number, javafx.util.Duration> value, javafx.scene.text.Font font)
    Converts the parsed CSS value into a duration.
    Returns the singleton instance of this converter.
    Returns the name of this converter.

    Methods inherited from class javafx.css.StyleConverter

    cacheValue, clearCache, convert, getBooleanConverter, getCachedValue, getColorConverter, getDurationConverter, getEffectConverter, getEnumConverter, getFontConverter, getInsetsConverter, getPaintConverter, getSizeConverter, getStringConverter, getUrlConverter, readBinary, writeBinary

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • getInstance

      public static DurationConverter getInstance()
      Returns the singleton instance of this converter.
      Returns:
      the singleton DurationConverter
    • convert

      public javafx.util.Duration convert(javafx.css.ParsedValue<Number, javafx.util.Duration> value, javafx.scene.text.Font font)
      Converts the parsed CSS value into a duration.
      Overrides:
      convert in class javafx.css.StyleConverter<Number, javafx.util.Duration>
      Parameters:
      value - the parsed value
      font - the font in use
      Returns:
      the converted duration
    • toString

      public String toString()
      Returns the name of this converter.
      Overrides:
      toString in class Object
      Returns:
      the converter name