|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.argouml.model.uml.UmlModelEventPump
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.
Field Summary | |
---|---|
private ClassListenerHashMap |
_classListenerMap
|
private EventTreeDefinition |
_definition
|
private static UmlModelEventPump |
_instance
|
private EventListenerHashMap |
_listenerMap
The 'map' with the eventlistenerlists per modelelement |
static java.lang.String |
REMOVE
|
Constructor Summary | |
---|---|
private |
UmlModelEventPump()
Constructor for UmlModelEventPump, initialises the NSUML event policy. |
Method Summary | |
---|---|
void |
addClassModelEventListener(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(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 |
addEventSource(java.lang.Class cSource,
java.util.Map mpNameMap)
Make event types for a single event source available to this UMLModelEventPump. |
void |
addEventSourcesFromDocument(org.w3c.dom.Document doc)
Make all event sources described by the given document available to the UMLModelEventPump. |
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)
Convenience 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. |
(package private) void |
cleanUp()
Clears the hashmaps with listeners. |
(package private) void |
cleanUp(MBase element)
Method to remove some element from the listenerObjectMap. |
private void |
executeAddClassModelEventListener(MElementListener listener,
java.lang.Class modelClass,
java.lang.String eventName)
Does the actual adding |
private void |
executeRemoveClassModelEventListener(MElementListener listener,
java.lang.Class modelClass,
java.lang.String eventName)
Executes the removal of a listener to a class |
void |
flushModelEvents()
changes the NSUML event policy to flush model events. |
private java.lang.Class |
formatClass(java.lang.Class inputClass)
Retrieves the implementation class belonging to some given class. |
(package private) ClassListenerHashMap |
getClassListenerMap()
|
(package private) EventListenerHashMap |
getEventListenerMap()
|
private MElementListener[] |
getListenerList(MElementEvent e)
|
static UmlModelEventPump |
getPump()
Singleton access method |
void |
listRoleItemSet(MElementEvent e)
|
void |
propertySet(MElementEvent e)
|
void |
recovered(MElementEvent e)
|
void |
removeClassModelEventListener(MElementListener listener,
java.lang.Class modelClass)
Removes a listener that listens to all modelevents fired by instances of modelClass. |
void |
removeClassModelEventListener(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(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(MElementEvent e)
|
void |
removeModelEventListener(java.lang.Object listener,
java.lang.Object handle)
Removes a listener that listens to all events fired by the given modelelement. |
void |
removeModelEventListener(java.lang.Object listener,
java.lang.Object handle,
java.lang.String eventName)
Convenience method to remove a listener to some event. |
void |
removeModelEventListener(java.lang.Object 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(MElementEvent e)
|
void |
roleRemoved(MElementEvent e)
|
void |
startPumpingEvents()
changes the NSUML event policy in order to start udating the ui. |
void |
stopPumpingEvents()
changes the NSUML event policy in order to stop udating the ui. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String REMOVE
private static UmlModelEventPump _instance
private EventListenerHashMap _listenerMap
private ClassListenerHashMap _classListenerMap
private EventTreeDefinition _definition
Constructor Detail |
private UmlModelEventPump()
Method Detail |
public static UmlModelEventPump getPump()
public void addClassModelEventListener(MElementListener listener, java.lang.Class modelClass, java.lang.String[] eventNames)
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".
listener
- is the listener to add.modelClass
- is the given model classeventNames
- is a array of strings with event names.
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 registredpublic void addClassModelEventListener(MElementListener listener, java.lang.Class modelClass, java.lang.String eventName)
listener
- The listener to addmodelClass
- The listener should listen to instances of this classeventName
- The name of the event the listener wants to listen
too.private void executeAddClassModelEventListener(MElementListener listener, java.lang.Class modelClass, java.lang.String eventName)
listener
- The listener to addmodelClass
- The listener should listen to instances of this classeventName
- The name of the event the listener wants to listenprivate java.lang.Class formatClass(java.lang.Class inputClass)
inputClass
- An interface or implementation class from NSUML
public void removeClassModelEventListener(MElementListener listener, java.lang.Class modelClass, java.lang.String[] eventNames)
listener
- The listener to removemodelClass
- The class the listener does not want to listen to
instances anymoreeventNames
- The eventnames the listener does not want to listen to
anymorepublic void removeClassModelEventListener(MElementListener listener, java.lang.Class modelClass, java.lang.String eventName)
listener
- The listener to removemodelClass
- The class the listener does not want to listen to
instances anymoreeventName
- The eventname the listener does not want to listen to
anymorepublic void removeClassModelEventListener(MElementListener listener, java.lang.Class modelClass)
listener
- The listener to removemodelClass
- The class the listener does not want to listen to
instances anymoreprivate void executeRemoveClassModelEventListener(MElementListener listener, java.lang.Class modelClass, java.lang.String eventName)
listener
- The listener to removemodelClass
- The class the listener does not want to listen to
instances anymoreeventName
- The eventname the listener does not want to listen to
anymorepublic void addModelEventListener(java.lang.Object listener, java.lang.Object modelelement, java.lang.String[] 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"
listener
- The listener to addmodelelement
- The modelelement the listener should be added tooeventNames
- The array of eventnames the listener should listen
topublic void addModelEventListener(java.lang.Object listener, java.lang.Object modelelement, java.lang.String eventName)
listener
- The listener to add.modelelement
- The modelelement the listener should be added to.eventName
- The eventname the listener should listen to.public void addModelEventListener(java.lang.Object listener, java.lang.Object modelelement)
listener
- is the listener to addmodelelement
- is the model elementpublic void removeModelEventListener(java.lang.Object listener, java.lang.Object handle, java.lang.String[] eventNames)
listener
- The listener to removehandle
- The modelelement that fires the events the
listener is listening toeventNames
- The list of event names the listener is
interested inpublic void removeModelEventListener(java.lang.Object listener, java.lang.Object handle)
listener
- is the listenerhandle
- is the model elementpublic void removeModelEventListener(java.lang.Object listener, java.lang.Object handle, java.lang.String eventName)
listener
- is the listener to removehandle
- is the objecteventName
- is the name of the eventvoid cleanUp(MBase element)
element
- public void addEventSourcesFromDocument(org.w3c.dom.Document doc)
<eventtree> <source classname="classname of a model element"> <eventtype name="event fired by this model element"> <type>1</type> </eventtype> </source> </eventtree>The classname is fully qualified.
The type is one of the numbers defined in MElementEvent
. Each of the elements can be used multiple
times.
This operation is particularly provided for use by modules
which add custom model elements.
doc
- the document, the contents of which should be made available.
This must be preparsed.public void addEventSource(java.lang.Class cSource, java.util.Map mpNameMap)
Make event types for a single event source available to this UMLModelEventPump.
This operation is particularly provided for use by modules which add custom model elements.
cSource
- the source class for which to make event types available.mpNameMap
- a map of the event types to add for the source class.
The keys are Strings indicating the names of events,
while the values are int[] which contain all the event
types the indicated event represents. The specific int
values used can be found in MElementEvent
.public void listRoleItemSet(MElementEvent e)
MElementListener#listRoleItemSet(MElementEvent)
private MElementListener[] getListenerList(MElementEvent e)
public void propertySet(MElementEvent e)
MElementListener#propertySet(MElementEvent)
public void recovered(MElementEvent e)
MElementListener#recovered(MElementEvent)
public void removed(MElementEvent e)
MElementListener#removed(MElementEvent)
public void roleAdded(MElementEvent e)
MElementListener#roleAdded(MElementEvent)
public void roleRemoved(MElementEvent e)
MElementListener#roleRemoved(MElementEvent)
void cleanUp()
ClassListenerHashMap getClassListenerMap()
EventListenerHashMap getEventListenerMap()
public void stopPumpingEvents()
public void startPumpingEvents()
public void flushModelEvents()
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20040306) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |