svn commit: r17430 - trunk/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines

Michiel van der Wulp <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2009-10-27 05:16:16-0700
New Revision: 17430

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PropPanelEvent.java
   trunk/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLEventParameterListModel.java

Log:
Patch as delivered by Luca DO with issue 5886: move up and down event parameters.

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PropPanelEvent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PropPanelEvent.java?view=diff&pathrev=17430&r1=17429&r2=17430
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PropPanelEvent.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/PropPanelEvent.java	2009-10-27 05:16:16-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -30,8 +30,6 @@
 
 import org.argouml.uml.ui.ActionNavigateContainerElement;
 import org.argouml.uml.ui.UMLLinkedList;
-import org.argouml.uml.ui.UMLMutableLinkedList;
-import org.argouml.uml.ui.foundation.core.ActionNewParameter;
 import org.argouml.uml.ui.foundation.core.PropPanelModelElement;
 import org.argouml.uml.ui.foundation.extension_mechanisms.ActionNewStereotype;
 
@@ -89,8 +87,7 @@
     protected JScrollPane getParameterScroll() {
         if (paramScroll == null) {
             paramListModel = new UMLEventParameterListModel();
-            JList paramList = new UMLMutableLinkedList(paramListModel,
-                    new ActionNewParameter());
+            JList paramList = new UMLLinkedList(paramListModel);
             paramList.setVisibleRowCount(3);
             paramScroll = new JScrollPane(paramList);
         }

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLEventParameterListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLEventParameterListModel.java?view=diff&pathrev=17430&r1=17429&r2=17430
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLEventParameterListModel.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/behavior/state_machines/UMLEventParameterListModel.java	2009-10-27 05:16:16-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2009 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -24,8 +24,11 @@
 
 package org.argouml.uml.ui.behavior.state_machines;
 
+import java.util.Collection;
+import java.util.List;
+
 import org.argouml.model.Model;
-import org.argouml.uml.ui.UMLModelElementListModel2;
+import org.argouml.uml.ui.UMLModelElementOrderedListModel2;
 
 /**
  * A list model for the parameters belonging to an event.
@@ -33,7 +36,8 @@
  * @since Dec 14, 2002
  * @author [email protected]
  */
-public class UMLEventParameterListModel extends UMLModelElementListModel2 {
+public class UMLEventParameterListModel 
+    extends UMLModelElementOrderedListModel2 {
 
 
     /**
@@ -58,4 +62,37 @@
         return Model.getFacade().getParameters(getTarget()).contains(element);
     }
 
+    @Override
+    protected void moveDown(int index) {
+        Object event = getTarget();
+        Collection c = Model.getFacade().getParameters(event);
+        if (c instanceof List && index < c.size() - 1) {
+            Object mem = ((List) c).get(index);
+            Model.getCoreHelper().removeParameter(event, mem);
+            Model.getCoreHelper().addParameter(event, index + 1, mem);
+        }
+    }
+
+    @Override
+    protected void moveToBottom(int index) {
+        Object event = getTarget();
+        Collection c = Model.getFacade().getParameters(event);
+        if (c instanceof List && index < c.size() - 1) {
+            Object mem = ((List) c).get(index);
+            Model.getCoreHelper().removeParameter(event, mem);
+            Model.getCoreHelper().addParameter(event, c.size() - 1, mem);
+        }
+    }
+
+    @Override
+    protected void moveToTop(int index) {
+        Object event = getTarget();
+        Collection c = Model.getFacade().getParameters(event);
+        if (c instanceof List && index > 0) {
+            Object mem = ((List) c).get(index);
+            Model.getCoreHelper().removeParameter(event, mem);
+            Model.getCoreHelper().addParameter(event, 0, mem);
+        }
+    }
+
 }

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

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.