svn commit: r17533 - trunk: src/argouml-app/src/org/argouml/persistence src/argouml-app/src/org/argouml/uml/diagram src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui src/argouml-app/src/org/argouml/uml/diagram/ui tools/eclipse

Michiel van der Wulp <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2009-11-23 12:40:51-0800
New Revision: 17533

Modified:
   trunk/src/argouml-app/src/org/argouml/persistence/PGMLStackParser.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/StylePanelFigClass.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
   trunk/tools/eclipse/eclipse-user-defined-dictionary

Log:
Getting rid of the XxxxCompartmentContainer interfaces (according architecture from Bob). Not complete yet.
Added FigCompartmentBox.showCompartment(), so that other classes only need to deal with the Box, not its contents.
Make the hide/show of the EnumerationsLiteral compartment persist.

Modified: trunk/src/argouml-app/src/org/argouml/persistence/PGMLStackParser.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/persistence/PGMLStackParser.java?view=diff&pathrev=17533&r1=17532&r2=17533
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/persistence/PGMLStackParser.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/persistence/PGMLStackParser.java	2009-11-23 12:40:51-0800
@@ -300,8 +300,11 @@
     }
 
     /**
-     * Set the fig style attributes. This should move into
+     * Set the fig style attributes. <p>
+     * 
+     * TODO: This should move into
      * the render factories as described in issue 859.
+     * 
      * @param fig the fig to style.
      * @param attributeMap a map of name value pairs
      */
@@ -311,15 +314,27 @@
             final String name = entry.getKey();
             final String value = entry.getValue();
 
