[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-openjfx-dev
Subject: Re: RFR: 8240506: TextFieldSkin/Behavior: misbehavior on switching skin
From: Jeanette Winzenburg <fastegal () openjdk ! java ! net>
Date: 2021-06-29 12:40:10
Message-ID: DeipBINaVrujJ7foy78gf1xOyan0USu8OfiZxZsyuiY=.b56d4d4c-4a3f-4c88-a4db-0727961b01fa () github ! com
[Download RAW message or body]
On Mon, 28 Jun 2021 15:42:47 GMT, Jeanette Winzenburg <fastegal@openjdk.org> wrote:
> > modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/behavior/TextFieldBehavior.java \
> > line 75:
> > > 73: }
> > > 74:
> > > 75: focusListener = (observable, oldValue, newValue) -> {
> >
> > Shouldn't this focusListener also be wrapped in a weakListener? Also this lambda \
> > expression can be a one-liner (no braces needed)
>
> we are a bit inconsistent in wrapping (or not) listeners into their weak \
> counterparts - behaviors tend to not :) That's okay - and less crowded by \
> additional code - as long as they are removed properly, IMO. But just seeing: good \
> question, as the focusOwner listener is wrapped, need to consult my notes. Thanks \
> for the heads up!
> As to the single vs. multiple lines: ersonally, I tend to not change more than \
> absolutely needed - it had the brackets before the fix so I kept them.
Okay, went through listener registrations in all behaviors - and they are indeed \
inconsistent:
- some listen to control properties like focused (f.i. Button, Combo): adding strong, \
often inline listeners
- some listen to control path properties like selection/Model/Indices (f.i. ListView, \
TreeView): adding weak (inline or field) wrappers
- cleanup for all guarantees to make those listeners removable (without touching \
their type) and actually remove them in dispose
So I tend to follow that approach here as well, opinions?
-------------
PR: https://git.openjdk.java.net/jfx/pull/534
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic