Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.blojsom.event
Class SimpleEventBroadcaster

    java.lang.Object
      org.blojsom.event.SimpleEventBroadcaster

All Implemented Interfaces:
  EventBroadcaster

public class SimpleEventBroadcaster
extends java.lang.Object
implements EventBroadcaster

SimpleEventBroadcaster.

Events are broadcast to each event in a separate thread so that the broadcaster is not a bottleneck. No defined order is set for how each event will receive an event, so you should not assume any order in listeners being called. No steps are taken to ensure a event does not receive an event if it is removed at the same time an event is being broadcast.

The addition of the `processEvent(Event)` method adds the capability for components to have an event processed after the call instead of asynchronously as with the `broadcastEvent(Event)` method.

Since:
  blojsom 3.0
Version:
  $Id: SimpleEventBroadcaster.java,v 1.1 2006/03/20 21:31:13 czarneckid Exp $
Author:
  David Czarnecki

Nested Class Summary
`protected class` | `SimpleEventBroadcaster.EventHandler` Event handler helper class.

Constructor Summary
`SimpleEventBroadcaster()` Default constructor.

Method Summary
`void` | `addListener(Listener listener)` Add a event to this event broadcaster
`void` | `addListener(Listener listener, Filter filter)` Add a event to this event broadcaster.
`void` | `broadcastEvent(Event event)` Broadcast an event to all listeners
`void` | `processEvent(Event event)` Process an event with all listeners
`void` | `removeListener(Listener listener)` Remove a event from this event broadcaster

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SimpleEventBroadcaster

    public SimpleEventBroadcaster()

  Default constructor.

Method Detail

### addListener

    public void addListener(Listener listener)

  Add a event to this event broadcaster

  Specified by:
    `addListener` in interface `EventBroadcaster`
  Parameters:
    `listener` - `Listener`

### addListener

    public void addListener(Listener listener,
                            Filter filter)

  Add a event to this event broadcaster. Events are filtered using the `Filter` instance passed to this method.

  Specified by:
    `addListener` in interface `EventBroadcaster`
  Parameters:
    `listener` - `Listener`
    `filter` - `Filter` used to filter events

### removeListener

    public void removeListener(Listener listener)

  Remove a event from this event broadcaster

  Specified by:
    `removeListener` in interface `EventBroadcaster`
  Parameters:
    `listener` - `Listener`

### broadcastEvent

    public void broadcastEvent(Event event)

  Broadcast an event to all listeners

  Specified by:
    `broadcastEvent` in interface `EventBroadcaster`
  Parameters:
    `event` - `Event` to be broadcast to all listeners

### processEvent

    public void processEvent(Event event)

  Process an event with all listeners

  Specified by:
    `processEvent` in interface `EventBroadcaster`
  Parameters:
    `event` - `Event` to be processed by all listeners

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD