<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Michael,</p>
<p>Yeah, I also think it is an oversight, or may even be qualified
as a bug. Now you have to be really careful to start event
handlers with a `if (!event.isConsumed())` check, just in case
there is another handler that is before you at the same level that
may have consumed the event...<br>
</p>
<p>There docs are really light on details, and only this part seems
relevant and could be a bit ambigious depending on what
"propagation" would mean here (to another handler or to a
different eventhandler manager):</p>
<div style="background-color:#ffffff;padding:0px 0px 0px 2px;">
<div style="color:#000000;background-color:#ffffff;font-family:"Consolas";font-size:11pt;white-space:pre;"><p style="margin:0;"><span style="color:#000000;"> </span><span style="color:#3f5fbf;">/**</span></p><p style="margin:0;"><span style="color:#3f5fbf;"> * Marks this {@code Event} as consumed. This stops its further propagation.</span></p><p style="margin:0;"><span style="color:#3f5fbf;"> */</span></p><p style="margin:0;"><span style="color:#000000;"> </span><span style="color:#0000a0;font-weight:bold;">public</span><span style="color:#000000;"> </span><span style="color:#0000a0;font-weight:bold;">void</span><span style="color:#000000;"> consume() {</span></p><p style="margin:0;"><span style="color:#000000;"> </span><span style="color:#0000c0;">consumed</span><span style="color:#000000;"> = </span><span style="color:#0000a0;font-weight:bold;">true</span><span style="color:#000000;">;</span></p><p style="margin:0;"><span style="color:#000000;"> }</span></p><p style="margin:0;"><span style="color:#000000;">
</span></p><p style="margin:0;"><span style="color:#000000;">--John</span></p><p style="margin:0;"><span style="color:#000000;">
</span></p></div>
</div>
<div class="moz-cite-prefix">On 26/10/2023 04:06, Michael Strauß
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAJEpuXS-ALcBO4gUotAWGHwub9zFf6fPAFEsJM+KsNAd41X2kA@mail.gmail.com">
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">- The consumed flag doesn't change any other behavior? Consumed events
only are passed to handlers at the same level, but are not bubbled up
(or captured down); having consumed events not be passed to event
handlers (even at the same level) seems like a more sane default for sure
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
I pulled on this string a little bit more and decided to remove the
`EventHandlerPolicy` record from the API, because I think the
`EventHandlerPolicy.handleConsumedEvents` toggle is not required. Have
a look at the PR to see the simplified API:
<a class="moz-txt-link-freetext" href="https://github.com/openjdk/jfx/pull/1266">https://github.com/openjdk/jfx/pull/1266</a>
While the current behavior of JavaFX events is strange with regards to
handler invocation for consumed events, it doesn't need to be solved
with the priority API. Here's an interesting thing: if I simply don't
invoke any event handlers for an event that is already consumed, no
tests break. This suggests to me that the current behavior is an
oversight rather than a purposeful implementation, and we could change
it in the future.</pre>
</blockquote>
<blockquote type="cite"
cite="mid:CAJEpuXS-ALcBO4gUotAWGHwub9zFf6fPAFEsJM+KsNAd41X2kA@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">
</pre>
</blockquote>
</body>
</html>