Request for comments: Styling precedence proposal
david.grieve at oracle.com
Fri Dec 7 07:55:05 PST 2012
On Dec 7, 2012, at 10:34 AM, Randahl Fink Isaksen <randahl at rockit.dk> wrote:
> Hi David
> 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(…).
In 2.x, the only way to style a Region was with CSS. In 8.x, you have access to the properties. In your example, then, you can animate the shift. There is also a feature request to add animation support to CSS. And then there are the bugs I pointed out that call for public access to the CSS structure which I invite you to comment on.
> 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.
The code should only win over a style in a user-agent stylesheet. If this is not the case, then there is a bug.
> 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