Package VASSAL.tools.concurrent.listener
Class DefaultMultiEventListenerSupport
java.lang.Object
VASSAL.tools.concurrent.listener.DefaultMultiEventListenerSupport
- All Implemented Interfaces:
MultiEventListenerSupport
A class to provide support for
EventListeners.- Since:
- 3.2.0
- Author:
- Joel Uckelman
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConcurrentMap<Class<?>,List<EventListener<?>>>protected Object -
Constructor Summary
ConstructorsConstructorDescriptionCreates aDefaultMultiEventListenerSupport. -
Method Summary
Modifier and TypeMethodDescription<T> voidaddEventListener(Class<T> c, EventListener<? super T> l)Adds anEventListener.<T> List<EventListener<? super T>>getEventListeners(Class<T> c)Gets the list of listeners.booleanhasEventListeners(Class<?> c)Checks whether there are anyEventListeners.voidNotify the listeners of an event.protected List<EventListener<?>>registerType(Class<?> c)<T> voidremoveEventListener(Class<T> c, EventListener<? super T> l)Removes anEventListener.
-
Field Details
-
listeners
-
src
-
-
Constructor Details
-
DefaultMultiEventListenerSupport
Creates aDefaultMultiEventListenerSupport.- Parameters:
src- the source of events
-
-
Method Details
-
addEventListener
Adds anEventListener.- Specified by:
addEventListenerin interfaceMultiEventListenerSupport- Parameters:
c- the class to listen forl- the listener to add
-
removeEventListener
Removes anEventListener.- Specified by:
removeEventListenerin interfaceMultiEventListenerSupport- Parameters:
c- the class to checkl- the listener to remove
-
hasEventListeners
Checks whether there are anyEventListeners.- Specified by:
hasEventListenersin interfaceMultiEventListenerSupport- Parameters:
c- the class to check- Returns:
trueif there are any listeners for the given class
-
getEventListeners
Gets the list of listeners.- Specified by:
getEventListenersin interfaceMultiEventListenerSupport- Parameters:
c- the class to check- Returns:
- the list of listeners for the given class
-
notify
Notify the listeners of an event.- Specified by:
notifyin interfaceMultiEventListenerSupport- Parameters:
event- the event to send
-
registerType
-