|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.argouml.model.uml.UmlModelListener
This class captures the information about the "change flag" of the current project. Initially, the "change flag" is clear, which means that there is nothing in the project to save. The "change flag" is set by every change made to its UML model, which means that the project becomes 'dirty', i.e. it needs saving.
The UmlModelListener is a single listener that listens to all UML ModelElement events and on its turn, sends events out that indicate that the "change flag" of the Save action needs to be set.
This class only keeps an eye on changes to the UML model - i.e. it does not notice changes done to e.g. the graph like moving an edge (when they do not also change the UML model), settings, todo items or the diagrams.
The UmlModelListener only transfers information when the flag needs
to be set - it does not know its current status. That is a task for the
listeners in the listenerList
.
Field Summary | |
private static UmlModelListener |
INSTANCE
Singleton instance. |
private EventListenerList |
listenerList
The listener list |
static String |
SAVE_STATE_PROPERTY_NAME
The name of the property that defines the save state. |
private Action |
saveAction
The action to enable when the model changes. |
Constructor Summary | |
private |
UmlModelListener()
Don't allow instantiation. |
Method Summary | |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener to the listener list. |
void |
deleteElement(Object elm)
For every ModelElement that has been deleted, we want to remove its listener. |
private void |
fireNeedsSavePropertyChanged()
Fire an event to all members of the listener list. |
static UmlModelListener |
getInstance()
Singleton instance access method. |
void |
newElement(Object elm)
For every new ModelElement that has been created, we want to register for updation events. |
void |
propertyChange(PropertyChangeEvent pce)
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener from the listener list. |
void |
setSaveAction(Action action)
Register the Action that will be enabled whenever a model change takes place. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final UmlModelListener INSTANCE
private EventListenerList listenerList
public static final String SAVE_STATE_PROPERTY_NAME
private Action saveAction
Constructor Detail |
private UmlModelListener()
Method Detail |
public static UmlModelListener getInstance()
public void setSaveAction(Action action)
action
- the action to be enabled on model change.public void propertyChange(PropertyChangeEvent pce)
propertyChange
in interface PropertyChangeListener
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
public void newElement(Object elm)
elm
- the UML modelelement that has been createdpublic void deleteElement(Object elm)
elm
- the UML modelelement that has been deletedpublic void addPropertyChangeListener(PropertyChangeListener listener)
listener
- The listener to add.public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- The listener to remove.private void fireNeedsSavePropertyChanged()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ArgoUML © 1996-2004 (20050222) | ArgoUML Homepage | ArgoUML Developers' page | ArgoUML Cookbook |