|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.richclient.application.support.ApplicationEventRedispatcher
public class ApplicationEventRedispatcher
This class is responsible for re-dispatching application events to a collection of additional registered listeners. This is needed due to the way that the application context handles the ApplicationListener tag interface. For any beans that are prototypes, one instance will be registered as an ApplicationListener and all the others will not. Further, there is no mechanism to get a reference to the context's event dispatcher to add listeners at runtime.
By defining a bean with this type in the context, it will be added as a typical event
listener. Then, this dispatcher can be set on any other bean (including prototypes)
that need to be added to the event mechanism. In order to wire it all together, any
object that wants to register for events simply defines a property of type
ApplicationEventDispatcher and in the property setter method, call the
addListener(ApplicationListener)
method on itself (or a delegate handler).
Like this:
public void setApplicationEventRedispatcher( ApplicationEventRedispatcher dispatcher ) { dispatcher.addListener(this); }
Constructor Summary | |
---|---|
ApplicationEventRedispatcher()
|
Method Summary | |
---|---|
void |
addListener(ApplicationListener l)
Add a listener to our set. |
void |
onApplicationEvent(ApplicationEvent event)
Handle an application event, dispatch it to all our delegates. |
void |
removeListener(ApplicationListener l)
Remove a listener from our set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ApplicationEventRedispatcher()
Method Detail |
---|
public void onApplicationEvent(ApplicationEvent event)
onApplicationEvent
in interface ApplicationListener
event
- to dispatchpublic void addListener(ApplicationListener l)
l
- Listener to addpublic void removeListener(ApplicationListener l)
l
- Listener to remove
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |