Discuss: SkinBase - add api to support register InvalidationListeners
Jeanette Winzenburg
fastegal at swingempire.de
Mon Jan 25 14:09:55 UTC 2021
After playing a bit with the issue, it looks like it might be a good
idea to go a step further and also add support for listChangeListener,
added some finger-flexing to the issue
https://bugs.openjdk.java.net/browse/JDK-8258777
To feel the code's weight (-lessness :), there's a gist comparing the
effect w/out api
https://gist.github.com/kleopatra/fcce1e40c48e84b37f62631df348be90
-- Jeanette
Zitat von Jeanette Winzenburg <fastegal at swingempire.de>:
> Thanks, Kevin :)
>
> Starting work.
>
> -- Jeanette
>
> Zitat von Kevin Rushforth <kevin.rushforth at oracle.com>:
>
>> I think this sounds like a very natural addition to the API. Making
>> it easier for controls to clean up after themselves seems like a win.
>>
>> -- Kevin
>>
>>
>> On 1/7/2021 5:45 AM, Jeanette Winzenburg wrote:
>>>
>>> Recently filed (RFE)
>>> https://bugs.openjdk.java.net/browse/JDK-8258777 - it's about
>>> adding api to support un/register invalidationListener just the
>>> same way as changeListener.
>>>
>>> Trigger was work on cleaning up skins such that they don't
>>> misbehave (f.i. leaking memory or throwing exception,
>>> https://bugs.openjdk.java.net/browse/JDK-8241364) on switching the
>>> skin. Most of the related issues boil down to incomplete removal
>>> of listeners. As far as manual added (but not removed)
>>> changeListeners are involved, the fix is to use
>>> skin.registerChangeListener: all those are auto-removed in
>>> skinbase.dispose.
>>>
>>> For InvalidationListeners, the fix is cumbersome: it requires
>>> storing both the listener and its weak wrapper, manually adding
>>> the weak wrapper and manually removing it in dispose. Getting
>>> really boring if a skin (like TextInputXX) registers many of them ..
>>>
>>> IMO, not having symmetric support of invalidation- vs
>>> changeListeners in SkinBase api very much feels like an omission -
>>> which would be fixed by this :)
>>>
>>> Opinions, please.
>>>
>>> -- Jeanette
>>>
More information about the openjfx-dev
mailing list