[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Proposal to know consumed status of events you fire yourself
From:       John Hendrikx <john.hendrikx () gmail ! com>
Date:       2023-02-25 8:02:17
Message-ID: d2ef4c43-55f1-54de-34f6-e796030199ea () gmail ! com
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic