How to register a global listener for UI updates

Hi there,

is there a way to register a global listener which updates the UI after the regular UI-updates?

Background:
I need to include legacy code in my application, which has no general event concept.
This code can generate multiple messages for one user-action which have to be shown as modal-confirmations to the user
in a predefined order.

Imagine following scenario:

  1. The user clicks a button which causes creation of several messages.
  2. After all messages have been created the message with the highest priority must be shown in the UI.

Of course i could update the the UI whenever a new message is created. But this would be It would be inefficient. Alternatively I could introduce a global event bus and after every user action fire an event. But this is also inefficient because i have to fire the event from many source-code-places. Better would be to register one global handler at application startup, which is automatically called for every request.

Any idea?

Best Regards, Andreas