svn commit: r14790 - trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2008-05-23 02:15:08-0700
New Revision: 14790

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

Log:
Make sure GUI changes on AWT thread.

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java?view=diff&rev=14790&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java&r1=14789&r2=14790
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigComment.java	2008-05-23 02:15:08-0700
@@ -49,6 +49,7 @@
 import org.argouml.model.AttributeChangeEvent;
 import org.argouml.model.Model;
 import org.argouml.model.RemoveAssociationEvent;
+import org.argouml.model.UmlChangeEvent;
 import org.argouml.ui.ArgoJMenu;
 import org.argouml.uml.diagram.ui.FigMultiLineText;
 import org.argouml.uml.diagram.ui.FigNodeModelElement;
@@ -610,12 +611,9 @@
     ///////////////////////////////////////////////////////////////////
     // Internal methods
 
-    /*
-     * @see org.argouml.uml.diagram.ui.FigNodeModelElement#modelChanged(java.beans.PropertyChangeEvent)
-     */
     @Override
-    protected final void modelChanged(PropertyChangeEvent mee) {
-        super.modelChanged(mee);
+    protected final void updateLayout(UmlChangeEvent mee) {
+        super.updateLayout(mee);
 
         if (mee instanceof AttributeChangeEvent
                 && mee.getPropertyName().equals("body")) {
@@ -629,10 +627,9 @@
             /* Remove the commentedge.
              * If there are more then one comment-edges between 
              * the 2 objects, then delete them all. */
-            Collection toRemove = new ArrayList();
+            Collection<FigEdgeNote> toRemove = new ArrayList<FigEdgeNote>();
             Collection c = getFigEdges(); // all connected edges
-            Iterator i = c.iterator();
-            while (i.hasNext()) {
+            for (Iterator i = c.iterator(); i.hasNext(); ) {
                 FigEdgeNote fen = (FigEdgeNote) i.next();
                 Object otherEnd = fen.getDestination(); // the UML object
                 if (otherEnd == getOwner()) { // wrong end of the edge
@@ -642,9 +639,8 @@
                     toRemove.add(fen);
                 }
             }
-            i = toRemove.iterator();
-            while (i.hasNext()) {
-                FigEdgeNote fen = (FigEdgeNote) i.next();
+            
+            for (FigEdgeNote fen : toRemove) {
                 fen.removeFromDiagram();
             }
         }
@@ -700,6 +696,10 @@
         newlyCreated = false;
     }
     
+    /**
+     * Get the text body of the comment.
+     * @return the body of the comment
+     */
     public String getBody() {
         return bodyTextFig.getText();
     }
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.