Prioritized event handlers

Andy Goryachev andy.goryachev at oracle.com
Mon Oct 30 19:53:03 UTC 2023


Dear Michael:

Thank you, this is very helpful.

Questions/Comments:

1. Does this proposal changes the way events are dispatched with respect to priority?  In other words, does it first go through the list of all handlers registred on the leaf Node (high priority first, then lower, then lowest), then bubble up?  Or do they propagate upwards looking for high priority handlers first, then the process restarts for lower priorities, as I saw in some previous emails?  (I could be mistaken)

2. Do you propose to abort event dispatching immediately after the event is consumed?  This probably should be mentioned earlier in the Motivation (the problem statement) section.

3. I wonder if three priority levels are sufficient.  Let me explain.  We have two possible actors who can register an event listener: the application code and the FX (or, rather more specifically, the skin and its behavior, whatever that might be).

Application code might want to add handlers at three possible priorities:


  *   App handler must always be called before any fx handler
  *   App hander does not care
  *   App handler must always be called after any fx handlers

For fx/skin handlers we might have fewer levels:


  *   Skin handler does not care
  *   Skin handler must be called after all other skin handlers

This situation maps to 5 priorities and 4 effective levels (or 5).

We should also mention the fact that when any actor adds two or more handlers for the same event with the same priority, they get invoked in the order added.

Would you agree, or am I missing some critical aspect of the proposed solution?

Thank you
-andy





From: openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of Michael Strauß <michaelstrau2 at gmail.com>
Date: Friday, October 27, 2023 at 19:41
To: openjfx-dev <openjfx-dev at openjdk.org>
Subject: Re: Prioritized event handlers
Here is the proposal:
https://gist.github.com/mstr2/4bde9c97dcf608a0501030ade1ae7dc1

Comments are welcome.


On Fri, Oct 27, 2023 at 8:21 PM Andy Goryachev
<andy.goryachev at oracle.com> wrote:
>
> Would it be possible to create a proposal in the JEP format outlining the proposed public API?
>
>
>
> Thank you
>
> -andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20231030/f0fd3bf7/attachment-0001.htm>


More information about the openjfx-dev mailing list