svn commit: r16009 - trunk/src: argouml-app/src/org/argouml/uml/diagram/activity/ui argouml-app/src/org/argouml/uml/diagram/collaboration/ui argouml-app/src/org/argouml/uml/diagram/deployment/ui argouml-app/src/org/argouml/uml/diagram/state/ui argouml-app/src/org/argouml/uml/diagram/static_structure/ui argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-11-10 12:08:26-0800
New Revision: 16009

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/ActivityDiagramRenderer.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/DeploymentDiagramRenderer.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/StateDiagramRenderer.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/ClassDiagramRenderer.java
   trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SequenceDiagramRenderer.java

Log:
Get diagram directly from associated layer rather than going through project

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/ActivityDiagramRenderer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/ActivityDiagramRenderer.java?view=diff&rev=16009&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/ActivityDiagramRenderer.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/ActivityDiagramRenderer.java&r1=16008&r2=16009
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/ActivityDiagramRenderer.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/ActivityDiagramRenderer.java	2008-11-10 12:08:26-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 2003-2007 The Regents of the University of California. All
+// Copyright (c) 2003-2008 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
@@ -27,11 +27,11 @@
 
 import java.util.Map;
 
-import org.argouml.kernel.ProjectManager;
-import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.state.ui.StateDiagramRenderer;
 import org.argouml.uml.diagram.ui.UMLDiagram;
+import org.tigris.gef.base.Diagram;
 import org.tigris.gef.base.Layer;
+import org.tigris.gef.base.LayerPerspective;
 import org.tigris.gef.graph.GraphModel;
 import org.tigris.gef.presentation.FigNode;
 
@@ -71,12 +71,14 @@
      *      org.tigris.gef.graph.GraphModel, org.tigris.gef.base.Layer,
      *      java.lang.Object, java.util.Map)
      */
