[Request for Comments] Behavior / InputMap
Andy Goryachev
andy.goryachev at oracle.com
Tue Oct 10 17:54:46 UTC 2023
Re-sending with a smaller image (256kb limit, really?).
From: Andy Goryachev <andy.goryachev at oracle.com>
Date: Tuesday, October 10, 2023 at 10:49
To: Michael Strauß <michaelstrau2 at gmail.com>
Cc: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>
Subject: Re: [Request for Comments] Behavior / InputMap
Dear Michael:
Here is a use case for (re-)mapping by the user at runtime:
[cid:image002.jpg at 01D9FB68.032C8480]
(key mappings UI in Eclipse).
I can think of several other cases (mentioned in the proposal, I think) so I think we can put the concept of immutable or global InputMap to rest.
Whether the InputMap contains the reference to its control or not is a minor implementation detail, I think.
-andy
From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of Michael Strauß <michaelstrau2 at gmail.com>
Date: Tuesday, October 10, 2023 at 10:36
To:
Cc: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>
Subject: Re: [Request for Comments] Behavior / InputMap
> Yes, one of the features the new design provides is ability to modify key mappings by the user at runtime. So yes, not only it needs to be mutable, but it also adds some APIs for exactly that.
>
I struggle to see a use case for this feature. I can imagine that
there might be some use cases that call for customized input mappings,
but why would this translate to a _mutable_ input map? That's quite a
departure from the way other parts of JavaFX work.
For example, skins are also immutable. If you want to have a different
skin for a control, you don't somehow modify the existing skin
instance; instead, you'd create a new skin class (or -- somehow --
extend an existing skin class), and then install that new skin on your
control.
An input map shouldn't bind input events directly to instance methods
of a particular control instance. It should define the mapping of
events to methods symbolically:
Instead of mapping Event => instance.method(), it should map Event =>
Control::method. The input map could then be stateless and immutable,
and can be set on any control instance. If you want to change the
mappings, just set a different input map instance. There's no need
that an input map would retain a reference to any particular control,
since the control reference can be passed into the input map just as
easily.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20231010/847d53db/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 104433 bytes
Desc: image002.jpg
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20231010/847d53db/image002-0001.jpg>
More information about the openjfx-dev
mailing list