|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ModelEventPump
This is the interface for registering interest in events sent from the model component.
Neither the registration or unregistration, nor the events themselves
contain any reference to the model implementation. Instead they
use the PropertyChangeListener,
PropertyChangeEvent to
deliver events.
The reference to the listener is a WeakReference so you don't need to call removeWHATEVERListener, you can just forget about your listener and it is eventually finalized and removed. This also means that you will have to keep a reference to your listener while it is active. Since the garbage collecting mechanism is not really deterministic a forgotten about listener might still receive events. Unless it can handle them in a harmless way, this approach should not be used. TODO: (Is this still true or does it refer to the NSUML implementation? - tfm 20051109) (This is part of the contract that is established between the Model subsystem and its users. If that is not fulfilled by the current implementation, then the current implementation is incorrect. Linus 20060411).
TODO: What event names?
The event names generated are Strings and their values and
meanings are not really well documented. In general they are the
name of an an association end or attribute in the UML metamodel.
Here are some highlights:
| Method Summary | |
|---|---|
void |
addClassModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelClass,
java.lang.String propertyName)
Adds a listener that listens to the event that is named eventName and that occur to instances of the given modelClass. |
void |
addClassModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelClass,
java.lang.String[] propertyNames)
Adds a listener that listens to all events that are named eventNames and that occur to instances of the given modelClass. |
void |
addModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement)
Adds a listener to all events fired by some modelelement. |
void |
addModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement,
java.lang.String propertyName)
Adds a listener to modelevents that are fired by some given modelelement and that have the name in eventName. |
void |
addModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement,
java.lang.String[] propertyNames)
Adds a listener to modelevents that are fired by some given modelelement and that have any of the names in eventNames. |
void |
flushModelEvents()
Flush events from the ModelEventPump. |
java.util.List |
getDebugInfo()
Get debug info for the event pump. |
void |
removeClassModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelClass,
java.lang.String propertyName)
Removes a listener that listens to all modelevents fired by instances of modelClass and that have the name eventName. |
void |
removeClassModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelClass,
java.lang.String[] propertyNames)
Removes a listener that listens to all modelevents fired by instances of modelClass and that have the original name eventNames. |
void |
removeModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement)
Removes a listener that listens to all events fired by the given modelelement. |
void |
removeModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement,
java.lang.String propertyName)
Removes a listener that listens to modelevents with name eventName that are fired by the given modelelement. |
void |
removeModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement,
java.lang.String[] propertyNames)
Removes a listener that listens to modelevents with name eventNames that are fired by the given modelelement. |
void |
startPumpingEvents()
Start the ModelEventPump firing events. |
void |
stopPumpingEvents()
Stop the ModelEventPump firing events. |
| Method Detail |
|---|
void addModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement,
java.lang.String[] propertyNames)
listener - The listener to addmodelelement - The modelelement the listener should be added toopropertyNames - The array of property names the listener wishes to
receive events for
void addModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement,
java.lang.String propertyName)
listener - The listener to addmodelelement - The modelelement the listener should be added toopropertyName - The property name the listener wishes to
receive events for
void addModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement)
listener - is the listener to addmodelelement - is the model element
void removeModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement,
java.lang.String[] propertyNames)
listener - The listener to removemodelelement - The modelelement that fires the events the
listener is listening to.propertyNames - The property names the listener no longer wishes to
receive events for
void removeModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement,
java.lang.String propertyName)
listener - The listener to remove.modelelement - The modelelement that fires the events the
listener is listening to.propertyName - The property name the listener no longer wishes to
receive events for
void removeModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelelement)
listener - is the listenermodelelement - is the model element
void addClassModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelClass,
java.lang.String[] propertyNames)
listener - is the listener to add.modelClass - is the given model classpropertyNames - The property names the listener wishes to receive events for.
If null or an empty array, all events will be returned.
java.lang.IllegalArgumentException - if one of the arguments is null or if the modelClass is not a
valid metamodel class.
java.lang.IllegalStateException - if the listener is already registred.
void addClassModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelClass,
java.lang.String propertyName)
addClassModelEventListener(PropertyChangeListener, Object, String[])
with a null third argument.
listener - is the listener to add.modelClass - is the given model classpropertyName - The property name the listener wishes to receive events for.
java.lang.IllegalArgumentException - if one of the arguments is null or if the modelClass is not a
valid metamodel class.
java.lang.IllegalStateException - if the listener is already registered.
void removeClassModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelClass,
java.lang.String[] propertyNames)
listener - The listener to removemodelClass - The class the listener does not want to listen to
instances anymorepropertyNames - The property names the listener no longer wishes to
receive events for
void removeClassModelEventListener(java.beans.PropertyChangeListener listener,
java.lang.Object modelClass,
java.lang.String propertyName)
listener - The listener to removemodelClass - The class the listener does not want to listen to
instances anymore.propertyName - The property name the listener no longer wishes to
receive events forvoid startPumpingEvents()
void stopPumpingEvents()
void flushModelEvents()
NOTE: This may not be called from a
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
method which has been invoked by the ModelEventPump.
java.util.List getDebugInfo()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
| ArgoUML © 1996-2006 | ArgoUML Homepage | ArgoUML Cookbook |