Package com.mxgraph.util
Class mxEventSource
- java.lang.Object
-
- com.mxgraph.util.mxEventSource
-
- Direct Known Subclasses:
mxAnimation,mxConnectPreview,mxGraph,mxGraphModel,mxGraphSelectionModel,mxGraphView,mxLayoutManager,mxMovePreview,mxSwimlaneManager,mxUndoManager
public class mxEventSource extends java.lang.ObjectBase class for objects that dispatch named events.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacemxEventSource.mxIEventListenerDefines the requirements for an object that listens to an event source.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.Object>eventListenersHolds the event names and associated listeners in an array.protected booleaneventsEnabledSpecifies if events can be fired.protected java.lang.ObjecteventSourceHolds the source object for this event source.
-
Constructor Summary
Constructors Constructor Description mxEventSource()Constructs a new event source using this as the source object.mxEventSource(java.lang.Object source)Constructs a new event source for the given source object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(java.lang.String eventName, mxEventSource.mxIEventListener listener)Binds the specified function to the given event name.voidfireEvent(mxEventObject evt)Dispatches the given event name with this object as the event source.voidfireEvent(mxEventObject evt, java.lang.Object sender)Dispatches the given event name, passing all arguments after the given name to the registered listeners for the event.java.lang.ObjectgetEventSource()booleanisEventsEnabled()voidremoveListener(mxEventSource.mxIEventListener listener)Function: removeListener Removes all occurances of the given listener from the list of listeners.voidremoveListener(mxEventSource.mxIEventListener listener, java.lang.String eventName)Function: removeListener Removes all occurances of the given listener from the list of listeners.voidsetEventsEnabled(boolean eventsEnabled)voidsetEventSource(java.lang.Object value)
-
-
-
Field Detail
-
eventListeners
protected transient java.util.List<java.lang.Object> eventListeners
Holds the event names and associated listeners in an array. The array contains the event name followed by the respective listener for each registered listener.
-
eventSource
protected java.lang.Object eventSource
Holds the source object for this event source.
-
eventsEnabled
protected boolean eventsEnabled
Specifies if events can be fired. Default is true.
-
-
Method Detail
-
getEventSource
public java.lang.Object getEventSource()
-
setEventSource
public void setEventSource(java.lang.Object value)
-
isEventsEnabled
public boolean isEventsEnabled()
-
setEventsEnabled
public void setEventsEnabled(boolean eventsEnabled)
-
addListener
public void addListener(java.lang.String eventName, mxEventSource.mxIEventListener listener)Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events.
-
removeListener
public void removeListener(mxEventSource.mxIEventListener listener)
Function: removeListener Removes all occurances of the given listener from the list of listeners.
-
removeListener
public void removeListener(mxEventSource.mxIEventListener listener, java.lang.String eventName)
Function: removeListener Removes all occurances of the given listener from the list of listeners.
-
fireEvent
public void fireEvent(mxEventObject evt)
Dispatches the given event name with this object as the event source.fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))
-
fireEvent
public void fireEvent(mxEventObject evt, java.lang.Object sender)
Dispatches the given event name, passing all arguments after the given name to the registered listeners for the event.
-
-