org.argouml.model.uml
Class UmlModelEventPump

java.lang.Object
  extended byorg.argouml.model.uml.UmlModelEventPump
All Implemented Interfaces:
java.util.EventListener, ru.novosoft.uml.MElementListener

public final class UmlModelEventPump
extends java.lang.Object
implements ru.novosoft.uml.MElementListener

This class implements an event pump for all modelevents (MEvents with the current NSUML model). Two kinds of listeners can be registred to the pump: listeners to class events and listeners to object events. The pump dispatches all events fired by objects of a certain class to the class listeners (listeners that are registred via addClassModelEventListener). Furthermore, it dispatches all events to listeners that are registered for a certain object if this object fired the original event.

Maybe this class should dispatch a thread to handle the incoming event in the future.

Since:
Oct 14, 2002

Field Summary
static java.lang.String REMOVE
           
 
Method Summary
 void addClassModelEventListener(ru.novosoft.uml.MElementListener listener, java.lang.Class modelClass, java.lang.String eventName)
          Convinience method to add a listener that only listens to one specific event
 void addClassModelEventListener(ru.novosoft.uml.MElementListener listener, java.lang.Class modelClass, java.lang.String[] eventNames)
          Adds a listener that listens to all modelevents that are named eventNames and that occur to instances of a given modelClass.
 void addModelEventListener(java.lang.Object listener, java.lang.Object modelelement)
          Adds a listener to all events fired by some modelelement.
 void addModelEventListener(java.lang.Object listener, java.lang.Object modelelement, java.lang.String eventName)
          Convinience method to add a listener that only listens to one specific event
 void addModelEventListener(java.lang.Object listener, java.lang.Object modelelement, java.lang.String[] eventNames)
          Adds a listener to modelevents that are fired by some given modelelement and that have the name eventNames.
