RFR: 8252935: Add treeShowing listener only when needed [v2]

John Hendrikx jhendrikx at openjdk.java.net
Sun Jan 24 09:30:42 UTC 2021

On Fri, 22 Jan 2021 21:31:42 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> John Hendrikx has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains one commit:
>>   WIP: Moved treeShowingProperty into its own class
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/ProgressIndicatorSkin.java line 137:
>> 135: 
>> 136:         treeShowingExpression = new TreeShowingExpression(control);
>> 137:         treeShowingExpression.addListener((obs, old, current) -> updateAnimation());
> Is there a reason not to still use `registerChangeListener` for this?

`registerChangeListener` can be used here, I just didn't see it.  However, there is no need to unregister the listener from the expression (it is local to the skin, it will never have more than one listener and will be GC'd with the Skin).  I will change it though, as it looks a bit cleaner, and there is no harm unregistering the listener.


PR: https://git.openjdk.java.net/jfx/pull/185

More information about the openjfx-dev mailing list