Hi there, tried to use cljfx/css sample and got a lot of this warnings
Feb 08, 2020 1:23:21 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Caught 'java.lang.ClassCastException: class java.lang.String cannot be cast to class javafx.scene.paint.Paint (java.lang.String is in module java.base of loader 'bootstrap'; javafx.scene.paint.Paint is in unnamed module of loader 'app')' while converting value for '-fx-border-color' from rule '*.table-cell' in stylesheet jar:file:/Users/romantsopin/.m2/repository/org/openjfx/javafx-controls/13/javafx-controls-13-mac.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
And styles now seem to be broken. Any thoughts on this?
Can you tell me what exactly did you try?
Sure, here is my sample
(ns app.core
(:require [cljfx.api :as fx]
[cljfx.css :as css]))
(def style
(css/register ::style {".root" {:-fx-padding 10}}))
(def table-view
{:fx/type :table-view
:style-class "my-table" ;; this line cause warnings
:columns [{:fx/type :table-column
:text "pr-str"
:cell-value-factory identity
:cell-factory (fn [x]
{:text (pr-str x)})}
{:fx/type :table-column
:text "bg color"
:cell-value-factory identity
:cell-factory (fn [i]
{:style {:-fx-background-color i}})}]
:items [:red :green :blue "#ccc4" "#ccc4"]})
(fx/on-fx-thread
(fx/create-component
{:fx/type :stage
:showing true
:title "Cell factory examples"
:scene {:fx/type :scene
:stylesheets [(::css/url style)]
:root table-view}}))
Warnings appear when I'm adding style-class to tableviewchanging :style-class
to ["table-view" "my-table"]
helped...
table-view
is a default style class for table. I think there is a bug in modena.css (default css used in javafx) that has some invalid css rule for table cells that might be overridden when table has it's default style class
Yes, that works, thank you!
you are welcome!