JGraph X 0.15.0.3


com.mxgraph.util
Class mxEventSource

java.lang.Object
  extended by com.mxgraph.util.mxEventSource
Direct Known Subclasses:
mxGraph, mxGraphModel, mxGraphView, mxSelectionModel, mxUndoManager

public class mxEventSource
extends Object

Base class for objects that dispatch named events.


Nested Class Summary
static interface mxEventSource.mxEventListener
          Defines the requirements for an object that listens to a graph model.
static interface mxEventSource.mxIEventSource
          Defines the requirements for an object that listens to a graph model.
 
Field Summary
protected static Object[] EMPTY_ARRAY
           
protected  List eventListeners
          Holds the event names and associated listeners in an array.
protected  boolean eventsEnabled
          Specifies if events can be fired.
protected  Object source
          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.mxEventListener listener)
          Binds the specified function to the given event name.
 void fireEvent(String eventName)
          Dispatches the given event name with this object as the event source and no additional arguments.
 void fireEvent(String eventName, Object[] args)
          Dispatches the given event name with this object as the event source, passing all arguments after the given name to the registered listeners for the event.
 void fireEvent(String eventName, Object source, Object[] args)
          Dispatches the given event name, passing all arguments after the given name to the registered listeners for the event.
 boolean isEventsEnabled()
           
 void removeListener(mxEventSource.mxEventListener listener)
          Function: removeListener Removes all occurances of the given listener from the list of listeners.
 void removeListener(String eventName, mxEventSource.mxEventListener listener)
          Function: removeListener Removes all occurances of the given listener from the list of listeners.
 void setEventsEnabled(boolean eventsEnabled)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ARRAY

protected static final Object[] EMPTY_ARRAY

eventListeners

protected transient List 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.


source

protected Object source
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

isEventsEnabled

public boolean isEventsEnabled()

setEventsEnabled

public void setEventsEnabled(boolean eventsEnabled)

addListener

public void addListener(String eventName,
                        mxEventSource.mxEventListener 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.mxEventListener listener)
Function: removeListener Removes all occurances of the given listener from the list of listeners.


removeListener

public void removeListener(String eventName,
                           mxEventSource.mxEventListener listener)
Function: removeListener Removes all occurances of the given listener from the list of listeners.


fireEvent

public void fireEvent(String eventName)
Dispatches the given event name with this object as the event source and no additional arguments.


fireEvent

public void fireEvent(String eventName,
                      Object[] args)
Dispatches the given event name with this object as the event source, passing all arguments after the given name to the registered listeners for the event.


fireEvent

public void fireEvent(String eventName,
                      Object source,
                      Object[] args)
Dispatches the given event name, passing all arguments after the given name to the registered listeners for the event.


JGraph X 0.15.0.3


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