svn commit: r16244 - trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java

Tom Morris <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-12-03 16:49:56-0800
New Revision: 16244

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java

Log:
Fix create/createDiagram confusion.  Add check for null diagram settings.  Handle new style callers with old style factories.

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java?view=diff&pathrev=16244&r1=16243&r2=16244
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/DiagramFactory.java	2008-12-03 16:49:56-0800
@@ -114,7 +114,7 @@
      * @return the newly instantiated class diagram
      */
     public ArgoDiagram createDefaultDiagram(Object namespace) {
-        return create(DiagramType.Class, namespace, null);
+        return createDiagram(DiagramType.Class, namespace, null);
     }
 
     /**
@@ -171,6 +171,11 @@
             final Object namespace, final Object machine,
             DiagramSettings settings) {
         final ArgoDiagram diagram;
+
+        if (settings == null) {
+            throw new IllegalArgumentException(
+                    "DiagramSettings may not be null");
+        }
         
         Object factory = factories.get(type);
         if (factory != null) {
@@ -193,8 +198,14 @@
                         "Unknown factory type registered");
             }
         } else {
-            diagram = createDiagram(diagramClasses.get(type), namespace,
-                    machine);
+            if ((type == DiagramType.State || type == DiagramType.Activity)
+                    && machine == null) {
+                diagram = createDiagram(diagramClasses.get(type), null,
+                        namespace);
+            } else {
+                diagram = createDiagram(diagramClasses.get(type), namespace,
+                        machine);
+            }
             diagram.setDiagramSettings(settings);
         }

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

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.