Discuss: SkinBase - add api to support register InvalidationListeners
Kevin Rushforth
kevin.rushforth at oracle.com
Tue Jan 26 22:31:10 UTC 2021
I like the look of that. It's nice to see more boilerplate code being
taken care of by shared code in the SkinBase superclass.
-- Kevin
On 1/25/2021 6:09 AM, Jeanette Winzenburg wrote:
>
> 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