## net.i2p.util
Interface EventDispatcher

All Known Implementing Classes:
  EventDispatcherImpl, I2PTunnel, I2PTunnelTask

public interface EventDispatcher

Event dispatching interface. It allows objects to receive and notify data events (basically String->Object associations) and create notification chains. To ease the usage of this interface, you could define an EventDispatcherImpl attribute called `_event` (as suggested in EventDispatcherImpl documentation) and cut'n'paste the following default implementation: `public EventDispatcher getEventDispatcher() { return _event; } public void attachEventDispatcher(IEventDispatcher e) { _event.attachEventDispatcher(e.getEventDispatcher()); } public void detachEventDispatcher(IEventDispatcher e) { _event.detachEventDispatcher(e.getEventDispatcher()); } public void notifyEvent(String e, Object a) { _event.notifyEvent(e,a); } public Object getEventValue(String n) { return _event.getEventValue(n); } public Set getEvents() { return _event.getEvents(); } public void ignoreEvents() { _event.ignoreEvents(); } public void unIgnoreEvents() { _event.unIgnoreEvents(); } public Object waitEventValue(String n) { return _event.waitEventValue(n); }`

Author:
  human

Method Summary
`void` `attachEventDispatcher(EventDispatcher iev)` Attach an EventDispatcher object to the events dispatching chain.
`void` `detachEventDispatcher(EventDispatcher iev)` Detach the specified EventDispatcher object from the events dispatching chain.
`EventDispatcher` `getEventDispatcher()` Get an object to be used to deliver events (usually `this`, but YMMV).
`java.util.Set` `getEvents()` Retrieve the names of all the events that have been received
`java.lang.Object` `getEventValue(java.lang.String name)` Retrieve the value currently associated with the specified event value
`void` `ignoreEvents()` Ignore further event notifications
`void` `notifyEvent(java.lang.String event, java.lang.Object args)` Deliver an event
`void` `unIgnoreEvents()` Almost like the method above :-)
`java.lang.Object` `waitEventValue(java.lang.String name)` Wait until the given event has received a value

Method Detail

### getEventDispatcher

    public EventDispatcher getEventDispatcher()

  Get an object to be used to deliver events (usually `this`, but YMMV).

### attachEventDispatcher

    public void attachEventDispatcher(EventDispatcher iev)

  Attach an EventDispatcher object to the events dispatching chain. Note that notification is not bidirectional (i.e. events notified to `ev` won't reach the object calling this method). Good luck, and beware of notification loops! :-)

  Parameters:
    `iev` - Event object to be attached

### detachEventDispatcher

    public void detachEventDispatcher(EventDispatcher iev)

  Detach the specified EventDispatcher object from the events dispatching chain.

  Parameters:
    `iev` - Event object to be detached

### notifyEvent

    public void notifyEvent(java.lang.String event,
                            java.lang.Object args)

  Deliver an event

  Parameters:
    `event` - name of the event
    `args` - data being stored for that event

### getEventValue

    public java.lang.Object getEventValue(java.lang.String name)

  Retrieve the value currently associated with the specified event value

  Parameters:
    `name` - name of the event to query for
  Returns:
    value (or null if none are available)

### getEvents

    public java.util.Set getEvents()

  Retrieve the names of all the events that have been received

  Returns:
    A set of event names

### ignoreEvents

    public void ignoreEvents()

  Ignore further event notifications

### unIgnoreEvents

    public void unIgnoreEvents()

  Almost like the method above :-)

### waitEventValue

    public java.lang.Object waitEventValue(java.lang.String name)

  Wait until the given event has received a value

  Parameters:
    `name` - name of the event to wait for
  Returns:
    value specified for that event