svn commit: r17284 - trunk/src/argouml-core-diagrams-uml2/src/org/argouml/diagram/uml2/FigAssociation2.java

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-08-18 15:23:27-0700
New Revision: 17284

Modified:
   trunk/src/argouml-core-diagrams-uml2/src/org/argouml/diagram/uml2/FigAssociation2.java

Log:
Detect change of navigation in UML2 association

Modified: trunk/src/argouml-core-diagrams-uml2/src/org/argouml/diagram/uml2/FigAssociation2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-uml2/src/org/argouml/diagram/uml2/FigAssociation2.java?view=diff&pathrev=17284&r1=17283&r2=17284
==============================================================================
--- trunk/src/argouml-core-diagrams-uml2/src/org/argouml/diagram/uml2/FigAssociation2.java	(original)
+++ trunk/src/argouml-core-diagrams-uml2/src/org/argouml/diagram/uml2/FigAssociation2.java	2009-08-18 15:23:27-0700
@@ -24,6 +24,9 @@
 
 package org.argouml.diagram.uml2;
 
+import java.beans.PropertyChangeEvent;
+
+import org.apache.log4j.Logger;
 import org.argouml.uml.diagram.DiagramSettings;
 import org.argouml.uml.diagram.ui.FigAssociation;
 
@@ -33,6 +36,8 @@
  *
  */
 class FigAssociation2 extends FigAssociation {
+    
+    private static final Logger LOG = Logger.getLogger(FigAssociation2.class);
 
     /**
      * Constructor used by PGML parser.
@@ -42,5 +47,28 @@
      */
     public FigAssociation2(Object owner, DiagramSettings settings) {
         super(owner, settings);
+        addListener(owner);
+    }
+    
+    @Override
+    public void propertyChange(final PropertyChangeEvent pve) {
+        if ("navigableOwnedEnd".equals(pve.getPropertyName())) {
+            // TODO: We need to amend the arrow heads here
+            LOG.debug("Navigation has changed");
+        }
+        super.propertyChange(pve);
+    }
+    
+    /*
+     * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#updateListeners(java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public void updateListeners(Object oldOwner, Object newOwner) {
+        super.updateListeners(oldOwner, newOwner);
+        addListener(newOwner);
+    }
+    
+    private void addListener(Object owner) {
+        addElementListener(owner, new String[] {"remove", "navigableOwnedEnd"});
     }
 }

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

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.