svn commit: r16731 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeModelElement.java

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-01-27 18:26:00-0800
New Revision: 16731

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

Log:
Provide updateLayout method for AWT update

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=16731&r1=16730&r2=16731
==============================================================================
--- 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	2009-01-27 18:26:00-0800
@@ -73,6 +73,7 @@
 import org.argouml.model.InvalidElementException;
 import org.argouml.model.Model;
 import org.argouml.model.RemoveAssociationEvent;
+import org.argouml.model.UmlChangeEvent;
 import org.argouml.notation.Notation;
 import org.argouml.notation.NotationName;
 import org.argouml.notation.NotationProvider;
@@ -607,7 +608,7 @@
      * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
      */
     @Override
-    public void propertyChange(PropertyChangeEvent pve) {
+    public void propertyChange(final PropertyChangeEvent pve) {
         Object src = pve.getSource();
         String pName = pve.getPropertyName();
         if (pve instanceof DeleteInstanceEvent && src == getOwner()) {
@@ -646,6 +647,23 @@
             /* If the source of the event is an UML object,
              * then the UML model has been changed.*/
             modelChanged(pve);
+            
+            final UmlChangeEvent event = (UmlChangeEvent) pve;
+            
+            Runnable doWorkRunnable = new Runnable() {
+                public void run() {
+                    try {
+                        updateLayout(event);
+                    } catch (InvalidElementException e) {
+                        if (LOG.isDebugEnabled()) {
+                            LOG.debug("updateLayout method accessed "
+                                    + "deleted element ", e);
+                        }
+                    }
+                }  
+            };
+            SwingUtilities.invokeLater(doWorkRunnable);
+            
         }
         /* The following is a possible future improvement 
          * of the modelChanged() function.
@@ -685,6 +703,20 @@
     protected void modelAssociationRemoved(RemoveAssociationEvent rae) {
         // Default implementation is to do nothing
     }
+    
+    /**
+     * This is a template method called by the ArgoUML framework as the result
+     * of a change to a model element. Do not call this method directly
+     * yourself.
+     * <p>Override this in any subclasses in order to restructure the FigNode
+     * due to change of any model element that this FigNode is listening to.</p>
+     * <p>This method is guaranteed by the framework to be running on the 
+     * Swing/AWT thread.</p>
+     *
+     * @param event the UmlChangeEvent that caused the change
+     */
+    protected void updateLayout(UmlChangeEvent event) {
+    }
 
     /**
      * This method is called when the user doubleclicked on the text field,

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

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.