static UmlModelEventPump getPump()
          Singleton access method
 void listRoleItemSet(ru.novosoft.uml.MElementEvent e)
           
 void propertySet(ru.novosoft.uml.MElementEvent e)
           
 void recovered(ru.novosoft.uml.MElementEvent e)
           
 void removeClassModelEventListener(ru.novosoft.uml.MElementListener listener, java.lang.Class modelClass)
          Removes a listener that listens to all modelevents fired by instances of modelClass.
 void removeClassModelEventListener(ru.novosoft.uml.MElementListener listener, java.lang.Class modelClass, java.lang.String eventName)
          Convinience method to remove a listener that listens to events named eventName that are fired by instances of modelClass
 void removeClassModelEventListener(ru.novosoft.uml.MElementListener listener, java.lang.Class modelClass, java.lang.String[] eventNames)
          Removes a listener that listens to all modelevents fired by instances of modelClass and that have the original name eventNames.
 void removed(ru.novosoft.uml.MElementEvent e)
           
 void removeModelEventListener(ru.novosoft.uml.MElementListener listener, java.lang.Object handle)
          Removes a listener that listens to all events fired by the given modelelement.
 void removeModelEventListener(ru.novosoft.uml.MElementListener listener, java.lang.Object handle, java.lang.String eventName)
          Convinience method to remove a listener to some event.
 void removeModelEventListener(ru.novosoft.uml.MElementListener listener, java.lang.Object handle, java.lang.String[] eventNames)
          Removes a listener that listens to modelevents with name eventNames that are fired by the given modelelement.
 void roleAdded(ru.novosoft.uml.MElementEvent e)
           
 void roleRemoved(ru.novosoft.uml.MElementEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REMOVE

public static final java.lang.String REMOVE
See Also:
Constant Field Values
Method Detail

getPump

public static UmlModelEventPump getPump()
Singleton access method

Returns:
UmlModelEventPump

addClassModelEventListener

public void addClassModelEventListener(ru.novosoft.uml.MElementListener listener,
                                       java.lang.Class modelClass,
                                       java.lang.String[] eventNames)
Adds a listener that listens to all modelevents that are named eventNames and that occur to instances of a given modelClass.

If you want the listener to be registred for remove events (that is: an instance of the class the listener is listening too is removed), then you have to register for the eventname "remove"

Parameters:
listener -
modelClass -
eventNames -
Throws:
java.lang.IllegalArgumentException - if one of the arguments is null or if the modelClass is not a subclass of MBase.
java.lang.IllegalStateException - if the listener is allready registred

addClassModelEventListener

public void addClassModelEventListener(ru.novosoft.uml.MElementListener listener,
                                       java.lang.Class modelClass,
                                       java.lang.String eventName)
Convinience method to add a listener that only listens to one specific event

Parameters:
listener - The listener to add
modelClass - The listener should listen to instances of this class
eventName - The name of the event the listener wants to listen too.

removeClassModelEventListener

public void removeClassModelEventListener(ru.novosoft.uml.MElementListener listener,
                                          java.lang.Class modelClass,
                                          java.lang.String[] eventNames)
Removes a listener that listens to all modelevents fired by instances of modelClass and that have the original name eventNames.

Parameters:
listener - The listener to remove
modelClass - The class the listener does not want to listen to instances anymore
eventNames - The eventnames the listener does not want to listen to anymore

removeClassModelEventListener

public void removeClassModelEventListener(ru.novosoft.uml.MElementListener listener,
                                          java.lang.Class modelClass,
                                          java.lang.String eventName)
Convinience method to remove a listener that listens to events named eventName that are fired by instances of modelClass

Parameters:
listener - The listener to remove
modelClass - The class the listener does not want to listen to instances anymore
eventName - The eventname the listener does not want to listen to anymore

removeClassModelEventListener

public void removeClassModelEventListener(ru.novosoft.uml.MElementListener listener,
                                          java.lang.Class modelClass)
Removes a listener that listens to all modelevents fired by instances of modelClass.

Parameters:
listener - The listener to remove
modelClass - The class the listener does not want to listen to instances anymore

addModelEventListener

public void addModelEventListener(java.lang.Object listener,
                                  java.lang.Object modelelement,
                                  java.lang.String[] eventNames)
Adds a listener to modelevents that are fired by some given modelelement and that have the name eventNames.

If you want the listener to be registred for remove events (that is: the instance the listener is listening too is removed), then you have to register for the eventname "remove"

Parameters:
listener - The listener to add
modelelement - The modelelement the listener should be added too
eventNames - The array of eventnames the listener should listen to

addModelEventListener

public void addModelEventListener(java.lang.Object listener,
                                  java.lang.Object modelelement,
                                  java.lang.String eventName)
Convinience method to add a listener that only listens to one specific event

Parameters:
listener - The listener to add
modelelement - The modelelement the listener should be added too

addModelEventListener

public void addModelEventListener(java.lang.Object listener,
                                  java.lang.Object modelelement)
Adds a listener to all events fired by some modelelement.

Note: Due to the fact that ALL events are pumped for some modelelement, this is a rather powerfull method but also one that can hog performance. Use this with care!

Parameters:
listener -

removeModelEventListener

public void removeModelEventListener(ru.novosoft.uml.MElementListener listener,
                                     java.lang.Object handle,
                                     java.lang.String[] eventNames)
Removes a listener that listens to modelevents with name eventNames that are fired by the given modelelement.

Parameters:
listener - The listener to remove
eventNames - The list of event names the listener is interested in

removeModelEventListener

public void removeModelEventListener(ru.novosoft.uml.MElementListener listener,
                                     java.lang.Object handle)
Removes a listener that listens to all events fired by the given modelelement.

Parameters:
listener -

removeModelEventListener

public void removeModelEventListener(ru.novosoft.uml.MElementListener listener,
                                     java.lang.Object handle,
                                     java.lang.String eventName)
Convinience method to remove a listener to some event.

Parameters:
listener -
eventName -

listRoleItemSet

public void listRoleItemSet(ru.novosoft.uml.MElementEvent e)
Specified by:
listRoleItemSet in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.listRoleItemSet(ru.novosoft.uml.MElementEvent)

propertySet

public void propertySet(ru.novosoft.uml.MElementEvent e)
Specified by:
propertySet in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.propertySet(ru.novosoft.uml.MElementEvent)

recovered

public void recovered(ru.novosoft.uml.MElementEvent e)
Specified by:
recovered in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.recovered(ru.novosoft.uml.MElementEvent)

removed

public void removed(ru.novosoft.uml.MElementEvent e)
Specified by:
removed in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.removed(ru.novosoft.uml.MElementEvent)

roleAdded

public void roleAdded(ru.novosoft.uml.MElementEvent e)
Specified by:
roleAdded in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.roleAdded(ru.novosoft.uml.MElementEvent)

roleRemoved

public void roleRemoved(ru.novosoft.uml.MElementEvent e)
Specified by:
roleRemoved in interface ru.novosoft.uml.MElementListener
See Also:
MElementListener.roleRemoved(ru.novosoft.uml.MElementEvent)


ArgoUML © 1996-2003 (20040125)ArgoUML Project HomeArgoUML Cookbook