<!-- saved from url=(0026)http://www.naturaldocs.org -->
<divid=Content><divclass="CClass"><divclass=CTopicid=MainTopic><h1class=CTitle><aname="mxEventSource"></a>mxEventSource</h1><divclass=CBody><p>Base class for objects that dispatch named events. To create a subclass that inherits from mxEventSource, the following code is used.</p><blockquote><preclass="prettyprint">function MyClass() { };
MyClass.prototype = new mxEventSource();
MyClass.prototype.constructor = MyClass;</pre></blockquote><h4class=CHeading>Known Subclasses</h4><p><ahref="../model/mxGraphModel-js.html#mxGraphModel"class=LClassid=link17onMouseOver="ShowTip(event, 'tt12', 'link17')"onMouseOut="HideTip('tt12')">mxGraphModel</a>, <ahref="../view/mxGraph-js.html#mxGraph"class=LClassid=link18onMouseOver="ShowTip(event, 'tt13', 'link18')"onMouseOut="HideTip('tt13')">mxGraph</a>, <ahref="../view/mxGraphView-js.html#mxGraphView"class=LClassid=link19onMouseOver="ShowTip(event, 'tt14', 'link19')"onMouseOut="HideTip('tt14')">mxGraphView</a>, <ahref="../editor/mxEditor-js.html#mxEditor"class=LClassid=link20onMouseOver="ShowTip(event, 'tt15', 'link20')"onMouseOut="HideTip('tt15')">mxEditor</a>, <ahref="../view/mxCellOverlay-js.html#mxCellOverlay"class=LClassid=link21onMouseOver="ShowTip(event, 'tt16', 'link21')"onMouseOut="HideTip('tt16')">mxCellOverlay</a>, <ahref="mxToolbar-js.html#mxToolbar"class=LClassid=link22onMouseOver="ShowTip(event, 'tt17', 'link22')"onMouseOut="HideTip('tt17')">mxToolbar</a>, <ahref="mxWindow-js.html#mxWindow"class=LClassid=link23onMouseOver="ShowTip(event, 'tt18', 'link23')"onMouseOut="HideTip('tt18')">mxWindow</a></p><!--START_ND_SUMMARY--><divclass=Summary><divclass=STitle>Summary</div><divclass=SBorder><tableborder=0cellspacing=0cellpadding=0class=STable><trclass="SMain"><tdclass=SEntry><ahref="#mxEventSource">mxEventSource</a></td><tdclass=SDescription>Base class for objects that dispatch named events. </td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxEventSource.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxEventSource.mxEventSource"id=link1onMouseOver="ShowTip(event, 'tt1', 'link1')"onMouseOut="HideTip('tt1')">mxEventSource</a></td><tdclass=SDescription>Constructs a new event source.</td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxEventSource.Variables">Variables</a></td><tdclass=SDescription></td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxEventSource.eventListeners"id=link2onMouseOver="ShowTip(event, 'tt2', 'link2')"onMouseOut="HideTip('tt2')">eventListeners</a></td><tdclass=SDescription>Holds the event names and associated listeners in an array. </td></tr><trclass="SVariable SIndent2"><tdclass=SEntry><ahref="#mxEventSource.eventsEnabled"id=link3onMouseOver="ShowTip(event, 'tt3', 'link3')"onMouseOut="HideTip('tt3')">eventsEnabled</a></td><tdclass=SDescription>Specifies if events can be fired. </td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxEventSource.eventSource"id=link4onMouseOver="ShowTip(event, 'tt4', 'link4')"onMouseOut="HideTip('tt4')">eventSource</a></td><tdclass=SDescription>Optional source for events. </td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxEventSource.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxEventSource.isEventsEnabled"id=link5onMouseOver="ShowTip(event, 'tt5', 'link5')"onMouseOut="HideTip('tt5')">isEventsEnabled</a></td><tdclass=SDescription>Returns <ahref="#mxEventSource.eventsEnabled"class=LVariableid=link6onMouseOver="ShowTip(event, 'tt3', 'link6')"onMouseOut="HideTip('tt3')">eventsEnabled</a>.</td></tr><trclass="SFunction SIndent2"><tdclass=SEntry><ahref="#mxEventSource.setEventsEnabled"id=link7onMouseOver="ShowTip(event, 'tt6', 'link7')"onMouseOut="HideTip('tt6')">setEventsEnabled</a></td><tdclass=SDescription>Sets <ahref="#mxEventSource.eventsEnabled"class=LVariableid=link8onMouseOver="ShowTip(event, 'tt3', 'link8')"onMouseOut="HideTip('tt3')">eventsEnabled</a>.</td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxEventSource.getEventSource"id=link9onMouseOver="ShowTip(event, 'tt7', 'link9')"onMouseOut="HideTip('tt7')">getEventSource</a></td><tdclass=SDescription>Returns <ahref="#mxEventSource.eventSource"class=LVariableid=link10onM
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxEventSource.mxEventSource"></a>mxEventSource</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function mxEventSource(</td><tdclass=PParameternowrap>eventSource</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Constructs a new event source.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxEventSource.eventListeners"></a>eventListeners</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxEventSource.prototype.eventListeners</td></tr></table></blockquote><p>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.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxEventSource.eventsEnabled"></a>eventsEnabled</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxEventSource.prototype.eventsEnabled</td></tr></table></blockquote><p>Specifies if events can be fired. Default is true.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxEventSource.eventSource"></a>eventSource</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxEventSource.prototype.eventSource</td></tr></table></blockquote><p>Optional source for events. Default is null.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxEventSource.addListener"></a>addListener</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxEventSource.prototype.addListener = function(</td><tdclass=PParameternowrap>name,</td></tr><tr><td></td><tdclass=PParameternowrap>funct</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Binds the specified function to the given event name. If no event name is given, then the listener is registered for all events.</p><p>The parameters of the listener are the sender and an <ahref="mxEventObject-js.html#mxEventObject"class=LClassid=link28onMouseOver="ShowTip(event, 'tt19', 'link28')"onMouseOut="HideTip('tt19')">mxEventObject</a>.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxEventSource.removeListener"></a>removeListener</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxEventSource.prototype.removeListener = function(</td><tdclass=PParameternowrap>funct</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Removes all occurrences of the given listener from <ahref="#mxEventSource.eventListeners"class=LVariableid=link29onMouseOver="ShowTip(event, 'tt2', 'link29')"onMouseOut="HideTip('tt2')">eventListeners</a>.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxEventSource.fireEvent"></a>fireEvent</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxEventSource.prototype.fireEvent = function(</td><tdclass=PParameternowrap>evt,</td></tr><tr><td></td><tdclass=PParameternowrap>sender</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>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 <ahref="mxUtils-js.html#mxUtils.bind"class=LFunctionid=link30onMouseOver="ShowTip(event, 'tt20', 'link30')"onMouseOut="HideTip('tt20')">mxUtils.bind</a>).</p><h4class=CHeading>Example</h4><blockquote><preclass="prettyprint">fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN))</pre></blockquote><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>evt</td><tdclass=CDLDescription><ahref="mxEventObject-js.html#mxEventObject"class=LClassid=link31onMouseOver="ShowTip(event, 'tt19', 'link31')"onMouseOut="HideTip('tt19')">mxEventObject</a> that represents the event.</td></tr><tr><tdclass=CDLEntry>sender</td><tdclass=CDLDescription>Optional sender to be passed to the listener. Default value is the return value of <ahref="#mxEventSource.getEventSource"class=LFunctionid=link32onMouseOver="ShowTip(event, 'tt7', 'link32')"onMouseOut="HideTip('tt7')">getEventSource</a>.</td></tr></table></div></div></div>
</div><!--Content-->
<divid=Footer><ahref="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<divclass=CToolTipid="tt1"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function mxEventSource(</td><tdclass=PParameternowrap>eventSource</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Constructs a new event source.</div></div><divclass=CToolTipid="tt2"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxEventSource.prototype.eventListeners</td></tr></table></blockquote>Holds the event names and associated listeners in an array. </div></div><divclass=CToolTipid="tt3"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxEventSource.prototype.eventsEnabled</td></tr></table></blockquote>Specifies if events can be fired. </div></div><divclass=CToolTipid="tt4"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxEventSource.prototype.eventSource</td></tr></table></blockquote>Optional source for events. </div></div><divclass=CToolTipid="tt5"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxEventSource.prototype.isEventsEnabled = function()</td></tr></table></blockquote>Returns eventsEnabled.</div></div><divclass=CToolTipid="tt6"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxEventSource.prototype.setEventsEnabled = function(</td><tdclass=PParameternowrap>value</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Sets eventsEnabled.</div></div><divclass=CToolTipid="tt7"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxEventSource.prototype.getEventSource = function()</td></tr></table></blockquote>Returns eventSource.</div></div><divclass=CToolTipid="tt8"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxEventSource.prototype.setEventSource = function(</td><tdclass=PParameternowrap>value</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Sets eventSource.</div></div><divclass=CToolTipid="tt9"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxEventSource.prototype.addListener = function(</td><tdclass=PParameternowrap>name,</td></tr><tr><td></td><tdclass=PParameternowrap>funct</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Binds the specified function to the given event name. </div></div><divclass=CToolTipid="tt10"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxEventSource.prototype.removeListener = function(</td><tdclass=PParameternowrap>funct</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Removes all occurrences of the given listener from eventListeners.</div></div><divclass=CToolTipid="tt11"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxEventSource.prototype.fireEvent = function(</td><tdclass=PParameternowrap>evt,</td></tr><tr><td></td><tdclass=PParameternowrap>sender</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Dispatches the given event