Messages that can be caught by "any" component


#1

Hi Jucers,

Is there a mechanism that can send messages that later can be caught by any listener component?

My problem is this:

I don’t think I can use the ApplicationCommandManager stuff, because the messages die after they get serviced (actions performed) by a target. In my app there are messages that several components are interested in.

There are those very nice ActionBroadcasters and ActionListeners, but these require registering them. It’ fine in most cases, but in complex applications, it’s awkward to let all the broadcaster know about the different listeners scattered around the UI.

What I’m looking for is broadcasters that dump the messages to a global (singleton?) manager, which in turn dispatches the messages to ALL instances of a listener class. They decide if they do anything with the message or not. Hope this makes sense :slight_smile:


#2

You could write your own listener class which registers as a listener of a singleton in its constructor, and deregisters in its destructor.


#3

Thanks, I’ll give it a shot.