net.sf.j3d.threeD.ui.event
Class EventHandler

java.lang.Object
  extended by net.sf.j3d.threeD.ui.event.EventHandler

public class EventHandler
extends Object

An EventHandler object provides an interface for comunication between EventGenerators and EventListeners.


Constructor Summary
EventHandler()
          Constructs a new EventHandler object with no listeners.
 
Method Summary
 void addListener(EventListener listener)
          Adds the specified EventListener to this EventHandler.
 void fireEvent(Event event)
          Notifies all current EventListeners that an event has been fired.
 EventListener getListener(int index)
          Returns the specified EventListener.
 int getTotalListeners()
          Returns the number of EventListeners currently registered with this EventHandler.
 void removeListener(EventListener listener)
          Removes the specified EventListener from this EventHandler.
 void removeListener(int index)
          Removes the specified EventListener from this EventHandler.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventHandler

public EventHandler()
Constructs a new EventHandler object with no listeners.

Method Detail

addListener

public void addListener(EventListener listener)
Adds the specified EventListener to this EventHandler. The listener will be notified through its eventFired method when an event has been fired.


removeListener

public void removeListener(int index)
Removes the specified EventListener from this EventHandler.


removeListener

public void removeListener(EventListener listener)
Removes the specified EventListener from this EventHandler.


getListener

public EventListener getListener(int index)
Returns the specified EventListener.


getTotalListeners

public int getTotalListeners()
Returns the number of EventListeners currently registered with this EventHandler.


fireEvent

public void fireEvent(Event event)
Notifies all current EventListeners that an event has been fired. If the event is an instance of DialogCloseEvent and the Dialog object stored by the event is a registered as a listener with this EventHandler object, the dialog will be removed. If the dialog is registered more than once, only the first instance will be removed.