com.jstatcom.model
Class JSCDataEventSupport
- java.lang.Object
-
- com.jstatcom.model.JSCDataEventSupport
-
public final class JSCDataEventSupport extends java.lang.ObjectA support class forJSCDataobjects that manages adding, removing and notification of the differentJSCDataListener.This class is not thread-save but clients must handle synchronization.
-
-
Constructor Summary
Constructors Constructor and Description JSCDataEventSupport()JSCDataEventSupportconstructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddListener(JSCDataListener evtListener, JSCDataEventTypes evtType)AddsevtListenerto the list of listeners for events of typeevtType.voiddispatchEvent(JSCDataEvent evt)Dispatchesevtby callingvalueChangedof all registered listeners to events of typeevt.getType.java.util.List<JSCDataListener>getListenersForType(JSCDataEventTypes evtType)Gets a list with all registered listeners forevtType.voidremoveListener(JSCDataListener evtListener)RemovesevtListenerfrom all listener lists.java.lang.StringtoString()Gets a string representation of this.
-
-
-
Constructor Detail
-
JSCDataEventSupport
public JSCDataEventSupport()
JSCDataEventSupportconstructor.
-
-
Method Detail
-
addListener
public void addListener(JSCDataListener evtListener, JSCDataEventTypes evtType)
AddsevtListenerto the list of listeners for events of typeevtType.- Parameters:
evtListener- theJSCDataListenerthat gets notified whenever an event ofevtTypeoccursevtType- the event type- Throws:
java.lang.IllegalArgumentException-if (evtListener == null || evtType == null)
-
dispatchEvent
public void dispatchEvent(JSCDataEvent evt)
Dispatchesevtby callingvalueChangedof all registered listeners to events of typeevt.getType.- Parameters:
evt- the event to be dispatched- Throws:
java.lang.IllegalArgumentException-if (evt == null)
-
getListenersForType
public java.util.List<JSCDataListener> getListenersForType(JSCDataEventTypes evtType)
Gets a list with all registered listeners forevtType.- Parameters:
evtType- the event type- Returns:
- a copy of the respective list or an initialized list instance
with size == 0 if no listeners are registered for
evtType
-
removeListener
public void removeListener(JSCDataListener evtListener)
RemovesevtListenerfrom all listener lists. Nothing happens ifevtListeneris currently not a listener.- Parameters:
evtListener- theJSCDataListenerto be removed- Throws:
java.lang.IllegalArgumentException-if (evtListener == null)
-
toString
public java.lang.String toString()
Gets a string representation of this.- Overrides:
toStringin classjava.lang.Object- Returns:
- informative string representation
-
-
DMelt 3.0 © DataMelt by jWork.ORG