-            if ("operationsVisible".equals(name)) {
-                ((OperationsCompartmentContainer) fig)
-                    .setOperationsVisible(value.equalsIgnoreCase("true"));
-            } else if ("attributesVisible".equals(name)) {
+            if(fig instanceof FigCompartmentBox) {
                 FigCompartmentBox fcb = (FigCompartmentBox) fig;
-                FigCompartment fc =
-                    fcb.getCompartment(Model.getMetaTypes().getAttribute());
-                fcb.setCompartmentVisible(fc, value.equalsIgnoreCase("true"));
-            } else if ("stereotypeVisible".equals(name)) {
+                if ("operationsVisible".equals(name)) {
+                    fcb.showCompartment(
+                            Model.getMetaTypes().getOperation(), 
+                            value.equalsIgnoreCase("true"));
+                } else if ("attributesVisible".equals(name)) {
+                    fcb.showCompartment(
+                            Model.getMetaTypes().getAttribute(), 
+                            value.equalsIgnoreCase("true"));
+                } else if ("enumerationLiteralsVisible".equals(name)) {
+                    fcb.showCompartment(
+                            Model.getMetaTypes().getEnumerationLiteral(), 
+                            value.equalsIgnoreCase("true"));
+                } else if ("extensionPointVisible".equals(name)) {
+                    fcb.showCompartment(
+                            Model.getMetaTypes().getExtensionPoint(), 
+                            value.equalsIgnoreCase("true"));
+                }
+            }
+            if ("stereotypeVisible".equals(name)) {
                 ((StereotypeContainer) fig)
                     .setStereotypeVisible(value.equalsIgnoreCase("true"));
             } else if ("visibilityVisible".equals(name)) {
@@ -328,9 +343,6 @@
             } else if ("pathVisible".equals(name)) {
                 ((PathContainer) fig)
                     .setPathVisible(value.equalsIgnoreCase("true"));
-            } else if ("extensionPointVisible".equals(name)) {
-                ((ExtensionPointsCompartmentContainer) fig)
-                    .setExtensionPointsVisible(value.equalsIgnoreCase("true"));
             }
         }
     }

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java?view=diff&pathrev=17533&r1=17532&r2=17533
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/UmlDiagramRenderer.java	2009-11-23 12:40:51-0800
@@ -166,7 +166,9 @@
     }
 
     /**
-     * Set the fig style according to attributes.
+     * Set the fig style according to attributes. <p>
+     * 
+     * TODO: This is never used! Can we remove?
      *
      * @param fig the fig to style.
      * @param attributeMap a map of name value pairs
@@ -178,14 +180,25 @@
             name = entry.getKey();
             value = entry.getValue();
 
-            if ("operationsVisible".equals(name)) {
-                ((OperationsCompartmentContainer) fig)
-                    .setOperationsVisible(value.equalsIgnoreCase("true"));
-            } else if ("attributesVisible".equals(name)) {
+            if(fig instanceof FigCompartmentBox) {
                 FigCompartmentBox fcb = (FigCompartmentBox) fig;
-                FigCompartment fc =
-                    fcb.getCompartment(Model.getMetaTypes().getAttribute());
-                fcb.setCompartmentVisible(fc, value.equalsIgnoreCase("true"));
+                if ("operationsVisible".equals(name)) {
+                    fcb.showCompartment(
+                            Model.getMetaTypes().getOperation(), 
+                            value.equalsIgnoreCase("true"));
+                } else if ("attributesVisible".equals(name)) {
+                    fcb.showCompartment(
+                            Model.getMetaTypes().getAttribute(), 
+                            value.equalsIgnoreCase("true"));
+                } else if ("enumerationLiteralsVisible".equals(name)) {
+                    fcb.showCompartment(
+                            Model.getMetaTypes().getEnumerationLiteral(), 
+                            value.equalsIgnoreCase("true"));
+                } else if ("extensionPointVisible".equals(name)) {
+                    fcb.showCompartment(
+                            Model.getMetaTypes().getExtensionPoint(), 
+                            value.equalsIgnoreCase("true"));
+                }
             }
         }
     }

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java?view=diff&pathrev=17533&r1=17532&r2=17533
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java	2009-11-23 12:40:51-0800
@@ -185,5 +185,15 @@
     public Rectangle getEnumLiteralsBounds() {
         return literalsCompartment.getBounds();
     }
-    
+
+    /**
+     * USED BY PGML.tee.
+     * @return the class name and bounds together with compartment
+     * visibility.
+     */
+    @Override
+    public String classNameAndBounds() {
+        return super.classNameAndBounds()
+                + "enumerationLiteralsVisible=" + isEnumLiteralsVisible();
+    }
 } 

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/StylePanelFigClass.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/StylePanelFigClass.java?view=diff&pathrev=17533&r1=17532&r2=17533
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/StylePanelFigClass.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/StylePanelFigClass.java	2009-11-23 12:40:51-0800
@@ -118,12 +118,12 @@
 
             if (src == attrCheckBox) {
                 FigCompartmentBox fcb = (FigCompartmentBox) getPanelTarget();
-                FigCompartment fc =
-                    fcb.getCompartment(Model.getMetaTypes().getAttribute());
-                fcb.setCompartmentVisible(fc, attrCheckBox.isSelected());
+                fcb.showCompartment(Model.getMetaTypes().getAttribute(), 
+                        attrCheckBox.isSelected());
             } else if (src == operCheckBox) {
-                ((OperationsCompartmentContainer) getPanelTarget())
-                    .setOperationsVisible(operCheckBox.isSelected());
+                FigCompartmentBox fcb = (FigCompartmentBox) getPanelTarget();
+                fcb.showCompartment(Model.getMetaTypes().getOperation(),
+                        operCheckBox.isSelected());
             } else {
                 super.itemStateChanged(e);
             }

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java?view=diff&pathrev=17533&r1=17532&r2=17533
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java	2009-11-23 12:40:51-0800
@@ -201,7 +201,7 @@
         boolean enumPresent = false;
         boolean enumVisible = false;
 
