Styling HBox/VBox/GridPane child properties (hgrow, margin, columnIndex, etc)

Michael Strauß michaelstrau2 at gmail.com
Wed Feb 12 19:10:10 UTC 2025


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.hendrikx at 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.


More information about the openjfx-dev mailing list