intarsys runtime library

de.intarsys.tools.event
Class DeferredEventDispatcher

java.lang.Object
  extended by de.intarsys.tools.event.DeferredEventDispatcher
All Implemented Interfaces:
INotificationListener, INotificationSupport, EventListener

public class DeferredEventDispatcher
extends Object
implements INotificationListener, INotificationSupport

Pluggable helper object for management and dispatching of events. This utility is quite handsome when you

Events are forwarded upon "flush" to all listeners in the thread of the caller.


Constructor Summary
DeferredEventDispatcher(EventDispatcher dispatcher)
           
DeferredEventDispatcher(Object owner)
           
 
Method Summary
 void addNotificationListener(EventType type, INotificationListener listener)
          Add listener to the collection of objects to be informed when the receiver triggers an event of type name.
 void flush()
           
 void handleEvent(Event event)
          Called when an event occurs.
 boolean hasListener()
           
 void removeNotificationListener(EventType type, INotificationListener listener)
          Remove listener from the collection of objects to be informed about events of type name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeferredEventDispatcher

public DeferredEventDispatcher(EventDispatcher dispatcher)

DeferredEventDispatcher

public DeferredEventDispatcher(Object owner)
Method Detail

addNotificationListener

public void addNotificationListener(EventType type,
                                    INotificationListener listener)
Description copied from interface: INotificationSupport
Add listener to the collection of objects to be informed when the receiver triggers an event of type name.

Specified by:
addNotificationListener in interface INotificationSupport
Parameters:
type - The event type we are interested in.
listener - The object to be informed about an event occurrence

flush

public void flush()

handleEvent

public void handleEvent(Event event)
Description copied from interface: INotificationListener
Called when an event occurs.

Specified by:
handleEvent in interface INotificationListener
Parameters:
event - The event object giving detail information about the context.

hasListener

public boolean hasListener()

removeNotificationListener

public void removeNotificationListener(EventType type,
                                       INotificationListener listener)
Description copied from interface: INotificationSupport
Remove listener from the collection of objects to be informed about events of type name.

Specified by:
removeNotificationListener in interface INotificationSupport
Parameters:
type - The event type we are no longer interested in.
listener - The object registered for the event till now.

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.