-        List<Fig> figs = ce.getSelectionManager().getFigs();
+        List<Fig> figs = ce.getSelectionManager().getSelectedFigs();
         for (Fig f : figs) {
             
             final FigCompartmentBox fcb = (FigCompartmentBox) f;
@@ -310,29 +310,29 @@
             // Perform the action
             if ((cType & COMPARTMENT_ATTRIBUTE) != 0) {
                 final FigCompartmentBox fcb = (FigCompartmentBox) f;
-                final FigCompartment attributeCompartment =
-                    fcb.getCompartment(Model.getMetaTypes().getAttribute());
-		if (attributeCompartment != null) {
-		    fcb.setCompartmentVisible(attributeCompartment, display);
-		}
+                fcb.showCompartment(
+                        Model.getMetaTypes().getAttribute(),
+                        display);
+		
             }
             if ((cType & COMPARTMENT_OPERATION) != 0) {
-		if (f instanceof OperationsCompartmentContainer) {
-		    ((OperationsCompartmentContainer) f)
-                        .setOperationsVisible(display);
-		}
+                final FigCompartmentBox fcb = (FigCompartmentBox) f;
+                fcb.showCompartment(
+                        Model.getMetaTypes().getOperation(),
+                        display);
             }
 
             if ((cType & COMPARTMENT_EXTENSIONPOINT) != 0) {
-                if (f instanceof ExtensionPointsCompartmentContainer) {
-                    ((ExtensionPointsCompartmentContainer) f).setExtensionPointsVisible(display);
-                }
+                final FigCompartmentBox fcb = (FigCompartmentBox) f;
+                fcb.showCompartment(
+                        Model.getMetaTypes().getExtensionPoint(),
+                        display);
             }
             if ((cType & COMPARTMENT_ENUMLITERAL) != 0) {
-                if (f instanceof EnumLiteralsCompartmentContainer) {
-                    ((EnumLiteralsCompartmentContainer) f)
-                            .setEnumLiteralsVisible(display);
-                }
+                final FigCompartmentBox fcb = (FigCompartmentBox) f;
+                fcb.showCompartment(
+                        Model.getMetaTypes().getEnumerationLiteral(),
+                        display);
             }
 	}
     }

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java?view=diff&pathrev=17533&r1=17532&r2=17533
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java	2009-11-23 12:40:51-0800
@@ -36,6 +36,7 @@
 import org.apache.log4j.Logger;
 import org.argouml.model.AssociationChangeEvent;
 import org.argouml.model.AttributeChangeEvent;
+import org.argouml.model.Model;
 import org.argouml.ui.targetmanager.TargetManager;
 import org.argouml.uml.diagram.DiagramSettings;
 import org.argouml.uml.diagram.static_structure.ui.SelectionClass;
@@ -549,6 +550,20 @@
     }
 
     /**
+     * Show or hide a compartment based on the meta-type of its contents.
+     * 
+     * @param metaType the compartment type to be shown
+     * @param visible true if the compartment should be visible
+     */
+    public void showCompartment(Object metaType, boolean visible) {
+        FigCompartment fc =
+            getCompartment(metaType);
+        if (fc == null) return;
+        assert fc != null;
+        setCompartmentVisible(fc, visible);
+    }
+
+    /**
      * TODO: This functionality is in the worn place. We should be able to
      * call setVisible on the compartment itself and then this class should
      * react to that event.

Modified: trunk/tools/eclipse/eclipse-user-defined-dictionary
Url: http://argouml.tigris.org/source/browse/argouml/trunk/tools/eclipse/eclipse-user-defined-dictionary?view=diff&pathrev=17533&r1=17532&r2=17533
==============================================================================
--- trunk/tools/eclipse/eclipse-user-defined-dictionary	(original)
+++ trunk/tools/eclipse/eclipse-user-defined-dictionary	2009-11-23 12:40:51-0800
@@ -33,3 +33,4 @@
 programmatically
 resizable
 perimeter
+zargo

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

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.