cljfx

https://github.com/cljfx/cljfx
2020-02-08T11:25:05.037500Z

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?

vlaaad 2020-02-08T11:26:58.037900Z

Can you tell me what exactly did you try?

2020-02-08T11:32:32.038700Z

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 tableview

vlaaad 2020-02-08T11:45:01.039700Z

changing :style-class to ["table-view" "my-table"] helped...

vlaaad 2020-02-08T11:47:23.041500Z

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

2020-02-08T11:53:46.042700Z

Yes, that works, thank you!

vlaaad 2020-02-08T12:01:13.042900Z

you are welcome!