edvin / tornadofx

Lightweight JavaFX Framework for Kotlin
Apache License 2.0
3.68k stars 272 forks source link

Allow effect to be null #920

Open Defman21 opened 5 years ago

Defman21 commented 5 years ago

For example, I'm styling my own tooltip. There's an effect that drops text shadow by default, which I want to drop. I can't use null as the value for the effect property, though I can use e.g. Shadow to get the "none" (which should be "null" I believe) value here: https://github.com/edvin/tornadofx/blob/master/src/main/java/tornadofx/CSS.kt#L552

edvin commented 5 years ago

Sounds reasonable. @ruckustboom do you agree, or should we add an Effect subclass called None?

ruckustboom commented 5 years ago

I think supporting nullability would make more sense in this case, but it would be best to then use a custom renderer for the effect property (since null !is Effect, the is Effect test in the linked code won't work, and we shouldn't treat all nulls the same).

Also, according to the CSS reference, it looks like you're correct the result should be "null" and not "none", though we'd probably want to test it just to make sure.

archturtle commented 5 years ago

Any ETA on this? Right now I'm using a temporary workaround where I extend the Effect class but don't implement any of the functions. It would be great if there was an official way to do this.

edvin commented 5 years ago

I don't have time to prioritize this at the moment, sorry.