mxEventSource

Base class for objects that dispatch named events.  To create a subclass that inherits from mxEventSource, the following code is used.

function MyClass() { };

MyClass.prototype = new mxEventSource();
MyClass.prototype.constructor = MyClass;

Known Subclasses

mxGraphModel, mxGraph, mxGraphView, mxEditor, mxCellOverlay, mxToolbar, mxWindow

Summary
mxEventSourceBase class for objects that dispatch named events.
Functions
mxEventSourceConstructs a new event source.
Variables
eventListenersHolds the event names and associated listeners in an array.
eventsEnabledSpecifies if events can be fired.
eventSourceOptional source for events.
Functions
isEventsEnabledReturns eventsEnabled.
setEventsEnabledSets eventsEnabled.
getEventSourceReturns eventSource.
setEventSourceSets eventSource.
addListenerBinds the specified function to the given event name.
removeListenerRemoves all occurrences of the given listener from eventListeners.
fireEventDispatches the given event to the listeners which are registered for the event.

Functions

mxEventSource

function mxEventSource(eventSource)

Constructs a new event source.

Variables

eventListeners

mxEventSource.prototype.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.

eventsEnabled

mxEventSource.prototype.eventsEnabled

Specifies if events can be fired.  Default is true.

eventSource

mxEventSource.prototype.eventSource

Optional source for events.  Default is null.

Functions

isEventsEnabled

mxEventSource.prototype.isEventsEnabled = function()

Returns eventsEnabled.

setEventsEnabled

mxEventSource.prototype.setEventsEnabled = function(value)

Sets eventsEnabled.

getEventSource

mxEventSource.prototype.getEventSource = function()

Returns eventSource.

setEventSource

mxEventSource.prototype.setEventSource = function(value)

Sets eventSource.

addListener

mxEventSource.prototype.addListener = function(name,
funct)

Binds the specified function to the given event name.  If no event name is given, then the listener is registered for all events.

The parameters of the listener are the sender and an mxEventObject.

removeListener

mxEventSource.prototype.removeListener = function(funct)

Removes all occurrences of the given listener from eventListeners.

fireEvent

mxEventSource.prototype.fireEvent = function(evt,
sender)

Dispatches the given event to the listeners which are registered for the event.  The sender argument is optional.  The current execution scope (“this”) is used for the listener invocation (see mxUtils.bind).

Example

fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))

Parameters

evtmxEventObject that represents the event.
senderOptional sender to be passed to the listener.  Default value is the return value of getEventSource.
function mxEventSource(eventSource)
Constructs a new event source.
mxEventSource.prototype.eventListeners
Holds the event names and associated listeners in an array.
mxEventSource.prototype.eventsEnabled
Specifies if events can be fired.
mxEventSource.prototype.eventSource
Optional source for events.
mxEventSource.prototype.isEventsEnabled = function()
Returns eventsEnabled.
mxEventSource.prototype.setEventsEnabled = function(value)
Sets eventsEnabled.
mxEventSource.prototype.getEventSource = function()
Returns eventSource.
mxEventSource.prototype.setEventSource = function(value)
Sets eventSource.
mxEventSource.prototype.addListener = function(name,
funct)
Binds the specified function to the given event name.
mxEventSource.prototype.removeListener = function(funct)
Removes all occurrences of the given listener from eventListeners.
mxEventSource.prototype.fireEvent = function(evt,
sender)
Dispatches the given event to the listeners which are registered for the event.
Extends mxEventSource to implement a graph model.
Extends mxEventSource to implement a graph component for the browser.
Extends mxEventSource to implement a view for a graph.
Extends mxEventSource to implement a application wrapper for a graph that adds actions, I/O using mxCodec, auto-layout using mxLayoutManager, command history using undoManager, and standard dialogs and widgets, eg.
Extends mxEventSource to implement a graph overlay, represented by an icon and a tooltip.
Creates a toolbar inside a given DOM node.
Basic window inside a document.
The mxEventObject is a wrapper for all properties of a single event.
bind: function(scope,
funct)
Returns a wrapper function that locks the execution scope of the given function to the specified scope.
Close