The style converter obtained by StyleConverter.getColorConverter() does not work.

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P3
    • 8u40
    • Affects Version/s: 8u11
    • Component/s: javafx
    • Environment:

      Windows 7 (64bit) JDK.

      Following code causes unexpected result (can not apply CSS description to the property).

      static StyleConverter COLOR_CONVERTER = StyleConverter.getColorConverter();
      static CssMetaData<MyControl, Color> MY_COLOR =
        new CssMetaData<MyControl, Color>("-my-color", COLOR_CONVERTER) { ... };

      In this case, com.sun.javafx.css.parser.CSSParser generates ParsedValue<Color, Color> for a color value specified in CSS and passes it to convert method of com.sun.javafx.css.converters.ColorConverter.
      However the convert method expects ParsedValue<String, Color>, so the ClassCastException thrown.

      I think ColorConverter should be a StyleConverter<Object, Color>, not a StyledConverter<String, Color>.

      Although the development team may already have noticed this issue, I reported just to make sure.

            Assignee:
            David Grieve
            Reporter:
            J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: