On Mon, 17 Oct 2022 16:11:32 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> What I meant is you can add it in Node.getProperties() and not to add a 
>> pointer to every Node everywhere.  If it's used, the actual properties will 
>> be created in a few containers.
>
> private static final Object KEY = new Object();
> 
> public final ReadOnlyBooleanProperty shownProperty() {
>   Object x = getProperties().get(KEY);
>   if (x instanceof ReadOnlyBooleanProperty p) {
>     return p;
>   }
>   ReadOnlyBooleanProperty p = ... // create
>   getProperties().put(KEY, p);
>   return p;
> }

Thanks, I understand, what I find odd is that this would be the first property 
in `Node` to be stored this way.  If this was so important, then why isn't this 
done for other properties? There seem to be sufficient candidates for this 
approach to "slim" down `Node` (infrequently used properties like `Subscene`, 
`id`, `style`, `blendMode`).

There's even a `MiscProperties` objects which is described as "Misc Seldom Used 
Properties" that is created only when needed with these properties:

        private LazyBoundsProperty boundsInParent;
        private LazyBoundsProperty boundsInLocal;
        private BooleanProperty cache;
        private ObjectProperty<CacheHint> cacheHint;
        private ObjectProperty<Node> clip;
        private ObjectProperty<Cursor> cursor;
        private ObjectProperty<DepthTest> depthTest;
        private BooleanProperty disable;
        private ObjectProperty<Effect> effect;
        private ObjectProperty<InputMethodRequests> inputMethodRequests;
        private BooleanProperty mouseTransparent;
        private DoubleProperty viewOrder;

Let's see what others think before I change this. It does sound like a 
reasonable approach though.

-------------

PR: https://git.openjdk.org/jfx/pull/830

Reply via email to