mxEventSource (JGraph X 2.1.0.7 API Specification)
Date: 2013-07-31

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph X 2.1.0.7
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.mxgraph.util
Class mxEventSource

    java.lang.Object
      com.mxgraph.util.mxEventSource

Direct Known Subclasses:
  mxAnimation, mxConnectPreview, mxGraph, mxGraphModel, mxGraphSelectionModel, mxGraphView, mxLayoutManager, mxMovePreview, mxSharedState, mxSpaceManager, mxSwimlaneManager, mxUndoManager

    public class mxEventSource

extends Object

Base class for objects that dispatch named events.

Nested Class Summary
`static interface` | `mxEventSource.mxIEventListener` Defines the requirements for an object that listens to an event source.

Field Summary
`protected List<Object>` | `eventListeners` Holds the event names and associated listeners in an array.
`protected boolean` | `eventsEnabled` Specifies if events can be fired.
`protected Object` | `eventSource` Holds the source object for this event source.

Constructor Summary
`mxEventSource()` Constructs 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
`void` | `addListener(String eventName, mxEventSource.mxIEventListener listener)` Binds the specified function to the given event name.
`void` | `fireEvent(mxEventObject evt)` Dispatches the given event name with this object as the event source.
`void` | `fireEvent(mxEventObject evt, Object sender)` Dispatches the given event name, passing all arguments after the given name to the registered listeners for the event.
`Object` | `getEventSource()`
`boolean` | `isEventsEnabled()`
`void` | `removeListener(mxEventSource.mxIEventListener listener)` Function: removeListener Removes all occurances of the given listener from the list of listeners.
`void` | `removeListener(mxEventSource.mxIEventListener listener, String eventName)` Function: removeListener Removes all occurances of the given listener from the list of listeners.
`void` | `setEventsEnabled(boolean eventsEnabled)`
`void` | `setEventSource(Object value)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### eventListeners

    protected transient List<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 Object eventSource

  Holds the source object for this event source.

### eventsEnabled

    protected boolean eventsEnabled

  Specifies if events can be fired. Default is true.

Constructor Detail

### mxEventSource

    public mxEventSource()

  Constructs a new event source using this as the source object.

### mxEventSource

    public mxEventSource(Object source)

  Constructs a new event source for the given source object.

Method Detail

### getEventSource

    public Object getEventSource()

### setEventSource

    public void setEventSource(Object value)

### isEventsEnabled

    public boolean isEventsEnabled()

### setEventsEnabled

    public void setEventsEnabled(boolean eventsEnabled)

### addListener

    public void addListener(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,
                               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,
                          Object sender)

  Dispatches the given event name, passing all arguments after the given name to the registered listeners for the event.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph X 2.1.0.7
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2010 Gaudenz Alder. All rights reserved.