Maven module :un.api : api-common :
Class : un.api.event.EventManager
Extends/Implements : -
Subclasses : -

Convinient class to manage event listeners and send events.
author  Johann Sorel


Variables : EMPTY_EVENTLISTENER_ARRAY
Functions : hasListeners, getNbListeners, sendPropertyEvent, sendEvent, getListeners, getListeners, addEventListener, removeEventListener, removeAllListener


public EventListener[] EMPTY_EVENTLISTENER_ARRAY



Indicate if the manager currently stores listeners.
return  true if has listeners, false otherwise
public boolean hasListeners ()


Get number of listeners.
return  number of listeners.
public int getNbListeners ()


Send a property event to listeners.
param  source the event source
param  name name of the changed property
param  oldValue property old value
param  newValue property new value
public void sendPropertyEvent (EventSource source, Chars name, Object oldValue, Object newValue)


Send the given event to listeners registered for this class.
param  event event to send
public void sendEvent (Event event)

public EventListener[] getListeners (Class eventClass)

public EventListener[] getListeners (Predicate predicate)


Register a listener for the given type of event.
param  predicate, wanted event filter, can be null.
param  listener, listener to register, can not be null
public void addEventListener (Predicate predicate, EventListener listener)


Unregister a listener for the given type of event.
param  predicate, wanted event filter, can be null.
param  listener, listener to unregister
public void removeEventListener (Predicate predicate, EventListener listener)


Unregister all listeners.
public void removeAllListener ()