svn commit: r18723 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2010-09-06 11:41:44-0700
New Revision: 18723

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java

Log:
In UML2 only listen for change to navigableOwnedEnd of association in order to modify navigable properties of ends

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java?view=diff&pathrev=18723&r1=18722&r2=18723
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAssociation.java	2010-09-06 11:41:44-0700
@@ -52,6 +52,7 @@
 
 import org.apache.log4j.Logger;
 import org.argouml.model.AddAssociationEvent;
+import org.argouml.model.AssociationChangeEvent;
 import org.argouml.model.AttributeChangeEvent;
 import org.argouml.model.Model;
 import org.argouml.notation.NotationProviderFactory2;
@@ -130,8 +131,35 @@
         setBetweenNearestPoints(true);
         
         initializeNotationProvidersInternal(getOwner());
+        
+        if (Model.getFacade().getUmlVersion().charAt(0) == '2') {
+            Model.getPump().addModelEventListener(this, getOwner(), 
+                    new String[] {"navigableOwnedEnd"});
+        }
     }
     
+    protected void removeFromDiagramImpl() {
+        if (Model.getFacade().getUmlVersion().charAt(0) == '2') {
+            Model.getPump().removeModelEventListener(this, 
+                    getOwner(), 
+                    new String[] {"navigableOwnedEnd"});
+        }
+        super.removeFromDiagram();
+    }
+    
+    public void propertyChange(PropertyChangeEvent pce) {
+        if (Model.getFacade().getUmlVersion().charAt(0) == '2'
+                && pce instanceof AssociationChangeEvent
+                && pce.getPropertyName().equals("navigableOwnedEnd")) {
+            srcEnd.getGroup().determineArrowHead();
+            destEnd.getGroup().determineArrowHead();
+            applyArrowHeads();
+            damage();
+        }
+        super.propertyChange(pce);
+    }
+    
+    
     /**
      * Called by the constructor to create the Figs at each end
      * of the association.
@@ -899,7 +927,7 @@
     /**
      * Decide which arrow head should appear
      */
-    private void determineArrowHead() {
+    void determineArrowHead() {
         assert getOwner() != null;
 
         Object ak =  Model.getFacade().getAggregation(getOwner());

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2656098

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.