org.ungoverned.oscar.util
Interface Dispatcher
public interface Dispatcher
This interface is used by DispatchQueue to dispatch events.
Generally speaking, each type of event to dispatch will have an instance
of a Dispatcher so that the dispatch queue can dispatch to
the appropriate listener method for the specific listener type,
for example:
Dispatcher d = new Dispatcher() {
public void dispatch(EventListener l, EventObject eventObj)
{
((FooListener) l).fooXXX((FooEvent) eventObj);
}
};
FooEvent event = new FooEvent(this);
dispatchQueue.dispatch(d, FooListener.class, event);
In the above code substitute a specific listener and event for the
Foo listener and event. Dispatchers can be reused, so
it is a good idea to cache them to avoid unnecessary memory allocations.
Method Summary |
void |
dispatch(java.util.EventListener l,
java.util.EventObject eventObj)
Dispatch an event to a specified event listener. |
dispatch
void dispatch(java.util.EventListener l,
java.util.EventObject eventObj)
- Dispatch an event to a specified event listener.
- Parameters:
l
- the event listener to receive the event.eventObj
- the event to dispatch.