svn commit: r18612 - trunk/src/argouml-app/src/org/argouml/uml/diagram: activity/ui state/ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2010-07-31 04:47:45-0700
New Revision: 18612

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigActionState.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigStubState.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigSubmachineState.java

Log:
Ignore events coming from transitions

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigActionState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigActionState.java?view=diff&pathrev=18612&r1=18611&r2=18612
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigActionState.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigActionState.java	2010-07-31 04:47:45-0700
@@ -45,6 +45,7 @@
 import java.beans.PropertyVetoException;
 import java.util.Iterator;
 
+import org.apache.log4j.Logger;
 import org.argouml.model.AddAssociationEvent;
 import org.argouml.model.AttributeChangeEvent;
 import org.argouml.model.Model;
@@ -73,6 +74,8 @@
     private static final int PADDING = 8;
 
     private FigRRect cover;
+    
+    private static final Logger LOG = Logger.getLogger(FigActionState.class);
 
     /**
      * The notation provider for the textfield.
@@ -285,9 +288,14 @@
         super.modelChanged(mee);
         if (mee instanceof AddAssociationEvent
                 || mee instanceof AttributeChangeEvent) {
-            renderingChanged();
-            notationProvider.updateListener(this, getOwner(), mee);
-            damage();
+            // TODO: Rather than specifically ignore some item maybe it would be better
+            // to specifically state what items are of interest. Otherwise we may still
+            // be acting on other events we don't need
+            if (!Model.getFacade().isATransition(mee.getNewValue())) {
+                renderingChanged();
+                notationProvider.updateListener(this, getOwner(), mee);
+                damage();
+            }
         }
     }
 

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=18612&r1=18611&r2=18612
==============================================================================
--- 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-07-31 04:47:45-0700
@@ -168,8 +168,13 @@
     @Override
     protected void modelChanged(PropertyChangeEvent mee) {
         super.modelChanged(mee);
-        renderingChanged();
-        updateListeners(getOwner(), getOwner());
+        // TODO: Rather than specifically ignore some item maybe it would be better
+        // to specifically state what items are of interest. Otherwise we may still
+        // be acting on other events we don't need
+        if (!Model.getFacade().isATransition(mee.getNewValue())) {
+            renderingChanged();
+            updateListeners(getOwner(), getOwner());
+        }
     }
 
     @Override

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java?view=diff&pathrev=18612&r1=18611&r2=18612
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java	2010-07-31 04:47:45-0700
@@ -265,8 +265,13 @@
         super.modelChanged(mee);
         if (mee instanceof AssociationChangeEvent 
                 || mee instanceof AttributeChangeEvent) {
-            renderingChanged();
-            updateListeners(getOwner(), getOwner());
+            // TODO: Rather than specifically ignore some item maybe it would be better
+            // to specifically state what items are of interest. Otherwise we may still
+            // be acting on other events we don't need
+            if (!Model.getFacade().isATransition(mee.getNewValue())) {
+                renderingChanged();
+                updateListeners(getOwner(), getOwner());
+            }
         }
     }
 

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java?view=diff&pathrev=18612&r1=18611&r2=18612
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java	2010-07-31 04:47:45-0700
@@ -484,12 +484,13 @@
     // event processing
 
     protected void modelChanged(PropertyChangeEvent mee) {
-        if ("container".equals(mee.getPropertyName())
-                || "isConcurrent".equals(mee.getPropertyName())
-                || "subvertex".equals(mee.getPropertyName())) {
-            //do nothing
-            // this only happens at creation time - I hope
-        } else {
+        // TODO: Rather than specifically ignore some item maybe it would be better
+        // to specifically state what items are of interest. Otherwise we may still
+        // be acting on other events we don't need
+        if (!Model.getFacade().isATransition(mee.getNewValue())
+                && !("container".equals(mee.getPropertyName()))
+                && !("isConcurrent".equals(mee.getPropertyName()))
+                && !("subvertex".equals(mee.getPropertyName()))) {
             super.modelChanged(mee);
         }
     }

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigStubState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigStubState.java?view=diff&pathrev=18612&r1=18611&r2=18612
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigStubState.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigStubState.java	2010-07-31 04:47:45-0700
@@ -249,76 +249,88 @@
     @Override
     protected void modelChanged(PropertyChangeEvent mee) {
         super.modelChanged(mee);
-        if (getOwner() == null) {
-            return;
-        }
-        Object top = null;
-        Object oldRef = null;
-        Object container = facade.getContainer(getOwner());
-
-        //The event source is the owner stub state
-        if ((mee.getSource().equals(getOwner()))) {
-            if (mee.getPropertyName().equals("referenceState")) {
-                updateReferenceText();
-                if (container != null && facade.isASubmachineState(container)
-                        && facade.getSubmachine(container) != null) {
-                    top = facade.getTop(facade.getSubmachine(container));
-                    oldRef = stateMHelper.getStatebyName(
-                            (String) mee.getOldValue(), top);
-                }
-                updateListeners(oldRef, getOwner());
-            } else if ((mee.getPropertyName().equals("container")
-                    && facade.isASubmachineState(container))) {
-                removeListeners();
-                Object o = mee.getOldValue();
-                if (o != null && facade.isASubmachineState(o)) {
-                    removeElementListener(o);
-                }
-                stateMHelper.setReferenceState(getOwner(), null);
-                updateListeners(getOwner(), getOwner());
-                updateReferenceText();
-            }
-        } else {
-            /*The event source is the submachine state*/
-            if (container != null
-                    && mee.getSource().equals(container)
-                    && facade.isASubmachineState(container)
-                    && facade.getSubmachine(container) != null) {
-                /* The submachine has got a new name*/
-                // This indicates a change in association, not name - tfm
-                if (mee.getPropertyName().equals("submachine")) {
-                    if (mee.getOldValue() != null) {
-                        top = facade.getTop(mee.getOldValue());
-                        oldRef = stateMHelper.getStatebyName(facade
-                                .getReferenceState(getOwner()), top);
+        // TODO: Rather than specifically ignore some item maybe it would be better
+        // to specifically state what items are of interest. Otherwise we may still
+        // be acting on other events we don't need
+        if (!Model.getFacade().isATransition(mee.getNewValue())
+                && getOwner() != null) {
+            Object container = facade.getContainer(getOwner());
+
+            //The event source is the owner stub state
+            if ((mee.getSource().equals(getOwner()))) {
+                if (mee.getPropertyName().equals("referenceState")) {
+                    updateReferenceText();
+                    final Object oldRef;
+                    if (container != null && facade.isASubmachineState(container)
+                            && facade.getSubmachine(container) != null) {
+                        final Object top;
+                        top = facade.getTop(facade.getSubmachine(container));
+                        oldRef = stateMHelper.getStatebyName(
+                                (String) mee.getOldValue(), top);
+                    } else {
+                        oldRef = null;
                     }
-                    stateMHelper.setReferenceState(getOwner(), null);
                     updateListeners(oldRef, getOwner());
+                } else if ((mee.getPropertyName().equals("container")
+                        && facade.isASubmachineState(container))) {
+                    removeListeners();
+                    Object o = mee.getOldValue();
+                    if (o != null && facade.isASubmachineState(o)) {
+                        removeElementListener(o);
+                    }
+                    stateMHelper.setReferenceState(getOwner(), null);
+                    updateListeners(getOwner(), getOwner());
                     updateReferenceText();
                 }
-
             } else {
-                // The event source is the stub state's referenced state
-                // or one of the referenced state's path.
-                if (facade.getSubmachine(container) != null) {
-                    top = facade.getTop(facade.getSubmachine(container));
-                }
-                String path = facade.getReferenceState(getOwner());
-                Object refObject = stateMHelper.getStatebyName(path, top);
-                String ref;
-                if (refObject == null) {
-                    // The source was the referenced state that has got
-                    // a new name.
-                    ref = stateMHelper.getPath(mee.getSource());
+                /*The event source is the submachine state*/
+                if (container != null
+                        && mee.getSource().equals(container)
+                        && facade.isASubmachineState(container)
+                        && facade.getSubmachine(container) != null) {
+                    /* The submachine has got a new name*/
+                    // This indicates a change in association, not name - tfm
+                    if (mee.getPropertyName().equals("submachine")) {
+                        final Object oldRef;
+                        if (mee.getOldValue() != null) {
+                            final Object top;
+                            top = facade.getTop(mee.getOldValue());
+                            oldRef = stateMHelper.getStatebyName(facade
+                                    .getReferenceState(getOwner()), top);
+                        } else {
+                            oldRef = null;
+                        }
+                        stateMHelper.setReferenceState(getOwner(), null);
+                        updateListeners(oldRef, getOwner());
+                        updateReferenceText();
+                    }
+
                 } else {
-                    //The source was one of the referenced state's path which
-                    // has got a new name.
-                    ref = stateMHelper.getPath(refObject);
+                    // The event source is the stub state's referenced state
+                    // or one of the referenced state's path.
+                    final Object top;
+                    if (facade.getSubmachine(container) != null) {
+                        top = facade.getTop(facade.getSubmachine(container));
+                    } else {
+                        top = null;
+                    }
+                    String path = facade.getReferenceState(getOwner());
+                    Object refObject = stateMHelper.getStatebyName(path, top);
+                    String ref;
+                    if (refObject == null) {
+                        // The source was the referenced state that has got
+                        // a new name.
+                        ref = stateMHelper.getPath(mee.getSource());
+                    } else {
+                        //The source was one of the referenced state's path which
+                        // has got a new name.
+                        ref = stateMHelper.getPath(refObject);
+                    }
+                    // The Referenced State or one of his path's states has got
+                    // a new name
+                    stateMHelper.setReferenceState(getOwner(), ref);
+                    updateReferenceText();
                 }
-                // The Referenced State or one of his path's states has got
-                // a new name
-                stateMHelper.setReferenceState(getOwner(), ref);
-                updateReferenceText();
             }
         }
     }

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigSubmachineState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigSubmachineState.java?view=diff&pathrev=18612&r1=18611&r2=18612
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigSubmachineState.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/FigSubmachineState.java	2010-07-31 04:47:45-0700
@@ -334,26 +334,30 @@
      */
     protected void modelChanged(PropertyChangeEvent mee) {
         super.modelChanged(mee);
-        if (getOwner() == null) {
-            return;
-        }
-        if ((mee.getSource().equals(getOwner()))) {
-            if ((mee.getPropertyName()).equals("submachine")) {
-                updateInclude();
-                if (mee.getOldValue() != null) {
-                    updateListenersX(getOwner(), mee.getOldValue());
-                }
-            }
-        } else {
-            if (mee.getSource()
-                    == Model.getFacade().getSubmachine(getOwner())) {
-                // The Machine State has got a new name
-                if (mee.getPropertyName().equals("name")) {
+        
+        // TODO: Rather than specifically ignore some item maybe it would be better
+        // to specifically state what items are of interest. Otherwise we may still
+        // be acting on other events we don't need
+        if (!Model.getFacade().isATransition(mee.getNewValue())
+                && getOwner() != null) {
+            if ((mee.getSource().equals(getOwner()))) {
+                if ((mee.getPropertyName()).equals("submachine")) {
                     updateInclude();
+                    if (mee.getOldValue() != null) {
+                        updateListenersX(getOwner(), mee.getOldValue());
+                    }
                 }
-                // The Machine State has been deleted from model
-                if (mee.getPropertyName().equals("top")) {
-                    updateListeners(getOwner(), null);
+            } else {
+                if (mee.getSource()
+                        == Model.getFacade().getSubmachine(getOwner())) {
+                    // The Machine State has got a new name
+                    if (mee.getPropertyName().equals("name")) {
+                        updateInclude();
+                    }
+                    // The Machine State has been deleted from model
+                    if (mee.getPropertyName().equals("top")) {
+                        updateListeners(getOwner(), null);
+                    }
                 }
             }
         }

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

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.