+    @Override
     public FigNode getFigNodeFor(GraphModel gm, Layer lay, Object node,
             Map styleAttributes) {
 
         FigNode figNode = null;
-        ArgoDiagram diag = ProjectManager.getManager().getCurrentProject()
-                .getActiveDiagram();
+        // Although not generally true for GEF, for Argo we know that the layer
+        // is a LayerPerspective which knows the associated diagram
+        Diagram diag = ((LayerPerspective) lay).getDiagram(); 
         if (diag instanceof UMLDiagram
             && ((UMLDiagram) diag).doesAccept(node)) {
             figNode = ((UMLDiagram) diag).drop(node, null);

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java?view=diff&rev=16009&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java&r1=16008&r2=16009
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java	2008-11-10 12:08:26-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 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
@@ -27,16 +27,16 @@
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.argouml.kernel.ProjectManager;
 import org.argouml.model.Model;
 import org.argouml.uml.CommentEdge;
-import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.UmlDiagramRenderer;
 import org.argouml.uml.diagram.static_structure.ui.FigEdgeNote;
 import org.argouml.uml.diagram.ui.FigDependency;
 import org.argouml.uml.diagram.ui.FigGeneralization;
 import org.argouml.uml.diagram.ui.UMLDiagram;
+import org.tigris.gef.base.Diagram;
 import org.tigris.gef.base.Layer;
+import org.tigris.gef.base.LayerPerspective;
 import org.tigris.gef.graph.GraphModel;
 import org.tigris.gef.presentation.FigEdge;
 import org.tigris.gef.presentation.FigNode;
@@ -72,9 +72,7 @@
     private static final Logger LOG =
 	Logger.getLogger(CollabDiagramRenderer.class);
 
-    /**
-     * Return a Fig that can be used to represent the given node.
-     *
+    /*
      * @see org.tigris.gef.graph.GraphNodeRenderer#getFigNodeFor(
      *         org.tigris.gef.graph.GraphModel, org.tigris.gef.base.Layer,
      *         java.lang.Object, java.util.Map)
@@ -83,8 +81,9 @@
 				 Object node, Map styleAttributes) {
 
         FigNode figNode = null;
-        ArgoDiagram diag = ProjectManager.getManager().getCurrentProject()
-                .getActiveDiagram();
+        // Although not generally true for GEF, for Argo we know that the layer
+        // is a LayerPerspective which knows the associated diagram
+        Diagram diag = ((LayerPerspective) lay).getDiagram(); 
         if (diag instanceof UMLDiagram
                 && ((UMLDiagram) diag).doesAccept(node)) {
             figNode = ((UMLDiagram) diag).drop(node, null);
@@ -97,7 +96,7 @@
         return figNode;
     }
 
-    /**
+    /*
      * Return a Fig that can be used to represent the given edge,
      * Generally the same code as for the ClassDiagram, since its
      * very related to it.
@@ -141,4 +140,4 @@
         lay.add(newEdge);
         return newEdge;
     }
-} /* end class CollabDiagramRenderer */
+}

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/DeploymentDiagramRenderer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/DeploymentDiagramRenderer.java?view=diff&rev=16009&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/DeploymentDiagramRenderer.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/DeploymentDiagramRenderer.java&r1=16008&r2=16009
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/DeploymentDiagramRenderer.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/deployment/ui/DeploymentDiagramRenderer.java	2008-11-10 12:08:26-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 2003-2007 The Regents of the University of California. All
+// Copyright (c) 2003-2008 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
@@ -28,10 +28,8 @@
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.argouml.kernel.ProjectManager;
 import org.argouml.model.Model;
 import org.argouml.uml.CommentEdge;
-import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.UmlDiagramRenderer;
 import org.argouml.uml.diagram.static_structure.ui.FigEdgeNote;
 import org.argouml.uml.diagram.static_structure.ui.FigLink;
@@ -41,7 +39,9 @@
 import org.argouml.uml.diagram.ui.FigDependency;
 import org.argouml.uml.diagram.ui.FigGeneralization;
 import org.argouml.uml.diagram.ui.UMLDiagram;
+import org.tigris.gef.base.Diagram;
 import org.tigris.gef.base.Layer;
+import org.tigris.gef.base.LayerPerspective;
 import org.tigris.gef.graph.GraphModel;
 import org.tigris.gef.presentation.FigEdge;
 import org.tigris.gef.presentation.FigNode;
@@ -73,8 +73,9 @@
 
         FigNode figNode = null;
 
-        ArgoDiagram diag = ProjectManager.getManager().getCurrentProject()
-                .getActiveDiagram();
+        // Although not generally true for GEF, for Argo we know that the layer
+        // is a LayerPerspective which knows the associated diagram
+        Diagram diag = ((LayerPerspective) lay).getDiagram(); 
         if (diag instanceof UMLDiagram
                 && ((UMLDiagram) diag).doesAccept(node)) {
             figNode = ((UMLDiagram) diag).drop(node, null);

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/StateDiagramRenderer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/StateDiagramRenderer.java?view=diff&rev=16009&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/StateDiagramRenderer.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/StateDiagramRenderer.java&r1=16008&r2=16009
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/StateDiagramRenderer.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/state/ui/StateDiagramRenderer.java	2008-11-10 12:08:26-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 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
@@ -27,14 +27,14 @@
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.argouml.kernel.ProjectManager;
 import org.argouml.model.Model;
 import org.argouml.uml.CommentEdge;
-import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.UmlDiagramRenderer;
 import org.argouml.uml.diagram.static_structure.ui.FigEdgeNote;
 import org.argouml.uml.diagram.ui.UMLDiagram;
+import org.tigris.gef.base.Diagram;
 import org.tigris.gef.base.Layer;
+import org.tigris.gef.base.LayerPerspective;
 import org.tigris.gef.graph.GraphModel;
 import org.tigris.gef.presentation.FigEdge;
 import org.tigris.gef.presentation.FigNode;
@@ -81,8 +81,9 @@
                                  Map styleAttributes) {
 
         FigNode figNode = null;
-        ArgoDiagram diag = ProjectManager.getManager().getCurrentProject()
-            .getActiveDiagram();
+        // Although not generally true for GEF, for Argo we know that the layer
+        // is a LayerPerspective which knows the associated diagram
+        Diagram diag = ((LayerPerspective) lay).getDiagram(); 
         if (diag instanceof UMLDiagram
                 && ((UMLDiagram) diag).doesAccept(node)) {
             figNode = ((UMLDiagram) diag).drop(node, null);
@@ -120,4 +121,4 @@
 
     static final long serialVersionUID = 8448809085349795886L;
 
-} /* end class StateDiagramRenderer */
+}

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/ClassDiagramRenderer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/ClassDiagramRenderer.java?view=diff&rev=16009&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/ClassDiagramRenderer.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/ClassDiagramRenderer.java&r1=16008&r2=16009
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/ClassDiagramRenderer.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/ClassDiagramRenderer.java	2008-11-10 12:08:26-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 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
@@ -29,11 +29,9 @@
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.argouml.kernel.ProjectManager;
 import org.argouml.model.CoreFactory;
 import org.argouml.model.Model;
 import org.argouml.uml.CommentEdge;
-import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.GraphChangeAdapter;
 import org.argouml.uml.diagram.UmlDiagramRenderer;
 import org.argouml.uml.diagram.ui.FigAssociation;
@@ -47,7 +45,9 @@
 import org.argouml.uml.diagram.ui.FigRealization;
 import org.argouml.uml.diagram.ui.FigUsage;
 import org.argouml.uml.diagram.ui.UMLDiagram;
+import org.tigris.gef.base.Diagram;
 import org.tigris.gef.base.Layer;
+import org.tigris.gef.base.LayerPerspective;
 import org.tigris.gef.graph.GraphModel;
 import org.tigris.gef.presentation.FigEdge;
 import org.tigris.gef.presentation.FigNode;
@@ -109,13 +109,13 @@
         if (node == null) {
             throw new IllegalArgumentException("A node must be supplied");
         }
-        ArgoDiagram diag = ProjectManager.getManager().getCurrentProject()
-                .getActiveDiagram();
+        // Although not generally true for GEF, for Argo we know that the layer
+        // is a LayerPerspective which knows the associated diagram
+        Diagram diag = ((LayerPerspective) lay).getDiagram(); 
         if (diag instanceof UMLDiagram
                 && ((UMLDiagram) diag).doesAccept(node)) {
-                figNode = (FigNodeModelElement) 
-                        ((UMLDiagram) diag).drop(node, null);
-
+            figNode = (FigNodeModelElement) ((UMLDiagram) diag)
+                    .drop(node, null);
         } else {
             LOG.error("TODO: ClassDiagramRenderer getFigNodeFor " + node);
             throw new IllegalArgumentException(

Modified: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SequenceDiagramRenderer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SequenceDiagramRenderer.java?view=diff&rev=16009&p1=trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SequenceDiagramRenderer.java&p2=trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SequenceDiagramRenderer.java&r1=16008&r2=16009
==============================================================================
--- trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SequenceDiagramRenderer.java	(original)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/SequenceDiagramRenderer.java	2008-11-10 12:08:26-0800
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 2007 The Regents of the University of California. All
+// Copyright (c) 2007-2008 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
@@ -27,14 +27,14 @@
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.argouml.kernel.ProjectManager;
 import org.argouml.model.Model;
 import org.argouml.uml.CommentEdge;
-import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.UmlDiagramRenderer;
 import org.argouml.uml.diagram.static_structure.ui.FigEdgeNote;
 import org.argouml.uml.diagram.ui.UMLDiagram;
+import org.tigris.gef.base.Diagram;
 import org.tigris.gef.base.Layer;
+import org.tigris.gef.base.LayerPerspective;
 import org.tigris.gef.graph.GraphModel;
 import org.tigris.gef.presentation.FigEdge;
 import org.tigris.gef.presentation.FigNode;
@@ -59,13 +59,14 @@
     public FigNode getFigNodeFor(GraphModel gm, Layer lay, Object node,
                                  Map styleAttributes) {
         FigNode result = null;
-        ArgoDiagram diag = ProjectManager.getManager().getCurrentProject()
-            	.getActiveDiagram();
+        // Although not generally true for GEF, for Argo we know that the layer
+        // is a LayerPerspective which knows the associated diagram
+        Diagram diag = ((LayerPerspective) lay).getDiagram(); 
         if (diag instanceof UMLDiagram
                 && ((UMLDiagram) diag).doesAccept(node)) {
             result = ((UMLDiagram) diag).drop(node, null);
         } else {
-        	return null;
+            return null;
         }
         LOG.debug("SequenceDiagramRenderer getFigNodeFor " + result);
         lay.add(result);
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.