fr.jussieu.gla.wasa.monitor.gui.bus
Class EventBus
java.lang.Object
|
+--fr.jussieu.gla.wasa.monitor.gui.bus.EventBus
- public class EventBus
- extends java.lang.Object
An event "bus" providing a centralized place for posting
and recieving generic application events. To receive events a class must
implement the "BusMember" interface. When registering as a member, an
"interrupt level" is provided, which specifies a relative ordering level
that the member wishes to receive events for. By convention, a member
can be registered at the MONITORING, VETOING, or RESPONDING levels, which
correspond to recieving events first to receiving events last. If a member
receives an event, the event is of type AntEvent, and the member calls the
AntEvent.cancel() method, the event is not then delivered
to subsequent members. Members also indicate interest in an event
by providing an instance of the BusFilter interface.
NB: This class is overly simple right now, but will eventually
be expanded to do better event filtering, interrupt levels, etc.
- Version:
- $Revision: 1.2 $ $Date: 2002/03/22 08:41:28 $
- Author:
- Simeon Fitch (source taken out from Ant Antidote)
Field Summary |
static int |
MAX_INTERRUPT
The maximum valid interrupt value. |
static int |
MONITORING
The default "monitoring" interrupt level, used by members who
are only listeners/monitors of events. |
static int |
RESPONDING
The default "responding" interrupt level, for members who service
events in a default manner. |
static int |
VETOING
The default "vetoing" interrupt level, used by bus members
whose role is to veto request events or otherwise handle an
event before it is processed by the default handler. |
Constructor Summary |
EventBus()
Default constructor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VETOING
public static final int VETOING
- The default "vetoing" interrupt level, used by bus members
whose role is to veto request events or otherwise handle an
event before it is processed by the default handler.
MONITORING
public static final int MONITORING
- The default "monitoring" interrupt level, used by members who
are only listeners/monitors of events.
RESPONDING
public static final int RESPONDING
- The default "responding" interrupt level, for members who service
events in a default manner.
MAX_INTERRUPT
public static final int MAX_INTERRUPT
- The maximum valid interrupt value.
EventBus
public EventBus()
- Default constructor.
addMember
public void addMember(int intLevel,
IBusMember member)
- Add a member to the bus.
- Parameters:
intLevel
- Interrupt level.member
- Member to add.
removeMember
public void removeMember(IBusMember member)
- Remove a member from the bus.
- Parameters:
member
- Member to remove.
postEvent
public void postEvent(java.util.EventObject event)
- Method used for sending an event to the bus.
- Parameters:
event
- Event to post.