Request for comments: Styling precedence proposal
Randahl Fink Isaksen
randahl at rockit.dk
Fri Dec 7 07:34:43 PST 2012
Thanks for reading my post. The comment on "real, type safe, good old Java properties" is meant to suggest that assigning a color by invoking a setStyle(String) method is not type safe and is not a traditional bean property.
I agree with you that assigning styles using stylesheets and classes is best, and my suggestion adds complexity. Still, there are numerous situations where just using classes does not cut it. In fact, everywhere were the actual value of the style property is calculated at runtime, CSS does not cut it. For instance, I have Nodes that are white but fades to red depending on system state, and we are talking a gradual shift from full red to white with hundreds of colours in between. Theoretically I could create 100 style classes to switch between, but of course I am not going to do that – hence the calls to setStyle(…).
And another problem here is the fact that I cannot as a programmer set a visual property without ruining it for the designer who wishes to style it differently – currently, the code always wins. I would like to be able to instantiate a red Rectangle, while still allowing designers to choose blue. That is especially important when writing reusable component libraries.
On Dec 7, 2012, at 15:36 , David Grieve <david.grieve at oracle.com> wrote:
> real, type safe, good old Java properties
More information about the openjfx-dev