On Tue, 18 Oct 2022 05:40:59 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:
>> 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. I don't have time to review this as I am busy with JavaOne, so this is just a quick note to say that if there is sufficient benefit to add a `shown` property to the core of JavaFX, then it should be added _as_ a property -- possibly in MiscProperties if we think it is a seldom-used property. I don't like the idea of using `getProperties` for this. ------------- PR: https://git.openjdk.org/jfx/pull/830