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
Base class for objects that dispatch named events.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDefines the requirements for an object that listens to an event source. -
Field Summary
FieldsModifier and TypeFieldDescriptionHolds the event names and associated listeners in an array.protected booleanSpecifies if events can be fired.protected ObjectHolds the source object for this event source. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new event source using this as the source object.mxEventSource(Object source) Constructs a new event source for the given source object. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(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, Object sender) Dispatches the given event name, passing all arguments after the given name to the registered listeners for the event.booleanvoidremoveListener(mxEventSource.mxIEventListener listener) Function: removeListener Removes all occurances of the given listener from the list of listeners.voidremoveListener(mxEventSource.mxIEventListener listener, String eventName) Function: removeListener Removes all occurances of the given listener from the list of listeners.voidsetEventsEnabled(boolean eventsEnabled) voidsetEventSource(Object value)
-
Field Details
-
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
Holds the source object for this event source. -
eventsEnabled
protected boolean eventsEnabledSpecifies if events can be fired. Default is true.
-
-
Constructor Details
-
mxEventSource
public mxEventSource()Constructs a new event source using this as the source object. -
mxEventSource
Constructs a new event source for the given source object.
-
-
Method Details
-
getEventSource
-
setEventSource
-
isEventsEnabled
public boolean isEventsEnabled() -
setEventsEnabled
public void setEventsEnabled(boolean eventsEnabled) -
addListener
Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events. -
removeListener
Function: removeListener Removes all occurances of the given listener from the list of listeners. -
removeListener
Function: removeListener Removes all occurances of the given listener from the list of listeners. -
fireEvent
Dispatches the given event name with this object as the event source.fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN)) -
fireEvent
Dispatches the given event name, passing all arguments after the given name to the registered listeners for the event.
-