Author: mvw
Date: 2010-11-20 11:27:11-0800
New Revision: 18852
Added:
trunk/src/argouml-app/src/org/argouml/notation/NotationRenderer.java
trunk/src/argouml-app/src/org/argouml/notation/providers/NotationUtilityProviders.java
Modified:
trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java
trunk/src/argouml-app/src/org/argouml/notation/NotationProvider.java
trunk/src/argouml-app/src/org/argouml/notation/NotationProviderFactory2.java
trunk/src/argouml-app/src/org/argouml/notation/providers/ActionStateNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationEndNameNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationNameNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationRoleNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/CallStateNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/ClassifierRoleNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/EnumerationLiteralNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/MessageNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/ModelElementNameNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/NodeInstanceNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateStateNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateTypeNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/OperationNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/StateBodyNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/TransitionNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/java/AssociationNameNotationJava.java
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NodeInstanceNotationUml.java
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NotationUtilityUml.java
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ObjectNotationUml.java
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/TransitionNotationUml.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigState.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigSingleLineTextWithNotation.java
trunk/src/argouml-app/tests/org/argouml/notation/TestNotationProvider.java
Log:
Fix for issue 6129: Refactor NotationProviders to handle modelchanges.
Modified: trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java (original)
+++ trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java 2010-11-20 11:27:11-0800
@@ -9,6 +9,7 @@
* Contributors:
* Tom Morris
* Bob Tarling
+ * Michiel van der Wulp
*******************************************************************************
*
* Some portions of this file were previously release using the BSD License:
@@ -159,7 +160,8 @@
/**
* Cache for the default model.
*/
- private HashMap<String, Object> defaultModelTypeCache;
+ private HashMap<String, Object> defaultModelTypeCache =
+ new HashMap<String, Object>();
private final Collection trashcan = new ArrayList();
@@ -206,7 +208,6 @@
version = ApplicationVersion.getVersion();
historyFile = "";
- defaultModelTypeCache = new HashMap<String, Object>();
LOG.info("making empty project with empty model");
addSearchPath("PROJECT_DIR");
Modified: trunk/src/argouml-app/src/org/argouml/notation/NotationProvider.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/NotationProvider.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/NotationProvider.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/NotationProvider.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -44,7 +44,10 @@
import java.util.Collection;
import org.apache.log4j.Logger;
+import org.argouml.model.AddAssociationEvent;
+import org.argouml.model.DeleteInstanceEvent;
import org.argouml.model.Model;
+import org.argouml.model.RemoveAssociationEvent;
/**
* A class that implements this abstract class manages a text
@@ -55,14 +58,13 @@
* Additionally, a help text for the parsing is provided,
* so that the user knows the syntax.
*
- * @author [email protected]
+ * @author Michiel van der Wulp
*/
-public abstract class NotationProvider {
+public abstract class NotationProvider implements PropertyChangeListener {
private static final Logger LOG = Logger.getLogger(NotationProvider.class);
-
- private static final String LIST_SEPARATOR = ", ";
-
+ private NotationRenderer renderer;
+
/**
* A collection of properties of listeners registered for this notation.
* Each entry is a 2 element array containing the element and the property
@@ -98,39 +100,33 @@
NotationSettings settings);
/**
- * Initialise the appropriate model change listeners
+ * Initialize the appropriate model change listeners
* for the given modelelement to the given listener.
* Overrule this when you need more than
* listening to all events from the base modelelement.
*
- * @param listener the given listener
* @param modelElement the modelelement that we provide
* notation for
*/
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
- addElementListener(listener, modelElement);
+ public void initialiseListener(Object modelElement) {
+ addElementListener(modelElement);
}
/**
* Clean out the listeners registered before.
+ * <p>
* The default implementation is to remove all listeners
* that were remembered by the utility functions below.
- *
- * @param listener the given listener
- * @param modelElement the modelelement that we provide
- * notation for
*/
- public void cleanListener(final PropertyChangeListener listener,
- final Object modelElement) {
- removeAllElementListeners(listener);
+ public void cleanListener() {
+ removeAllElementListeners();
}
/**
* Update the set of listeners based on the given event. <p>
*
* The default implementation just removes all listeners, and then
- * re-initialises completely - this is method 1.
+ * re-initializes completely - this is method 1.
* A more efficient way would be to dissect
* the propertyChangeEvent, and only adapt the listeners
* that need to be adapted - this is method 2. <p>
@@ -142,14 +138,11 @@
* that we only need to traverse the model structure in one location, i.e.
* the initialiseListener() method.
*
- * @param listener the given listener
* @param modelElement the modelelement that we provide
* notation for
* @param pce the received event, that we base the changes on
*/
- public void updateListener(final PropertyChangeListener listener,
- Object modelElement,
- PropertyChangeEvent pce) {
+ public void updateListener(Object modelElement, PropertyChangeEvent pce) {
// e.g. for an operation:
// if pce.getSource() == modelElement
// && event.propertyName = "parameter"
@@ -168,10 +161,33 @@
+ modelElement);
return;
}
- cleanListener(listener, modelElement);
- initialiseListener(listener, modelElement);
+ cleanListener();
+ initialiseListener(modelElement);
}
-
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (renderer != null) {
+ Object owner = renderer.getOwner(this);
+ if ((owner == evt.getSource())
+ && (evt instanceof DeleteInstanceEvent)) {
+ return;
+ }
+ if (owner != null) {
+ if (Model.getUmlFactory().isRemoved(owner)) {
+ LOG.warn("Encountered deleted object during delete of "
+ + owner);
+ return;
+ }
+ renderer.notationRenderingChanged(this,
+ toString(owner, renderer.getNotationSettings(this)));
+ if (evt instanceof AddAssociationEvent
+ || evt instanceof RemoveAssociationEvent) {
+ initialiseListener(owner);
+ }
+ }
+ }
+ }
+
/*
* Add an element listener and remember the registration.
*
@@ -195,6 +211,16 @@
}
}
+ /**
+ * Utility function to add a listener for an array of property names
+ * and remember the registration.
+ *
+ * @param element element to listen for changes on
+ */
+ public final void addElementListener(Object element) {
+ addElementListener(this, element);
+ }
+
/*
* Utility function to add a listener for a given property name
* and remember the registration.
@@ -221,6 +247,17 @@
+ " - Element: " + element + " Listener: " + listener);
}
}
+
+ /**
+ * Utility function to add a listener for an array of property names
+ * and remember the registration.
+ *
+ * @param element element to listen for changes on
+ * @param property name of property to listen for changes of
+ */
+ public final void addElementListener(Object element, String property) {
+ addElementListener(this, element, property);
+ }
/*
* Utility function to add a listener for an array of property names
@@ -249,6 +286,18 @@
}
}
+ /**
+ * Utility function to add a listener for an array of property names
+ * and remember the registration.
+ *
+ * @param element element to listen for changes on
+ * @param property array of property names (Strings)
+ * to listen for changes of
+ */
+ public final void addElementListener(Object element, String[] property) {
+ addElementListener(this, element, property);
+ }
+
/*
* Utility function to remove an element listener
* and adapt the remembered list of registration.
@@ -263,6 +312,16 @@
Model.getPump().removeModelEventListener(listener, element);
}
+ /**
+ * Utility function to remove an element listener
+ * and adapt the remembered list of registration.
+ *
+ * @param element element to listen for changes on
+ */
+ public final void removeElementListener(Object element) {
+ removeElementListener(this, element);
+ }
+
/*
* Utility function to unregister all listeners
* registered through addElementListener.
@@ -289,22 +348,18 @@
listeners.clear();
}
- protected StringBuilder formatNameList(Collection modelElements) {
- return formatNameList(modelElements, LIST_SEPARATOR);
+ /**
+ * Utility function to unregister all listeners
+ * registered through addElementListener.
+ */
+ public final void removeAllElementListeners() {
+ removeAllElementListeners(this);
}
- protected StringBuilder formatNameList(Collection modelElements,
- String separator) {
- StringBuilder result = new StringBuilder();
- for (Object element : modelElements) {
- String name = Model.getFacade().getName(element);
- // TODO: Any special handling for null names? append will use "null"
- result.append(name).append(separator);
- }
- if (result.length() >= separator.length()) {
- result.delete(result.length() - separator.length(),
- result.length());
- }
- return result;
+ /**
+ * @param nr the NotationRenderer
+ */
+ void setRenderer(NotationRenderer nr) {
+ renderer = nr;
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/NotationProviderFactory2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/NotationProviderFactory2.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/NotationProviderFactory2.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/NotationProviderFactory2.java 2010-11-20 11:27:11-0800
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,7 +38,6 @@
package org.argouml.notation;
-import java.beans.PropertyChangeListener;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
@@ -212,6 +211,9 @@
* If there is any reason for failure, null is returned - no
* exception is thrown.
* The caller is supposed to deal with receiving null.
+ * <p>
+ * Use this function when you do not want to monitor model
+ * changes which may cause the string to change.
*
* @param type the provider type
* @param object the constructor parameter
@@ -262,20 +264,23 @@
/**
* Get a NotationProvider for the current project.
* This also initializes the listeners.
+ * <p>
+ * Use this function when you want to monitor model
+ * changes which may cause the string to change.
*
* @param type the provider type
* @param object the constructor parameter
- * @param listener the fig
- * that refreshes after the NotationProvider has changed
+ * @param nr the fig that refreshes after the NotationProvider has changed
* @param name the name of the notation language to use
* @return the provider
*/
public NotationProvider getNotationProvider(int type,
- Object object, PropertyChangeListener listener,
+ Object object, NotationRenderer nr,
NotationName name) {
NotationProvider p = getNotationProvider(type, object, name);
- p.initialiseListener(listener, object);
+ p.setRenderer(nr);
+ p.initialiseListener(object);
return p;
}
Added: trunk/src/argouml-app/src/org/argouml/notation/NotationRenderer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/NotationRenderer.java?view=markup&pathrev=18852
==============================================================================
--- (empty file)
+++ trunk/src/argouml-app/src/org/argouml/notation/NotationRenderer.java 2010-11-20 11:27:11-0800
@@ -0,0 +1,68 @@
+/* $Id$
+ *******************************************************************************
+ * Copyright (c) 2010 Contributors - see below
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Michiel van der Wulp
+ *******************************************************************************
+ */
+
+package org.argouml.notation;
+
+/**
+ * An interface to be implemented by Objects that wish to render a
+ * string-representation for an UML modelElement. <p>
+ *
+ * The Object will be notified of model changes that cause a redraw of the string.
+ * <p>
+ * These functions have the NotationProvider as a parameter, since
+ * the Object may have multiple NotationProviders, and may need
+ * to keep track which of their strings to refresh.
+ *
+ * @author mvw
+ */
+public interface NotationRenderer {
+
+ /**
+ * This function is called by the NotationProvider
+ * to notify the renderer (e.g. a Fig) of a change
+ * in the textual representation of the modelElement. <p>
+ *
+ * The <code>np</code> argument is needed
+ * because one Fig might have
+ * multiple notationProviders (even of the same type).
+ *
+ * @param np the notationProvider that noticed the change
+ * @param rendering the new textual representation
+ */
+ public void notationRenderingChanged(NotationProvider np,
+ String rendering);
+
+ /**
+ * Getter for the NotationSettings that apply at the moment of this call.
+ * <p>
+ * The <code>np</code> argument is needed
+ * because one Fig might have a
+ * different notationSetting per NotationProvider.
+ *
+ * @param np the notationProvider that noticed the change
+ * @return the current NotationSettings for this renderer
+ */
+ public NotationSettings getNotationSettings(NotationProvider np);
+
+ /**
+ * Getter for the UML object that forms the basis of this NotationProvider.
+ * <p>
+ * The <code>np</code> argument is needed
+ * because one Fig might have a
+ * different owner per notationProvider.
+ *
+ * @param np the notationProvider that noticed the change
+ * @return the UML object shown to the NotationProvider at creation time.
+ */
+ public Object getOwner(NotationProvider np);
+}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/ActionStateNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/ActionStateNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/ActionStateNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/ActionStateNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,7 +38,6 @@
package org.argouml.notation.providers;
-import java.beans.PropertyChangeListener;
import java.util.Collection;
import java.util.Iterator;
@@ -50,7 +49,7 @@
* for the text shown in the Fig that represents the ActionState.
* Subclass this for all languages.
*
- * @author [email protected]
+ * @author Michiel van der Wulp
*/
public abstract class ActionStateNotation extends NotationProvider {
@@ -65,23 +64,19 @@
}
}
- /*
- * @see org.argouml.notation.providers.NotationProvider#initialiseListener(
- * java.beans.PropertyChangeListener, java.lang.Object)
- */
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
- addElementListener(listener, modelElement,
+ @Override
+ public void initialiseListener(Object modelElement) {
+ addElementListener(modelElement,
new String[] {"entry", "remove", "stereotype"} );
Object entry = Model.getFacade().getEntry(modelElement);
if (entry != null) {
- addElementListener(listener, entry, "script");
+ addElementListener(entry, "script");
}
Collection c = Model.getFacade().getStereotypes(modelElement);
Iterator i = c.iterator();
while (i.hasNext()) {
Object st = i.next();
- addElementListener(listener, st, "name");
+ addElementListener(st, "name");
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationEndNameNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationEndNameNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationEndNameNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationEndNameNotation.java 2010-11-20 11:27:11-0800
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -39,7 +39,6 @@
package org.argouml.notation.providers;
import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import java.util.Collection;
import java.util.Iterator;
@@ -53,7 +52,7 @@
* for the text shown next to the end of an association.
* Subclass this for all languages.
*
- * @author michiel
+ * @author Michiel van der Wulp
*/
public abstract class AssociationEndNameNotation extends NotationProvider {
@@ -68,13 +67,9 @@
}
}
- /*
- * @see org.argouml.notation.providers.NotationProvider#addListener(java.beans.PropertyChangeListener, java.lang.Object)
- */
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
+ @Override
+ public void initialiseListener(Object modelElement) {
addElementListener(
- listener,
modelElement,
new String[] {"name", "visibility", "stereotype"});
Collection stereotypes =
@@ -83,17 +78,13 @@
while (iter.hasNext()) {
Object o = iter.next();
addElementListener(
- listener,
o,
new String[] {"name", "remove"});
}
}
- /*
- * @see org.argouml.notation.providers.NotationProvider#updateListener(java.beans.PropertyChangeListener, java.lang.Object, java.beans.PropertyChangeEvent)
- */
- public void updateListener(PropertyChangeListener listener,
- Object modelElement,
+ @Override
+ public void updateListener(Object modelElement,
PropertyChangeEvent pce) {
Object obj = pce.getSource();
if ((obj == modelElement)
@@ -102,7 +93,6 @@
&& Model.getFacade().isAStereotype(pce.getNewValue())) {
// new stereotype
addElementListener(
- listener,
pce.getNewValue(),
new String[] {"name", "remove"});
}
@@ -110,7 +100,6 @@
&& Model.getFacade().isAStereotype(pce.getOldValue())) {
// removed stereotype
removeElementListener(
- listener,
pce.getOldValue());
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationNameNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationNameNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationNameNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationNameNotation.java 2010-11-20 11:27:11-0800
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,7 +38,6 @@
package org.argouml.notation.providers;
-import java.beans.PropertyChangeListener;
import java.util.Collection;
import java.util.Iterator;
@@ -50,7 +49,7 @@
* for the text shown above the association Fig.
* Subclass this for all languages.
*
- * @author mvw
+ * @author Michiel van der Wulp
*/
public abstract class AssociationNameNotation extends NotationProvider {
@@ -65,14 +64,10 @@
}
}
- /*
- * @see org.argouml.notation.providers.NotationProvider#initialiseListener(
- * java.beans.PropertyChangeListener, java.lang.Object)
- */
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
+ @Override
+ public void initialiseListener(Object modelElement) {
/* Listen to the modelelement itself: */
- addElementListener(listener, modelElement,
+ addElementListener(modelElement,
new String[] {"name", "visibility", "stereotype"});
Collection stereotypes =
Model.getFacade().getStereotypes(modelElement);
@@ -80,7 +75,6 @@
while (iter.hasNext()) {
Object oneStereoType = iter.next();
addElementListener(
- listener,
oneStereoType,
new String[] {"name", "remove"});
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationRoleNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationRoleNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationRoleNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationRoleNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,8 +38,6 @@
package org.argouml.notation.providers;
-import java.beans.PropertyChangeListener;
-
import org.argouml.model.Model;
import org.argouml.notation.NotationProvider;
@@ -48,7 +46,7 @@
* for the name of an association-role.
* Subclass this for all languages.
*
- * @author michiel
+ * @author Michiel van der Wulp
*/
public abstract class AssociationRoleNotation extends NotationProvider {
@@ -64,16 +62,13 @@
}
}
- /*
- * @see org.argouml.notation.providers.NotationProvider#initialiseListener(java.beans.PropertyChangeListener, java.lang.Object)
- */
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
- addElementListener(listener, modelElement,
+ @Override
+ public void initialiseListener(Object modelElement) {
+ addElementListener(modelElement,
new String[] {"name", "base"});
Object assoc = Model.getFacade().getBase(modelElement);
if (assoc != null) {
- addElementListener(listener, assoc, "name");
+ addElementListener(assoc, "name");
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java 2010-11-20 11:27:11-0800
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -39,7 +39,6 @@
package org.argouml.notation.providers;
import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import org.argouml.model.AddAssociationEvent;
import org.argouml.model.Model;
@@ -51,7 +50,7 @@
* for the text shown in the attribute compartment of a Class.
* Subclass this for all languages.
*
- * @author Michiel
+ * @author Michiel van der Wulp
*/
public abstract class AttributeNotation extends NotationProvider {
@@ -66,33 +65,31 @@
}
@Override
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
- addElementListener(listener, modelElement);
+ public void initialiseListener(Object modelElement) {
+ addElementListener(modelElement);
if (Model.getFacade().isAAttribute(modelElement)) {
// We also show stereotypes
for (Object uml : Model.getFacade().getStereotypes(modelElement)) {
- addElementListener(listener, uml);
+ addElementListener(uml);
}
// We also show the type (of which e.g. the name may change)
Object type = Model.getFacade().getType(modelElement);
if (type != null) {
- addElementListener(listener, type);
+ addElementListener(type);
}
}
}
@Override
- public void updateListener(PropertyChangeListener listener,
- Object modelElement, PropertyChangeEvent pce) {
+ public void updateListener(Object modelElement, PropertyChangeEvent pce) {
if (pce.getSource() == modelElement
&& ("stereotype".equals(pce.getPropertyName())
|| ("type".equals(pce.getPropertyName())))) {
if (pce instanceof AddAssociationEvent) {
- addElementListener(listener, pce.getNewValue());
+ addElementListener(pce.getNewValue());
}
if (pce instanceof RemoveAssociationEvent) {
- removeElementListener(listener, pce.getOldValue());
+ removeElementListener(pce.getOldValue());
}
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/CallStateNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/CallStateNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/CallStateNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/CallStateNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,8 +38,6 @@
package org.argouml.notation.providers;
-import java.beans.PropertyChangeListener;
-
import org.argouml.model.Model;
import org.argouml.notation.NotationProvider;
@@ -48,7 +46,7 @@
* for the text shown in the Fig that represents the CallState.
* Subclass this for all languages.
*
- * @author [email protected]
+ * @author Michiel van der Wulp
*/
public abstract class CallStateNotation extends NotationProvider {
@@ -63,30 +61,26 @@
}
}
- /*
- * @see org.argouml.notation.providers.NotationProvider#initialiseListener(
- * java.beans.PropertyChangeListener, java.lang.Object)
- */
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
+ @Override
+ public void initialiseListener(Object modelElement) {
// register for events from all modelelements
// that change the name and body text
// i.e. when the CallAction is replaced:
- addElementListener(listener, modelElement,
+ addElementListener(modelElement,
new String[] {"entry", "name", "remove"});
Object entryAction = Model.getFacade().getEntry(modelElement);
if (Model.getFacade().isACallAction(entryAction)) {
// and when the Operation is replaced:
- addElementListener(listener, entryAction, "operation");
+ addElementListener(entryAction, "operation");
Object operation = Model.getFacade().getOperation(entryAction);
if (operation != null) {
// and when the owner is replaced (unlikely for operations),
// and when the operation changes name:
- addElementListener(listener, operation,
+ addElementListener(operation,
new String[] {"owner", "name"});
Object classifier = Model.getFacade().getOwner(operation);
// and when the class changes name:
- addElementListener(listener, classifier, "name");
+ addElementListener(classifier, "name");
}
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/ClassifierRoleNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/ClassifierRoleNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/ClassifierRoleNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/ClassifierRoleNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,7 +38,6 @@
package org.argouml.notation.providers;
-import java.beans.PropertyChangeListener;
import java.util.Collection;
import org.argouml.model.Model;
@@ -49,7 +48,7 @@
* for the text shown in the Fig that represents the ClassifierRole.
* Subclass this for all languages.
*
- * @author Michiel
+ * @author Michiel van der Wulp
*/
public abstract class ClassifierRoleNotation extends NotationProvider {
@@ -65,12 +64,11 @@
}
@Override
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
- super.initialiseListener(listener, modelElement);
+ public void initialiseListener(Object modelElement) {
+ super.initialiseListener(modelElement);
Collection classifiers = Model.getFacade().getBases(modelElement);
for (Object c : classifiers) {
- addElementListener(listener, c, "name");
+ addElementListener(c, "name");
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/EnumerationLiteralNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/EnumerationLiteralNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/EnumerationLiteralNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/EnumerationLiteralNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,7 +38,6 @@
package org.argouml.notation.providers;
-import java.beans.PropertyChangeListener;
import java.util.Collection;
import org.argouml.model.Model;
@@ -49,7 +48,7 @@
* for the text shown in the Fig that represents an Enumeration Literal.
* Subclass this for all languages.
*
- * @author Michiel
+ * @author Michiel van der Wulp
*/
public abstract class EnumerationLiteralNotation extends NotationProvider {
@@ -66,13 +65,12 @@
}
@Override
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
- addElementListener(listener, modelElement,
+ public void initialiseListener(Object modelElement) {
+ addElementListener(modelElement,
new String[] {"remove", "stereotype"} );
Collection c = Model.getFacade().getStereotypes(modelElement);
for (Object st : c) {
- addElementListener(listener, st, "name");
+ addElementListener(st, "name");
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/MessageNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/MessageNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/MessageNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/MessageNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,7 +38,6 @@
package org.argouml.notation.providers;
-import java.beans.PropertyChangeListener;
import java.util.List;
import org.argouml.model.Model;
@@ -49,7 +48,7 @@
* for the text shown in the Fig that represents the Message.
* Subclass this for all languages.
*
- * @author michiel
+ * @author Michiel van der Wulp
*/
public abstract class MessageNotation extends NotationProvider {
@@ -64,35 +63,32 @@
}
}
- /*
- * @see org.argouml.notation.providers.NotationProvider#initialiseListener(java.beans.PropertyChangeListener, java.lang.Object)
- */
- public void initialiseListener(PropertyChangeListener listener,
- Object umlMessage) {
- addElementListener(listener, umlMessage,
+ @Override
+ public void initialiseListener(Object umlMessage) {
+ addElementListener(umlMessage,
new String[] {"activator", "predecessor", "successor",
"sender", "receiver", "action", "name"});
Object action = Model.getFacade().getAction(umlMessage);
if (action != null) {
- addElementListener(listener, action,
+ addElementListener(action,
new String[] {"remove", "recurrence", "script",
"actualArgument", "signal", "operation"});
List args = Model.getFacade().getActualArguments(action);
for (Object argument : args) {
- addElementListener(listener, argument,
+ addElementListener(argument,
new String[] {"remove", "value"});
}
if (Model.getFacade().isACallAction(action)) {
Object operation = Model.getFacade().getOperation(action);
if (Model.getFacade().isAOperation(operation)) {
- addElementListener(listener, operation,
+ addElementListener(operation,
new String[] {"name"});
}
}
if (Model.getFacade().isASendAction(action)) {
Object signal = Model.getFacade().getSignal(action);
if (Model.getFacade().isASignal(signal)) {
- addElementListener(listener, signal,
+ addElementListener(signal,
new String[] {"name"});
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/ModelElementNameNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/ModelElementNameNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/ModelElementNameNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/ModelElementNameNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,8 +38,6 @@
package org.argouml.notation.providers;
-import java.beans.PropertyChangeListener;
-
import org.argouml.model.Model;
import org.argouml.notation.NotationProvider;
@@ -48,7 +46,7 @@
* for the text shown in the Fig that represents the name of the modelelement.
* Subclass this for all languages.
*
- * @author [email protected]
+ * @author Michiel van der Wulp
*/
public abstract class ModelElementNameNotation extends NotationProvider {
@@ -63,18 +61,15 @@
}
}
- /*
- * @see org.argouml.notation.providers.NotationProvider#initialiseListener(java.beans.PropertyChangeListener, java.lang.Object)
- */
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
+ @Override
+ public void initialiseListener(Object modelElement) {
/* Listen to the modelelement itself: */
- addElementListener(listener, modelElement,
+ addElementListener(modelElement,
new String[] {"name", "visibility"});
- /* Listen to name changes in the path (usefull for e.g. Package): */
+ /* Listen to name changes in the path (useful for e.g. Package): */
Object ns = Model.getFacade().getNamespace(modelElement);
while (ns != null && !Model.getFacade().isAModel(ns)) {
- addElementListener(listener, ns,
+ addElementListener(ns,
new String[] {"name", "namespace"});
ns = Model.getFacade().getNamespace(ns);
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/NodeInstanceNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/NodeInstanceNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/NodeInstanceNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/NodeInstanceNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,6 +38,8 @@
package org.argouml.notation.providers;
+import java.util.Collection;
+
import org.argouml.model.Model;
import org.argouml.notation.NotationProvider;
@@ -46,7 +48,7 @@
* for the text shown in the Fig that represents a nodeInstance.
* Subclass this for all languages.
*
- * @author [email protected]
+ * @author Michiel van der Wulp
*/
public abstract class NodeInstanceNotation extends NotationProvider {
@@ -61,4 +63,14 @@
}
}
+ @Override
+ public void initialiseListener(Object modelElement) {
+ addElementListener(modelElement,
+ new String[] {"name", "classifier", "remove"});
+ Collection<Object> c = Model.getFacade().getClassifiers(modelElement);
+ for (Object classifier : c) {
+ addElementListener(classifier,
+ new String[] {"name", "remove"});
+ }
+ }
}
Added: trunk/src/argouml-app/src/org/argouml/notation/providers/NotationUtilityProviders.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/NotationUtilityProviders.java?view=markup&pathrev=18852
==============================================================================
--- (empty file)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/NotationUtilityProviders.java 2010-11-20 11:27:11-0800
@@ -0,0 +1,99 @@
+/* $Id$
+ *******************************************************************************
+ * Copyright (c) 2010 Contributors - see below
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Michiel van der Wulp
+ *******************************************************************************
+ */
+
+package org.argouml.notation.providers;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.argouml.model.Model;
+import org.argouml.notation.NotationProvider;
+
+/**
+ * Utility code for the classes in this package.
+ *
+ * @author Michiel van der Wulp
+ */
+class NotationUtilityProviders {
+
+
+ static void addListenersForTransition(NotationProvider np,
+ Object transition) {
+ np.addElementListener(transition,
+ new String[] {"guard", "trigger", "effect"});
+
+ Object guard = Model.getFacade().getGuard(transition);
+ if (guard != null) {
+ np.addElementListener(guard, "expression");
+ /* We are not interested in the name. */
+ }
+
+ Object trigger = Model.getFacade().getTrigger(transition);
+ addListenersForEvent(np, trigger);
+
+ Object effect = Model.getFacade().getEffect(transition);
+ addListenersForAction(np, effect);
+ }
+
+ static private void addListenersForEvent(NotationProvider np,
+ Object event) {
+ if (event != null) {
+ if (Model.getFacade().isAEvent(event)) {
+ np.addElementListener(event,
+ new String[] {
+ "parameter", "name"});
+ }
+ if (Model.getFacade().isATimeEvent(event)) {
+ np.addElementListener(event, new String[] {"when"});
+ }
+ if (Model.getFacade().isAChangeEvent(event)) {
+ np.addElementListener(event,
+ new String[] {"changeExpression"});
+ }
+ /* And the parameter names and values: */
+ Collection prms = Model.getFacade().getParameters(event);
+ Iterator i = prms.iterator();
+ while (i.hasNext()) {
+ Object parameter = i.next();
+ np.addElementListener(parameter,
+ new String[] {"defaultValue", "name", "type", "kind"});
+ }
+ }
+ }
+
+ static void addListenersForAction(NotationProvider np,
+ Object action) {
+ if (action != null) {
+ np.addElementListener(action,
+ new String[] {
+ "script", "actualArgument", "action"
+ });
+ /* And the arguments: */
+ Collection args = Model.getFacade().getActualArguments(action);
+ Iterator i = args.iterator();
+ while (i.hasNext()) {
+ Object argument = i.next();
+ np.addElementListener(argument, "value");
+ }
+ if (Model.getFacade().isAActionSequence(action)) {
+ Collection subactions = Model.getFacade().getActions(action);
+ i = subactions.iterator();
+ while (i.hasNext()) {
+ Object a = i.next();
+ addListenersForAction(np, a);
+ }
+ }
+ }
+ }
+
+}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateStateNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateStateNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateStateNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateStateNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,6 +38,8 @@
package org.argouml.notation.providers;
+import java.util.Collection;
+
import org.argouml.model.Model;
import org.argouml.notation.NotationProvider;
@@ -46,7 +48,7 @@
* for the ClassifierInState state name text shown in an ObjectFlowState.
* Subclass this for all languages.
*
- * @author Michiel
+ * @author Michiel van der Wulp
*/
public abstract class ObjectFlowStateStateNotation extends NotationProvider {
@@ -62,4 +64,18 @@
}
}
+ @Override
+ public void initialiseListener(Object modelElement) {
+ addElementListener(modelElement);
+ Object cis = Model.getFacade().getType(modelElement);
+ if (Model.getFacade().isAClassifierInState(cis)) {
+ addElementListener(cis,
+ new String[] {"remove", "inState"});
+ Collection<Object> c = Model.getFacade().getInStates(cis);
+ for (Object state : c) {
+ addElementListener(state,
+ new String[] {"remove", "name"});
+ }
+ }
+ }
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateTypeNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateTypeNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateTypeNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectFlowStateTypeNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -46,7 +46,7 @@
* for the Classifier type name text shown in an ObjectFlowState.
* Subclass this for all languages.
*
- * @author Michiel
+ * @author Michiel van der Wulp
*/
public abstract class ObjectFlowStateTypeNotation extends NotationProvider {
@@ -62,4 +62,14 @@
}
}
+ @Override
+ public void initialiseListener(Object modelElement) {
+ addElementListener(modelElement);
+ Object classifier = Model.getFacade().getType(modelElement);
+ if (Model.getFacade().isAClassifier(classifier)) {
+ addElementListener(classifier,
+ new String[] {"remove", "name"});
+ }
+ }
+
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/ObjectNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -39,7 +39,6 @@
package org.argouml.notation.providers;
import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import java.util.Collection;
import java.util.Iterator;
@@ -52,7 +51,7 @@
* for the text shown in the Fig that represents an Object.
* Subclass this for all languages.
*
- * @author [email protected]
+ * @author Michiel van der Wulp
*/
public abstract class ObjectNotation extends NotationProvider {
@@ -67,12 +66,9 @@
}
}
- /*
- * @see org.argouml.notation.providers.NotationProvider#initialiseListener(java.beans.PropertyChangeListener, java.lang.Object)
- */
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
- addElementListener(listener, modelElement,
+ @Override
+ public void initialiseListener(Object modelElement) {
+ addElementListener(modelElement,
new String[] {"name", "classifier"});
// Add the following once we show stereotypes:
@@ -87,23 +83,23 @@
Iterator i = c.iterator();
while (i.hasNext()) {
Object st = i.next();
- addElementListener(listener, st, "name");
+ addElementListener(st, "name");
}
}
/*
* @see org.argouml.notation.providers.NotationProvider#updateListener(java.beans.PropertyChangeListener, java.lang.Object, java.beans.PropertyChangeEvent)
*/
- public void updateListener(PropertyChangeListener listener,
+ public void updateListener(
Object modelElement, PropertyChangeEvent pce) {
if (pce instanceof AttributeChangeEvent
&& pce.getSource() == modelElement
&& "classifier".equals(pce.getPropertyName())) {
if (pce.getOldValue() != null) {
- removeElementListener(listener, pce.getOldValue());
+ removeElementListener(pce.getOldValue());
}
if (pce.getNewValue() != null) {
- addElementListener(listener, pce.getNewValue(), "name");
+ addElementListener(pce.getNewValue(), "name");
}
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/OperationNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/OperationNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/OperationNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/OperationNotation.java 2010-11-20 11:27:11-0800
@@ -1,6 +1,6 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
*
* Contributors:
* thn
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -39,7 +40,6 @@
package org.argouml.notation.providers;
import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
import org.argouml.model.AddAssociationEvent;
import org.argouml.model.Model;
@@ -51,7 +51,7 @@
* for the text shown in the operation compartment of a Class.
* Subclass this for all languages.
*
- * @author [email protected]
+ * @author Michiel van der Wulp
*/
public abstract class OperationNotation extends NotationProvider {
@@ -69,45 +69,44 @@
}
@Override
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
- addElementListener(listener, modelElement);
+ public void initialiseListener(Object modelElement) {
+ addElementListener(modelElement);
if (Model.getFacade().isAOperation(modelElement)) {
// We also show stereotypes
for (Object uml : Model.getFacade().getStereotypes(modelElement)) {
- addElementListener(listener, uml);
+ addElementListener(uml);
}
// We also show parameters
for (Object uml : Model.getFacade().getParameters(modelElement)) {
- addElementListener(listener, uml);
+ addElementListener(uml);
// We also show the type (of which e.g. the name may change)
Object type = Model.getFacade().getType(uml);
if (type != null) {
- addElementListener(listener, type);
+ addElementListener(type);
}
}
// We also show tagged values for UML 1
// TODO: what to do for UML2 here?
- if( Model.getFacade().getUmlVersion().charAt(0) == '1') {
- for (Object uml : Model.getFacade() .getTaggedValuesCollection(modelElement)) {
- addElementListener(listener, uml);
+ if ( Model.getFacade().getUmlVersion().charAt(0) == '1') {
+ for (Object uml : Model.getFacade().getTaggedValuesCollection(
+ modelElement)) {
+ addElementListener(uml);
}
}
}
}
@Override
- public void updateListener(PropertyChangeListener listener,
- Object modelElement, PropertyChangeEvent pce) {
+ public void updateListener(Object modelElement, PropertyChangeEvent pce) {
if (pce.getSource() == modelElement
&& ("stereotype".equals(pce.getPropertyName())
|| "parameter".equals(pce.getPropertyName())
|| "taggedValue".equals(pce.getPropertyName()))) {
if (pce instanceof AddAssociationEvent) {
- addElementListener(listener, pce.getNewValue());
+ addElementListener(pce.getNewValue());
}
if (pce instanceof RemoveAssociationEvent) {
- removeElementListener(listener, pce.getOldValue());
+ removeElementListener(pce.getOldValue());
}
}
if (!Model.getUmlFactory().isRemoved(modelElement)) {
@@ -116,10 +115,10 @@
if (pce.getSource() == param
&& ("type".equals(pce.getPropertyName()))) {
if (pce instanceof AddAssociationEvent) {
- addElementListener(listener, pce.getNewValue());
+ addElementListener(pce.getNewValue());
}
if (pce instanceof RemoveAssociationEvent) {
- removeElementListener(listener, pce.getOldValue());
+ removeElementListener(pce.getOldValue());
}
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/StateBodyNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/StateBodyNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/StateBodyNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/StateBodyNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,8 +38,6 @@
package org.argouml.notation.providers;
-import java.beans.PropertyChangeListener;
-import java.util.Collection;
import java.util.Iterator;
import org.argouml.model.Model;
@@ -49,7 +47,7 @@
* This abstract class forms the basis of all Notation providers
* for the text shown in the body of a state. Subclass this for all languages.
*
- * @author [email protected]
+ * @author Michiel van der Wulp
*/
public abstract class StateBodyNotation extends NotationProvider {
@@ -64,82 +62,22 @@
}
}
- /*
- * @see org.argouml.notation.providers.NotationProvider#addListener(java.beans.PropertyChangeListener, java.lang.Object)
- */
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
- addElementListener(listener, modelElement);
-// register for internal transitions:
+ @Override
+ public void initialiseListener(Object modelElement) {
+ addElementListener(modelElement);
+ // register for internal transitions:
Iterator it =
Model.getFacade().getInternalTransitions(modelElement).iterator();
while (it.hasNext()) {
- addListenersForTransition(listener, it.next());
+ NotationUtilityProviders.addListenersForTransition(this, it.next());
}
- // register for the doactivity etc.
+ // register for the doActivity etc.
Object doActivity = Model.getFacade().getDoActivity(modelElement);
- addListenersForAction(listener, doActivity);
+ NotationUtilityProviders.addListenersForAction(this, doActivity);
Object entryAction = Model.getFacade().getEntry(modelElement);
- addListenersForAction(listener, entryAction);
+ NotationUtilityProviders.addListenersForAction(this, entryAction);
Object exitAction = Model.getFacade().getExit(modelElement);
- addListenersForAction(listener, exitAction);
- }
-
- private void addListenersForAction(PropertyChangeListener listener,
- Object action) {
- if (action != null) {
- addElementListener(listener, action,
- new String[] {
- "script", "actualArgument", "action"
- });
- Collection args = Model.getFacade().getActualArguments(action);
- Iterator i = args.iterator();
- while (i.hasNext()) {
- Object argument = i.next();
- addElementListener(listener, argument, "value");
- }
- if (Model.getFacade().isAActionSequence(action)) {
- Collection subactions = Model.getFacade().getActions(action);
- i = subactions.iterator();
- while (i.hasNext()) {
- Object a = i.next();
- addListenersForAction(listener, a);
- }
- }
- }
- }
-
- private void addListenersForEvent(PropertyChangeListener listener,
- Object event) {
- if (event != null) {
- addElementListener(listener, event,
- new String[] {
- "parameter", "name",
- });
- Collection prms = Model.getFacade().getParameters(event);
- Iterator i = prms.iterator();
- while (i.hasNext()) {
- Object parameter = i.next();
- addElementListener(listener, parameter);
- }
- }
+ NotationUtilityProviders.addListenersForAction(this, exitAction);
}
-
- private void addListenersForTransition(PropertyChangeListener listener,
- Object transition) {
- addElementListener(listener, transition,
- new String[] {"guard", "trigger", "effect"});
-
- Object guard = Model.getFacade().getGuard(transition);
- if (guard != null) {
- addElementListener(listener, guard, "expression");
- }
-
- Object trigger = Model.getFacade().getTrigger(transition);
- addListenersForEvent(listener, trigger);
-
- Object effect = Model.getFacade().getEffect(transition);
- addListenersForAction(listener, effect);
- }
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/TransitionNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/TransitionNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/TransitionNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/TransitionNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -45,7 +45,7 @@
* This abstract class forms the basis of all Notation providers
* for the text shown next to a Transition. Subclass this for all languages.
*
- * @author [email protected]
+ * @author Michiel van der Wulp
*/
public abstract class TransitionNotation extends NotationProvider {
@@ -60,4 +60,12 @@
}
}
+ @Override
+ public void initialiseListener(Object modelElement) {
+ // register for events from all modelelements
+ // that change the text
+ // i.e. when the Transition is replaced:
+ NotationUtilityProviders.addListenersForTransition(this, modelElement);
+ }
+
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/java/AssociationNameNotationJava.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/java/AssociationNameNotationJava.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/java/AssociationNameNotationJava.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/java/AssociationNameNotationJava.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,7 +38,6 @@
package org.argouml.notation.providers.java;
-import java.beans.PropertyChangeListener;
import java.text.ParseException;
import org.argouml.application.events.ArgoEventPump;
@@ -52,7 +51,7 @@
/**
* Java notation for the name of an association.
*
- * @author Michiel
+ * @author Michiel van der Wulp
*/
public class AssociationNameNotationJava extends AssociationNameNotation {
@@ -68,15 +67,12 @@
/*
* For Java notation, we also need to listen to "leaf" changes,
* since they are shown as "final" on the diagram.
- *
- * @see org.argouml.notation.providers.AssociationNameNotation#initialiseListener(java.beans.PropertyChangeListener, java.lang.Object)
*/
@Override
- public void initialiseListener(final PropertyChangeListener listener,
- final Object modelElement) {
- addElementListener(listener, modelElement,
+ public void initialiseListener(final Object modelElement) {
+ addElementListener(modelElement,
new String[] {"isLeaf"});
- super.initialiseListener(listener, modelElement);
+ super.initialiseListener(modelElement);
}
/*
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ClassifierRoleNotationUml.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -71,7 +71,7 @@
*
* This syntax is compatible with the UML 1.3 and 1.4 specification.
*
- * @author Michiel
+ * @author Michiel van der Wulp
*/
public class ClassifierRoleNotationUml extends ClassifierRoleNotation {
@@ -278,8 +278,8 @@
}
nameString = nameString.trim();
// Loop through all base classes, building a comma separated list
- StringBuilder baseString =
- formatNameList(Model.getFacade().getBases(modelElement));
+ StringBuilder baseString = NotationUtilityUml.formatNameList(
+ Model.getFacade().getBases(modelElement));
baseString = new StringBuilder(baseString.toString().trim());
// Build the final string
if (nameString.length() != 0) {
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ComponentInstanceNotationUml.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -49,7 +49,7 @@
/**
* UML notation for a component instance.
*
- * @author Michiel
+ * @author Michiel van der Wulp
*/
public class ComponentInstanceNotationUml extends ComponentInstanceNotation {
@@ -125,8 +125,8 @@
}
// construct bases string (comma separated)
- StringBuilder baseStr =
- formatNameList(Model.getFacade().getClassifiers(modelElement));
+ StringBuilder baseStr = NotationUtilityUml.formatNameList(
+ Model.getFacade().getClassifiers(modelElement));
if ((nameStr.length() == 0) && (baseStr.length() == 0)) {
return "";
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ModelElementNameNotationUml.java 2010-11-20 11:27:11-0800
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -54,7 +54,7 @@
* [ << stereotype >>] [+|-|#] [name]
* </pre>
*
- * @author mvw
+ * @author Michiel van der Wulp
*/
public class ModelElementNameNotationUml extends ModelElementNameNotation {
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NodeInstanceNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NodeInstanceNotationUml.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NodeInstanceNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NodeInstanceNotationUml.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -49,7 +49,7 @@
/**
* Notation for a NodeInstance.
*
- * @author Michiel
+ * @author Michiel van der Wulp
*/
public class NodeInstanceNotationUml extends NodeInstanceNotation {
@@ -124,8 +124,8 @@
nameStr = Model.getFacade().getName(modelElement).trim();
}
// construct bases string (comma separated)
- StringBuilder baseStr =
- formatNameList(Model.getFacade().getClassifiers(modelElement));
+ StringBuilder baseStr = NotationUtilityUml.formatNameList(
+ Model.getFacade().getClassifiers(modelElement));
if ((nameStr.length() == 0) && (baseStr.length() == 0)) {
return "";
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NotationUtilityUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NotationUtilityUml.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NotationUtilityUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NotationUtilityUml.java 2010-11-20 11:27:11-0800
@@ -59,7 +59,7 @@
/**
* This class is a utility for the UML notation.
*
- * @author [email protected]
+ * @author Michiel van der Wulp
*/
public final class NotationUtilityUml {
/**
@@ -87,6 +87,8 @@
*/
private static final List<CustomSeparator> parameterCustomSep;
+ private static final String LIST_SEPARATOR = ", ";
+
/**
* The character with a meaning as a visibility at the start
* of an attribute.
@@ -1205,4 +1207,23 @@
return generateAction(a);
}
}
+
+ static StringBuilder formatNameList(Collection modelElements) {
+ return formatNameList(modelElements, LIST_SEPARATOR);
+ }
+
+ static StringBuilder formatNameList(Collection modelElements,
+ String separator) {
+ StringBuilder result = new StringBuilder();
+ for (Object element : modelElements) {
+ String name = Model.getFacade().getName(element);
+ // TODO: Any special handling for null names? append will use "null"
+ result.append(name).append(separator);
+ }
+ if (result.length() >= separator.length()) {
+ result.delete(result.length() - separator.length(),
+ result.length());
+ }
+ return result;
+ }
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ObjectFlowStateStateNotationUml.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -56,7 +56,7 @@
/**
* Notation for the State of an ObjectFlowState.
*
- * @author Michiel
+ * @author Michiel van der Wulp
*/
public class ObjectFlowStateStateNotationUml extends
ObjectFlowStateStateNotation {
@@ -239,7 +239,7 @@
Object cis = Model.getFacade().getType(modelElement);
if (Model.getFacade().isAClassifierInState(cis)) {
theNewText.append("[ ");
- theNewText.append(formatNameList(
+ theNewText.append(NotationUtilityUml.formatNameList(
Model.getFacade().getInStates(cis)));
theNewText.append(" ]");
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ObjectNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ObjectNotationUml.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ObjectNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ObjectNotationUml.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -47,7 +47,9 @@
import org.argouml.notation.providers.ObjectNotation;
/**
- * @author [email protected]
+ * UML notation for an Object.
+ *
+ * @author Michiel van der Wulp
*
*/
public class ObjectNotationUml extends ObjectNotation {
@@ -115,7 +117,7 @@
nameStr = Model.getFacade().getName(modelElement).trim();
}
- StringBuilder baseString = formatNameList(
+ StringBuilder baseString = NotationUtilityUml.formatNameList(
Model.getFacade().getClassifiers(modelElement));
if ((nameStr.length() == 0) && (baseString.length() == 0)) {
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/StateBodyNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/StateBodyNotationUml.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/StateBodyNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/StateBodyNotationUml.java 2010-11-20 11:27:11-0800
@@ -54,7 +54,7 @@
/**
* UML notation for the body of a state.
*
- * @author Michiel
+ * @author Michiel van der Wulp
*/
public class StateBodyNotationUml extends StateBodyNotation {
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/TransitionNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/TransitionNotationUml.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/TransitionNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/TransitionNotationUml.java 2010-11-20 11:27:11-0800
@@ -7,7 +7,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -38,7 +38,6 @@
package org.argouml.notation.providers.uml;
-import java.beans.PropertyChangeListener;
import java.text.ParseException;
import java.util.Collection;
import java.util.Iterator;
@@ -56,7 +55,7 @@
/**
* UML Notation for the text shown next to a Transition.
*
- * @author mvw
+ * @author Michiel van der Wulp
*/
public class TransitionNotationUml extends TransitionNotation {
@@ -566,7 +565,7 @@
/**
* This deletes modelelements, and swallows null without barking.
*
- * @author [email protected]
+ * @author Michiel van der Wulp
* @param obj
* the modelelement to be deleted
*/
@@ -760,80 +759,4 @@
return Model.getFacade().getName(cls);
}
- /*
- * @see org.argouml.uml.notation.NotationProvider#initialiseListener(java.beans.PropertyChangeListener, java.lang.Object)
- */
- public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
- addListenersForTransition(listener, modelElement);
- }
-
- private void addListenersForAction(PropertyChangeListener listener,
- Object action) {
- if (action != null) {
- addElementListener(listener, action,
- new String[] {
- // TODO: Action isn't a valid property name
- // Or is it? Double check validity checking code
- "script", "actualArgument", "action"
- });
- Collection args = Model.getFacade().getActualArguments(action);
- Iterator i = args.iterator();
- while (i.hasNext()) {
- Object argument = i.next();
- addElementListener(listener, argument, "value");
- }
- if (Model.getFacade().isAActionSequence(action)) {
- Collection subactions = Model.getFacade().getActions(action);
- i = subactions.iterator();
- while (i.hasNext()) {
- Object a = i.next();
- addListenersForAction(listener, a);
- }
- }
- }
- }
-
- private void addListenersForEvent(PropertyChangeListener listener,
- Object event) {
- if (event != null) {
- if (Model.getFacade().isAEvent(event)) {
- addElementListener(listener, event,
- new String[] {
- "parameter", "name"});
- }
- if (Model.getFacade().isATimeEvent(event)) {
- addElementListener(listener, event, new String[] {"when"});
- }
- if (Model.getFacade().isAChangeEvent(event)) {
- addElementListener(listener, event,
- new String[] {"changeExpression"});
- }
-
- Collection prms = Model.getFacade().getParameters(event);
- Iterator i = prms.iterator();
- while (i.hasNext()) {
- Object parameter = i.next();
- addElementListener(listener, parameter);
- }
- }
- }
-
- private void addListenersForTransition(PropertyChangeListener listener,
- Object transition) {
- addElementListener(listener, transition,
- new String[] {"guard", "trigger", "effect"});
-
- Object guard = Model.getFacade().getGuard(transition);
- if (guard != null) {
- addElementListener(listener, guard, "expression");
- }
-
- Object trigger = Model.getFacade().getTrigger(transition);
- addListenersForEvent(listener, trigger);
-
- Object effect = Model.getFacade().getEffect(transition);
- addListenersForAction(listener, effect);
- }
-
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -53,6 +53,7 @@
import org.argouml.notation.NotationName;
import org.argouml.notation.NotationProvider;
import org.argouml.notation.NotationProviderFactory2;
+import org.argouml.notation.NotationSettings;
import org.argouml.uml.diagram.DiagramSettings;
import org.argouml.uml.diagram.ui.FigNodeModelElement;
import org.argouml.uml.diagram.ui.FigSingleLineText;
@@ -157,7 +158,7 @@
notationProviderState =
NotationProviderFactory2.getInstance().getNotationProvider(
NotationProviderFactory2.TYPE_OBJECTFLOWSTATE_STATE,
- own, notationName);
+ own, this, notationName);
}
}
@@ -393,4 +394,23 @@
return new SelectionActionState(this);
}
+ public void notationRenderingChanged(NotationProvider np, String rendering) {
+ super.notationRenderingChanged(np, rendering);
+ if (notationProviderState == np) {
+ state.setText(rendering);
+ updateBounds();
+ damage();
+ }
+ }
+
+ public NotationSettings getNotationSettings(NotationProvider np) {
+ // both have the same settings
+ return getNotationSettings();
+ }
+
+ public Object getOwner(NotationProvider np) {
+ // both have the same owner
+ return getOwner();
+ }
+
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -134,18 +134,4 @@
}
}
- /*
- * @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateListeners(java.lang.Object)
- */
- @Override
- protected void updateListeners(Object oldOwner, Object newOwner) {
- super.updateListeners(oldOwner, newOwner);
- if (newOwner != null) {
- for (Object classifier
- : Model.getFacade().getClassifiers(newOwner)) {
- addElementListener(classifier, "name");
- }
- }
- }
-
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigState.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigState.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigState.java 2010-11-20 11:27:11-0800
@@ -52,6 +52,7 @@
import org.argouml.notation.NotationName;
import org.argouml.notation.NotationProvider;
import org.argouml.notation.NotationProviderFactory2;
+import org.argouml.notation.NotationSettings;
import org.argouml.uml.diagram.DiagramSettings;
import org.tigris.gef.presentation.Fig;
import org.tigris.gef.presentation.FigRRect;
@@ -137,7 +138,7 @@
@Override
protected void initNotationProviders(Object own) {
if (notationProviderBody != null) {
- notationProviderBody.cleanListener(this, own);
+ notationProviderBody.cleanListener();
}
super.initNotationProviders(own);
NotationName notation = Notation.findNotation(
@@ -150,9 +151,7 @@
}
}
- /*
- * @see org.argouml.uml.diagram.ui.FigNodeModelElement#modelChanged(java.beans.PropertyChangeEvent)
- */
+ @Override
protected void modelChanged(PropertyChangeEvent mee) {
super.modelChanged(mee);
// TODO: Do we really need to be listening for both of these events?
@@ -168,7 +167,7 @@
}
renderingChanged();
- notationProviderBody.updateListener(this, getOwner(), mee);
+ notationProviderBody.updateListener(getOwner(), mee);
damage();
}
}
@@ -179,7 +178,7 @@
@Override
public void removeFromDiagramImpl() {
if (notationProviderBody != null) {
- notationProviderBody.cleanListener(this, getOwner());
+ notationProviderBody.cleanListener();
}
super.removeFromDiagramImpl();
}
@@ -278,4 +277,23 @@
internal.setFont(f);
}
+ public void notationRenderingChanged(NotationProvider np, String rendering) {
+ super.notationRenderingChanged(np, rendering);
+ if (notationProviderBody == np) {
+ internal.setText(rendering);
+ updateBounds();
+ damage();
+ }
+ }
+
+ public NotationSettings getNotationSettings(NotationProvider np) {
+ // both have the same settings
+ return getNotationSettings();
+ }
+
+ public Object getOwner(NotationProvider np) {
+ // both have the same owner
+ return getOwner();
+ }
+
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java 2010-11-20 11:27:11-0800
@@ -9,6 +9,7 @@
* Contributors:
* Thomas Neustupny
* Bob Tarling
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -96,6 +97,7 @@
import org.argouml.notation.NotationName;
import org.argouml.notation.NotationProvider;
import org.argouml.notation.NotationProviderFactory2;
+import org.argouml.notation.NotationRenderer;
import org.argouml.notation.NotationSettings;
import org.argouml.ui.ArgoJMenu;
import org.argouml.ui.Clarifier;
@@ -142,6 +144,7 @@
KeyListener,
PropertyChangeListener,
ArgoNotationEventListener,
+ NotationRenderer,
ArgoDiagramAppearanceEventListener,
Highlightable,
IItemUID,
@@ -937,7 +940,7 @@
if (e instanceof AssociationChangeEvent
|| e instanceof AttributeChangeEvent) {
if (notationProviderName != null) {
- notationProviderName.updateListener(this, getOwner(), e);
+ notationProviderName.updateListener(getOwner(), e);
updateNameText();
}
updateListeners(getOwner(), getOwner());
@@ -1001,7 +1004,7 @@
*/
protected void initNotationProviders(Object own) {
if (notationProviderName != null) {
- notationProviderName.cleanListener(this, own);
+ notationProviderName.cleanListener();
}
/* This should NOT be looking for a NamedElement,
* since this is not always about the name of this
@@ -1203,7 +1206,7 @@
removeElementListener(o);
}
if (notationProviderName != null) {
- notationProviderName.cleanListener(this, getOwner());
+ notationProviderName.cleanListener();
}
/* TODO: MVW: Why is this not done in GEF? */
@@ -1799,4 +1802,25 @@
calcBounds();
}
} /* end computeRoute */
+
+ public void notationRenderingChanged(NotationProvider np, String rendering) {
+ if (notationProviderName == np) {
+ nameFig.setText(rendering);
+ damage();
+ }
+ }
+
+ public NotationSettings getNotationSettings(NotationProvider np) {
+ if (notationProviderName == np) {
+ return getNotationSettings();
+ }
+ return null;
+ }
+
+ public Object getOwner(NotationProvider np) {
+ if (notationProviderName == np) {
+ return getOwner();
+ }
+ return null;
+ }
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java 2010-11-20 11:27:11-0800
@@ -97,6 +97,7 @@
import org.argouml.notation.NotationName;
import org.argouml.notation.NotationProvider;
import org.argouml.notation.NotationProviderFactory2;
+import org.argouml.notation.NotationRenderer;
import org.argouml.notation.NotationSettings;
import org.argouml.profile.FigNodeStrategy;
import org.argouml.ui.ArgoJMenu;
@@ -150,6 +151,7 @@
PathContainer,
ArgoDiagramAppearanceEventListener,
ArgoNotationEventListener,
+ NotationRenderer,
Highlightable,
IItemUID,
Clarifiable,
@@ -1401,7 +1403,7 @@
if (event instanceof AssociationChangeEvent
|| event instanceof AttributeChangeEvent) {
if (notationProviderName != null) {
- notationProviderName.updateListener(this, getOwner(), event);
+ notationProviderName.updateListener(getOwner(), event);
}
// TODO: This brute force approach of updating listeners on each
// and every event, without checking the event type or any other
@@ -1549,7 +1551,7 @@
*/
protected void initNotationProviders(Object own) {
if (notationProviderName != null) {
- notationProviderName.cleanListener(this, own);
+ notationProviderName.cleanListener();
}
if (Model.getFacade().isAUMLElement(own)) {
NotationName notation = Notation.findNotation(
@@ -1968,7 +1970,7 @@
*/
protected void removeFromDiagramImpl() {
if (notationProviderName != null) { //This test needed for a FigPool
- notationProviderName.cleanListener(this, getOwner());
+ notationProviderName.cleanListener();
}
removeAllElementListeners();
setShadowSize(0);
@@ -2622,4 +2624,26 @@
f.setOwner(port);
}
}
+
+ public void notationRenderingChanged(NotationProvider np, String rendering) {
+ if (notationProviderName == np) {
+ nameFig.setText(rendering);
+ updateBounds();
+ damage();
+ }
+ }
+
+ public NotationSettings getNotationSettings(NotationProvider np) {
+ if (notationProviderName == np) {
+ return getNotationSettings();
+ }
+ return null;
+ }
+
+ public Object getOwner(NotationProvider np) {
+ if (notationProviderName == np) {
+ return getOwner();
+ }
+ return null;
+ }
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigSingleLineTextWithNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigSingleLineTextWithNotation.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigSingleLineTextWithNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigSingleLineTextWithNotation.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -52,6 +52,7 @@
import org.argouml.notation.NotationName;
import org.argouml.notation.NotationProvider;
import org.argouml.notation.NotationProviderFactory2;
+import org.argouml.notation.NotationRenderer;
import org.argouml.notation.NotationSettings;
import org.argouml.uml.diagram.DiagramSettings;
@@ -63,7 +64,7 @@
* @author Michiel
*/
public class FigSingleLineTextWithNotation extends FigSingleLineText
- implements ArgoNotationEventListener {
+ implements ArgoNotationEventListener, NotationRenderer {
/**
* @param owner the owning UML object
@@ -112,14 +113,14 @@
@Override
public void removeFromDiagram() {
ArgoEventPump.removeListener(ArgoEventTypes.ANY_NOTATION_EVENT, this);
- notationProvider.cleanListener(this, getOwner());
+ notationProvider.cleanListener();
super.removeFromDiagram();
}
@Override
public void propertyChange(PropertyChangeEvent pce) {
if (notationProvider != null) {
- notationProvider.updateListener(this, getOwner(), pce);
+ notationProvider.updateListener(getOwner(), pce);
}
super.propertyChange(pce);
}
@@ -169,14 +170,14 @@
*/
void setNotationProvider(NotationProvider np) {
if (notationProvider != null) {
- notationProvider.cleanListener(this, getOwner());
+ notationProvider.cleanListener();
}
this.notationProvider = np;
}
protected void initNotationProviders() {
if (notationProvider != null) {
- notationProvider.cleanListener(this, getOwner());
+ notationProvider.cleanListener();
}
if (getOwner() != null) {
NotationName notation = Notation.findNotation(
@@ -300,4 +301,25 @@
protected NotationSettings getNotationSettings() {
return getSettings().getNotationSettings();
}
+
+ public void notationRenderingChanged(NotationProvider np, String rendering) {
+ if (notationProvider == np) {
+ setText(rendering);
+ damage();
+ }
+ }
+
+ public NotationSettings getNotationSettings(NotationProvider np) {
+ if (notationProvider == np) {
+ return getNotationSettings();
+ }
+ return null;
+ }
+
+ public Object getOwner(NotationProvider np) {
+ if (notationProvider == np) {
+ return getOwner();
+ }
+ return null;
+ }
}
Modified: trunk/src/argouml-app/tests/org/argouml/notation/TestNotationProvider.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/notation/TestNotationProvider.java?view=diff&pathrev=18852&r1=18851&r2=18852
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/notation/TestNotationProvider.java (original)
+++ trunk/src/argouml-app/tests/org/argouml/notation/TestNotationProvider.java 2010-11-20 11:27:11-0800
@@ -1,13 +1,13 @@
/* $Id$
*****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 Contributors - see below
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * mvw
+ * Michiel van der Wulp
*****************************************************************************
*
* Some portions of this file was previously release using the BSD License:
@@ -53,7 +53,7 @@
* @author Michiel
*/
public class TestNotationProvider extends TestCase
- implements PropertyChangeListener {
+ implements NotationRenderer {
/*
* @see junit.framework.TestCase#setUp()
@@ -105,8 +105,9 @@
/**
* Test if the listener gets events when model elements change:
+ * @throws InterruptedException
*/
- public void testListener() {
+ public void testListener() throws InterruptedException {
Object model =
Model.getModelManagementFactory().createModel();
Project p = ProjectManager.getManager().getCurrentProject();
@@ -114,23 +115,34 @@
aClass = Model.getCoreFactory().buildClass(model);
NotationProvider np = new NPImpl();
- np.initialiseListener(this, aClass);
+ np.setRenderer(this);
+ np.initialiseListener(aClass);
propChanged = false;
Model.getCoreHelper().setName(aClass, "ClassA1");
Model.getPump().flushModelEvents();
+ Thread.sleep(2000);
assertTrue("No event received", propChanged);
- np.cleanListener(this, aClass);
+ np.cleanListener();
propChanged = false;
Model.getCoreHelper().setName(aClass, "ClassA2");
Model.getPump().flushModelEvents();
assertTrue("Event received, despite not listening", !propChanged);
- np.updateListener(this, aClass, null);
+ np.updateListener(aClass, null);
}
- public void propertyChange(PropertyChangeEvent evt) {
+ public void notationRenderingChanged(NotationProvider np,
+ String rendering) {
propChanged = true;
}
+
+ public NotationSettings getNotationSettings(NotationProvider np) {
+ return new NotationSettings();
+ }
+
+ public Object getOwner(NotationProvider np) {
+ return aClass;
+ }
}
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2683926
To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.