Proposal to know consumed status of events you fire yourself
John Hendrikx
john.hendrikx at gmail.com
Sat Feb 25 08:02:17 UTC 2023
I created this ticket: https://bugs.openjdk.org/browse/JDK-8303209
With it I would like to make public a mechanism to see whether an event
you fire yourself was consumed or not. Currently, the simplest mechanism
to fire an event is casting your EventTarget to Node (if possible) and
calling `fireEvent`. However, this provides no feedback whether the
event was consumed or not (events are copied, so checking the passed in
event for `isConsumed` won't work).
The only option that seems to be available is to build your own dispatch
chain (Using EventTarget#buildEventDispatchChain) and then passing in
your own EventDispatcher (by for example copying the private
implementation in EventDispatcherImpl) and then calling `dispatchEvent`
on the resulting chain. This then allows you to check for a `null`
return to see if your event was consumed.
This seems really cumbersome, and so I wrote the above ticket to
simplify this.
Note that I'm not really exposing anything new, only making it easier to
achieve.
Thoughts?
--John
More information about the openjfx-dev
mailing list