Package com.nevergarden.myna.events
Class EventDispatcher
- java.lang.Object
-
- com.nevergarden.myna.events.EventDispatcher
-
- Direct Known Subclasses:
AsyncTexture
,AsyncTPAtlas
,DisplayObject
,View
public class EventDispatcher extends java.lang.Object
Base class for dispatching events
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.util.ArrayList<EventListener>>
eventListeners
Map of type to event listeners.
-
Constructor Summary
Constructors Constructor Description EventDispatcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEventListener(java.lang.String type, EventListener listener)
Adds a new event listener of type to dispatcher.void
dispatchEvent(IEvent event)
Sends a new event.void
dispatchEventWith(java.lang.String name)
Sends a new event with type only.void
dispatchEventWith(java.lang.String type, java.lang.Boolean bubbles, java.lang.Object data)
Sends a new event with values.void
dispose()
Disposes the event dispatcher.java.lang.Boolean
hasEventListener(java.lang.String type, EventListener listener)
Checks if has an event listener.void
invokeEvent(IEvent event)
Invokes the eventvoid
removeEventListener(java.lang.String type, EventListener listener)
Removes an event listener of type.void
removeEventListeners(java.lang.String type)
Removes all event listeners of type.
-
-
-
Field Detail
-
eventListeners
protected java.util.Map<java.lang.String,java.util.ArrayList<EventListener>> eventListeners
Map of type to event listeners.
-
-
Method Detail
-
addEventListener
public void addEventListener(java.lang.String type, EventListener listener)
Adds a new event listener of type to dispatcher.
-
removeEventListener
public void removeEventListener(java.lang.String type, EventListener listener)
Removes an event listener of type.
-
removeEventListeners
public void removeEventListeners(java.lang.String type)
Removes all event listeners of type.
-
hasEventListener
public java.lang.Boolean hasEventListener(java.lang.String type, EventListener listener)
Checks if has an event listener.
-
invokeEvent
public void invokeEvent(IEvent event)
Invokes the event
-
dispatchEvent
public void dispatchEvent(IEvent event)
Sends a new event.
-
dispatchEventWith
public void dispatchEventWith(java.lang.String name)
Sends a new event with type only.
-
dispatchEventWith
public void dispatchEventWith(java.lang.String type, java.lang.Boolean bubbles, java.lang.Object data)
Sends a new event with values.
-
dispose
public void dispose()
Disposes the event dispatcher.
-
-