Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8092514

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • 8u40
    • 8u11
    • javafx
    • 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.

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

              Created:
              Updated:
              Resolved:
              Imported: