KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > za > org > coefficient > events > EventDispatcher


1 package za.org.coefficient.events;
2
3 import za.org.coefficient.util.common.InvokerFactory;
4
5 /**
6  * Class: EventDispatcher
7  * Description: The EventDispatcher dispatches coefficient system events to the appropriate handlers.
8  * @author tfogwill
9  */

10 public class EventDispatcher {
11     
12     /**
13      * Dispatch an event to all appropriate handlers
14      * @param event The event
15      */

16     public void dispatchEvent(CoefficientEvent event){
17         CoefficientEventHandler[] handlers = EventHandlerRegistry.getInstance().getHandlers(event.getClass());
18         if (handlers == null) return;
19         for (int i = 0; i < handlers.length; i++) {
20             //TODO: think about remote invocation
21
handlers[i].handleEvent(event);
22         }
23     }
24 }
25
Popular Tags