Author: mvw
Date: 2008-08-22 06:47:35-0700
New Revision: 15602

Modified:
   trunk/src/argouml-app/src/org/argouml/application/events/ArgoEventPump.java
   trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java

Log:
Improvement on the code committed for issue 5251: "Incorrect default for new 
settings when loading 0.24 project".
This speeds up loading a project considerably, and removes the flashing effect 
of association ends.

Modified: 
trunk/src/argouml-app/src/org/argouml/application/events/ArgoEventPump.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/application/events/ArgoEventPump.java?view=diff&rev=15602&p1=trunk/src/argouml-app/src/org/argouml/application/events/ArgoEventPump.java&p2=trunk/src/argouml-app/src/org/argouml/application/events/ArgoEventPump.java&r1=15601&r2=15602
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/application/events/ArgoEventPump.java 
(original)
+++ trunk/src/argouml-app/src/org/argouml/application/events/ArgoEventPump.java 
2008-08-22 06:47:35-0700
@@ -154,6 +154,9 @@
         switch (event.getEventType()) {
        case ArgoEventTypes.NOTATION_CHANGED :
            listener.notationChanged(event);
+           /* Remark: The code in 
+            * ProjectSettings.init() currently presumes
+            * that nobody is using this event. */
            break;
 
        case ArgoEventTypes.NOTATION_ADDED :

Modified: trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java
Url: 
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java?view=diff&rev=15602&p1=trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java&p2=trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java&r1=15601&r2=15602
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java   
(original)
+++ trunk/src/argouml-app/src/org/argouml/kernel/ProjectSettings.java   
2008-08-22 06:47:35-0700
@@ -173,37 +173,66 @@
      * first, and then corrected.  
      */
     public void init() {
-        init(notationLanguage, 
-                Notation.KEY_DEFAULT_NOTATION);
-        init(showBoldNames, 
-                Notation.KEY_SHOW_BOLD_NAMES);
-        init(useGuillemots, 
-                Notation.KEY_USE_GUILLEMOTS);
-        init(showAssociationNames, 
-                Notation.KEY_SHOW_ASSOCIATION_NAMES);
-        init(showVisibility,
-                Notation.KEY_SHOW_VISIBILITY);
-        init(showMultiplicity,
-                Notation.KEY_SHOW_MULTIPLICITY);
-        init(showInitialValue, 
-                Notation.KEY_SHOW_INITIAL_VALUE);
-        init(showProperties,
-                Notation.KEY_SHOW_PROPERTIES);
-        init(showTypes, 
-                Notation.KEY_SHOW_TYPES);
-        init(showStereotypes, 
-                Notation.KEY_SHOW_STEREOTYPES);
-        init(showSingularMultiplicities, 
-                Notation.KEY_SHOW_SINGULAR_MULTIPLICITIES);
-        init(defaultShadowWidth,
-                Notation.KEY_DEFAULT_SHADOW_WIDTH);
-
-        fireDiagramAppearanceEvent(DiagramAppearance.KEY_FONT_NAME, 
-                fontName, fontName);
-        fireDiagramAppearanceEvent(DiagramAppearance.KEY_FONT_SIZE, 
-                fontSize, fontSize);
+        /* Since this is (hopefully) a temporary solution,
+         * and nobody ever looks at the type of notation event,
+         * we can simplify from sending every existing event
+         * to one event only. But since there is no 
+         * catch-all event defined, we just make one up.
+         * Rationale: reduce the number of total 
+         * refreshes of the drawing. */
+        init(true, Configuration.makeKey("notation", "all"));
+
+        /* The above hence replaces the following statements. 
+         * If ever someone needs to dissect notation events, 
+         * we may need to add these again. */
+//        init(notationLanguage, 
+//                Notation.KEY_DEFAULT_NOTATION);
+//        init(showBoldNames, 
+//                Notation.KEY_SHOW_BOLD_NAMES);
+//        init(useGuillemots, 
+//                Notation.KEY_USE_GUILLEMOTS);
+//        init(showAssociationNames, 
+//                Notation.KEY_SHOW_ASSOCIATION_NAMES);
+//        init(showVisibility,
+//                Notation.KEY_SHOW_VISIBILITY);
+//        init(showMultiplicity,
+//                Notation.KEY_SHOW_MULTIPLICITY);
+//        init(showInitialValue, 
+//                Notation.KEY_SHOW_INITIAL_VALUE);
+//        init(showProperties,
+//                Notation.KEY_SHOW_PROPERTIES);
+//        init(showTypes, 
+//                Notation.KEY_SHOW_TYPES);
+//        init(showStereotypes, 
+//                Notation.KEY_SHOW_STEREOTYPES);
+//        init(showSingularMultiplicities, 
+//                Notation.KEY_SHOW_SINGULAR_MULTIPLICITIES);
+//        init(defaultShadowWidth,
+//                Notation.KEY_DEFAULT_SHADOW_WIDTH);
+
+        /* Since this is (hopefully) a temporary solution,
+         * and nobody ever looks at the type of the
+         * diagram appearance event,
+         * we can simplify from sending every existing event
+         * to one event only. But since there is no 
+         * catch-all event defined, we just use one.
+         * Rationale: reduce the number of total 
+         * refreshes of the drawing. */
+        fireDiagramAppearanceEvent(
+                Configuration.makeKey("diagramappearance", "all"), 
+                0, 0);
+
+        /* The above hence replaces the following statements. 
+         * If ever someone needs to dissect 
+         * diagram-appearance events, 
+         * we may need to add these again. */
+//        fireDiagramAppearanceEvent(DiagramAppearance.KEY_FONT_NAME, 
+//                fontName, fontName);
+//        fireDiagramAppearanceEvent(DiagramAppearance.KEY_FONT_SIZE, 
+//                fontSize, fontSize);
     }
 
+    @SuppressWarnings("unused")
     private void init(String value, ConfigurationKey key) {
         fireNotationEvent(key, value, value);
     }
@@ -212,6 +241,7 @@
         fireNotationEvent(key, value, value);
     }
 
+    @SuppressWarnings("unused")
     private void init(int value, ConfigurationKey key) {
         fireNotationEvent(key, value, value);
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to