RFR: 8290040: Provide simplified deterministic way to manage listeners [v9]

John Hendrikx jhendrikx at openjdk.org
Fri Dec 2 09:14:26 UTC 2022


On Fri, 2 Dec 2022 01:22:01 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Adjust Node
>>   
>>   - Fixed javadoc
>>   - Added comment for code that avoid eager instantiation
>>   - Changed `isShown` to use property if it is available
>
> modules/javafx.graphics/src/main/java/javafx/scene/Node.java line 1437:
> 
>> 1435:     }
>> 1436: 
>> 1437:     public final ReadOnlyBooleanProperty shownProperty() {
> 
> This property probably should have been named `showing` to align it with `Window.showing`, but the "good name" is already taken by `ComboBox` and other controls. Just out of interest, have you considered alternatives to `shown`?

I didn't look too far for alternative names after I discovered `showing` would not be possible.  The name comes from `isTreeShowing` which is used for a similar purpose (inside `Node`) and from `conditionOnShowing` in ReactFX.

The name needs to imply that visibility has no effect on it (ie, `setVisible(false)` won't toggle it).  Neither does it check if the node isn't covered or off screen.

In theory you could use a more general name (like `active` as in "part of an active currently showing scene graph").  `isActive` seems to even be available...

A name like "used" or "inUse" may also work (as in "indicates the node is currently used as part of a currently showing scene graph".

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

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


More information about the openjfx-dev mailing list