svn commit: r13526 - trunk/src/model/src/org/argouml/model

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2007-09-10 13:28:50-0700
New Revision: 13526

Modified:
   trunk/src/model/src/org/argouml/model/Model.java
   trunk/src/model/src/org/argouml/model/ModelCommand.java
   trunk/src/model/src/org/argouml/model/ModelCommandCreationObserver.java

Log:
provide execute method in model interface to delegate model command to ArgoUML for execution

Modified: trunk/src/model/src/org/argouml/model/Model.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model/src/org/argouml/model/Model.java?view=diff&rev=13526&p1=trunk/src/model/src/org/argouml/model/Model.java&p2=trunk/src/model/src/org/argouml/model/Model.java&r1=13525&r2=13526
==============================================================================
--- trunk/src/model/src/org/argouml/model/Model.java	(original)
+++ trunk/src/model/src/org/argouml/model/Model.java	2007-09-10 13:28:50-0700
@@ -556,7 +556,8 @@
      * Gets the external class responsible for handling mementos.
      * @return the MementoCreationObserver
      */
-    public static ModelCommandCreationObserver getModelCommandCreationObserver() {
+    public static ModelCommandCreationObserver
+    getModelCommandCreationObserver() {
         return modelCommandCreationObserver;
     }
 
@@ -578,14 +579,16 @@
      * Notify any observer that a memento has been created and execute
      * that command.
      * @param command The newly created command.
+     * @return the reulting object from the command
      */
     public static Object execute(
             ModelCommand command) {
         ModelCommandCreationObserver mco = getModelCommandCreationObserver();
         if (mco != null) {
-            mco.modelCommandCreated(command);
+            return mco.execute(command);
+        } else {
+            return command.execute();
         }
-        return command.execute();
     }
 
     /**

Modified: trunk/src/model/src/org/argouml/model/ModelCommand.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model/src/org/argouml/model/ModelCommand.java?view=diff&rev=13526&p1=trunk/src/model/src/org/argouml/model/ModelCommand.java&p2=trunk/src/model/src/org/argouml/model/ModelCommand.java&r1=13525&r2=13526
==============================================================================
--- trunk/src/model/src/org/argouml/model/ModelCommand.java	(original)
+++ trunk/src/model/src/org/argouml/model/ModelCommand.java	2007-09-10 13:28:50-0700
@@ -36,6 +36,7 @@
 
     /**
      * The method to execute this memento.
+     * @return any result generated by this command
      */
     public abstract Object execute();
 

Modified: trunk/src/model/src/org/argouml/model/ModelCommandCreationObserver.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/model/src/org/argouml/model/ModelCommandCreationObserver.java?view=diff&rev=13526&p1=trunk/src/model/src/org/argouml/model/ModelCommandCreationObserver.java&p2=trunk/src/model/src/org/argouml/model/ModelCommandCreationObserver.java&r1=13525&r2=13526
==============================================================================
--- trunk/src/model/src/org/argouml/model/ModelCommandCreationObserver.java	(original)
+++ trunk/src/model/src/org/argouml/model/ModelCommandCreationObserver.java	2007-09-10 13:28:50-0700
@@ -31,9 +31,11 @@
  * @author Bob Tarling
  */
 public interface ModelCommandCreationObserver {
+    
     /**
-     * Called whenever a memento is created by the model subsystem.
-     * @param memento the memento.
+     * Called whenever a memento is created by the model subsystem
+     * to execute it and store it for undo
+     * @param command the memento.
      */
-    void modelCommandCreated(ModelCommand memento);
+    Object execute(ModelCommand command);
 }
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.