Yeah, it may be possible to do this; as said, I'm already storing a
StyleableProperty in the map (as it is needed to track the style origin
for the CSS system, otherwise it will never reset it when styles
changes), and exposing this property via a static property method would
certainly be trivial to do.  

Currently I'm storing the property and actual value in separate keys,
but I suppose there is no reason to have a separate key if the property
would hold the value.  I think that storing only a property would be a
better solution, perhaps with some code to avoid creating the property
similar to how lazy properties are done currently.

This sounds promising, I'll look into it and see if I can get this
incorporated in the PoC.

--John

On 12/02/2025 20:10, Michael Strauß wrote:
> Maybe we can expand static properties to complete JavaFX properties.
>
> Right now, static properties are implemented with a getter and setter
> on the declaring class. We can add an additional property getter like
> so:
>
> class HBox {
>     public static ObjectProperty<Insets> marginProperty(Node child);
>     public static void setMargin(Node child, Insets value);
>     public static Insets getMargin(Node child);
> }
>
> Instead of storing the value directly in the properties map, we would
> store the ObjectProperty instead. In doing that, we can use the
> Styleable{Double,Object,...}Property implementations, which gives us
> access to the transition machinery.
>
>
> On Wed, Feb 12, 2025 at 3:27 PM John Hendrikx <john.hendr...@gmail.com> wrote:
>> Thanks,
>>
>> I may need some help with the transition part when the time arrives. In
>> CssStyleHelper these parent defined properties are treated no different
>> from any other properties, but I think some of the transition logic is
>> part of the properties themselves and I didn't implement that so far.
>>
>> How I've implemented them currently is with just-in-time properties that
>> only implement StyleableProperty (so it's not a full property that could
>> be bound).  The actual storage is in the properties map associated with
>> all Nodes.
>>
>> I'll see if I can work this up as a PR over the weekend.  It works
>> already, but needs some polishing and perhaps some optimization as its
>> part of CSS code.

Reply via email to