svn commit: r16442 - trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java
Michiel van der Wulp <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mvw
Date: 2008-12-27 01:35:19-0800
New Revision: 16442
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/collaboration/ui/CollabDiagramRenderer.java
Log:
Made the collaboration diagram use the new Fig constructors.
Made more conform Class diagrams.
Still to do: Comment Edge.
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&pathrev=16442&r1=16441&r2=16442
==============================================================================
--- 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-12-27 01:35:19-0800
@@ -29,6 +29,8 @@
import org.apache.log4j.Logger;
import org.argouml.model.Model;
import org.argouml.uml.CommentEdge;
+import org.argouml.uml.diagram.ArgoDiagram;
+import org.argouml.uml.diagram.DiagramSettings;
import org.argouml.uml.diagram.UmlDiagramRenderer;
import org.argouml.uml.diagram.static_structure.ui.FigEdgeNote;
import org.argouml.uml.diagram.ui.FigDependency;
@@ -81,6 +83,9 @@
Object node, Map styleAttributes) {
FigNode figNode = null;
+
+ assert node != null;
+
// 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();
@@ -88,35 +93,45 @@
&& ((UMLDiagram) diag).doesAccept(node)) {
figNode = ((UMLDiagram) diag).drop(node, null);
} else {
- LOG.debug("TODO: CollabDiagramRenderer getFigNodeFor");
- return null;
+ LOG.error("TODO: CollabDiagramRenderer getFigNodeFor");
+ throw new IllegalArgumentException(
+ "Node is not a recognised type. Received "
+ + node.getClass().getName());
}
lay.add(figNode);
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.
*
- * @see org.tigris.gef.graph.GraphEdgeRenderer#getFigEdgeFor(
- * org.tigris.gef.graph.GraphModel,
- * org.tigris.gef.base.Layer, java.lang.Object, java.util.Map)
+ * {@inheritDoc}
*/
public FigEdge getFigEdgeFor(GraphModel gm, Layer lay,
Object edge, Map styleAttributes) {
-
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("making figedge for " + edge);
+ }
+ if (edge == null) {
+ throw new IllegalArgumentException("A model edge must be supplied");
+ }
+
+ assert lay instanceof LayerPerspective;
+ ArgoDiagram diag = (ArgoDiagram) ((LayerPerspective) lay).getDiagram();
+ DiagramSettings settings = diag.getDiagramSettings();
+
FigEdge newEdge = null;
if (Model.getFacade().isAAssociationRole(edge)) {
- newEdge = new FigAssociationRole(edge, lay);
+ newEdge = new FigAssociationRole(edge, settings);
} else if (Model.getFacade().isAGeneralization(edge)) {
- newEdge = new FigGeneralization(edge, lay);
+ newEdge = new FigGeneralization(edge, settings);
} else if (Model.getFacade().isADependency(edge)) {
- newEdge = new FigDependency(edge , lay);
+ newEdge = new FigDependency(edge , settings);
} else if (edge instanceof CommentEdge) {
- newEdge = new FigEdgeNote(edge, lay);
+ newEdge = new FigEdgeNote(edge, lay); // TODO -> settings
}
if (newEdge == null) {
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=993630
To unsubscribe from this discussion, e-mail: [[email protected]].