svn commit: r17231 - branches/BRANCH_0_28_x: . src src/argouml-app src/argouml-app/src/org/argouml/ui src/argouml-app/src/org/argouml/uml/diagram/activity/ui src/argouml-app/src/org/argouml/uml/diagram/ui src/argouml-app/src/org/argouml/uml/ui src/argouml-app/tests/org/argouml/profile src/argouml-core-diagrams-sequence2

Linus Tolke <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: linus
Date: 2009-08-08 10:13:27-0700
New Revision: 17231

Modified:
   branches/BRANCH_0_28_x/   (props changed)
   branches/BRANCH_0_28_x/src/   (props changed)
   branches/BRANCH_0_28_x/src/argouml-app/   (props changed)
   branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/ui/ShadowComboBox.java
   branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigPool.java
   branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
   branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java
   branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/ui/UMLExpressionModel2.java
   branches/BRANCH_0_28_x/src/argouml-app/tests/org/argouml/profile/   (props changed)
   branches/BRANCH_0_28_x/src/argouml-core-diagrams-sequence2/   (props changed)

Log:
Merge from trunk:
issue 5826 (17180)
issue 5829 (17190)
issue 5830 (17191)
issue 5934 (17205).

Modified: branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/ui/ShadowComboBox.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/ui/ShadowComboBox.java?view=diff&pathrev=17231&r1=17230&r2=17231
==============================================================================
--- branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/ui/ShadowComboBox.java	(original)
+++ branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/ui/ShadowComboBox.java	2009-08-08 10:13:27-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2009 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
@@ -35,6 +35,7 @@
 
 import org.argouml.i18n.Translator;
 import org.argouml.uml.diagram.ui.FigNodeModelElement;
+import org.argouml.uml.diagram.ui.FigStereotypesGroup;
 
 /**
  * A ComboBox that contains the set of possible Shadow Width values.
@@ -43,6 +44,11 @@
  */
 public class ShadowComboBox extends JComboBox {
 
+    /**
+     * The UID.
+     */
+    private static final long serialVersionUID = 3440806802523267746L;
+    
     private static ShadowFig[]  shadowFigs;
 
     /**
@@ -69,10 +75,14 @@
      * Renders each combo box entry as a shadowed diagram figure with the
      * associated level of shadow.
      */
-    private class ShadowRenderer
-	extends JComponent
-	implements ListCellRenderer {
-
+    private class ShadowRenderer extends JComponent
+            implements ListCellRenderer {
+        
+        /**
+         * The UID.
+         */
+        private static final long serialVersionUID = 5939340501470674464L;
+        
         private ShadowFig  currentFig;
 
         /**
@@ -142,18 +152,23 @@
                 currentFig.paint(g);
             }
         }
-
-        /**
-         * The UID.
-         */
-        private static final long serialVersionUID = 5939340501470674464L;
     }
 
     /**
      * This Fig is never placed on a diagram. It is only used by the call
      * renderer so that pick list items look like diagram Figs.
+     * TODO: This Fig does not represent a model element and so it
+     * should not extend FigNodeModelElement. We should split
+     * FigNodeModelElement in two, one for base functionality for all nodes
+     * and one that is truly for model elements.
      */
     private static class ShadowFig extends FigNodeModelElement {
+
+        /**
+         * The UID.
+         */
+        private static final long serialVersionUID = 4999132551417131227L;
+
         /**
          * Constructor.
          */
@@ -180,17 +195,13 @@
             super.setShadowSizeFriend(size);
         }
         
-
         /**
-         * The UID.
+         * This isn't really a Fig representing a model element so
+         * there is always no stereotype.
+         * @return null
          */
-        private static final long serialVersionUID = 4999132551417131227L;
-
-
+        protected FigStereotypesGroup createStereotypeFig() {
+            return null;
+        }
     }
-
-    /**
-     * The UID.
-     */
-    private static final long serialVersionUID = 3440806802523267746L;
 }

Modified: branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigPool.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigPool.java?view=diff&pathrev=17231&r1=17230&r2=17231
==============================================================================
--- branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigPool.java	(original)
+++ branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/activity/ui/FigPool.java	2009-08-08 10:13:27-0700
@@ -88,12 +88,12 @@
 
 
     /**
-     * Get the Fig containing the stereotype(s). As there is no stereotype
+     * Create the Fig containing the stereotype(s). As there is no stereotype
      * display for this Fig we return null
      *
      * @return the stereotype FigGroup
      */
-    protected FigStereotypesGroup getStereotypeFig() {
+    protected FigStereotypesGroup createStereotypeFig() {
         return null;
     }
 

Modified: branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&pathrev=17231&r1=17230&r2=17231
==============================================================================
--- branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java	(original)
+++ branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java	2009-08-08 10:13:27-0700
@@ -416,6 +416,7 @@
         bigPort = new FigRect(X0, Y0, 0, 0, DEBUG_COLOR, DEBUG_COLOR);
         nameFig = new FigNameWithAbstractAndBold(element, 
                 new Rectangle(X0, Y0, WIDTH, NAME_FIG_HEIGHT), getSettings(), true);
+        stereotypeFig = createStereotypeFig();
         constructFigs();
         
         // TODO: For a FigPool the element will be null.
@@ -462,6 +463,13 @@
         readyToEdit = true;
     }
     
+    protected FigStereotypesGroup createStereotypeFig() {
+        return new FigStereotypesGroup(getOwner(), 
+                new Rectangle(X0, Y0, WIDTH, STEREOHEIGHT), settings);
+    }
+
+    
+    
     /**
      * This is the final call at creation time of the Fig, i.e. here
      * it is put on a Diagram.
@@ -1982,10 +1990,6 @@
      * @return the stereotype FigGroup
      */
     protected FigStereotypesGroup getStereotypeFig() {
-        if (stereotypeFig == null) {
-            stereotypeFig = new FigStereotypesGroup(getOwner(), 
-                    new Rectangle(X0, Y0, WIDTH, STEREOHEIGHT), settings);
-        }
         return stereotypeFig;
     }
 
@@ -2344,18 +2348,17 @@
         Object modelElement = getOwner();
 
         if (modelElement != null) {
-            Collection stereos = Model.getFacade().getStereotypes(modelElement);
+            int stereotypeCount = getStereotypeCount();
 
             if (getStereotypeView() 
                     == DiagramAppearance.STEREOTYPE_VIEW_BIG_ICON
-                    && (stereos == null 
-                            || stereos.size() != 1 
-                            ||  (stereos.size() == 1 
+                    && (stereotypeCount != 1 
+                            ||  (stereotypeCount == 1 
                                     // TODO: Find a way to replace 
                                     // this dependency on Project
                                     && getProject().getProfileConfiguration()
                                     .getFigNodeStrategy().getIconForStereotype(
-                                            stereos.iterator().next()) 
+                                            getStereotypeFig().getStereotypeFigs().iterator().next().getOwner()) 
                                             == null))) {
                 practicalView = DiagramAppearance.STEREOTYPE_VIEW_TEXTUAL;
             }
@@ -2364,6 +2367,17 @@
     }
     
     /**
+     * Get the number of stereotypes contained in this FigNode
+     * @return the number of stereotypes contained in the FigNode
+     */
+    public int getStereotypeCount() {
+        if (getStereotypeFig() == null) {
+            return 0;
+        }
+        return getStereotypeFig().getStereotypeCount();
+    }
+    
+    /**
      * Sets the stereotype view.
      * 
      * @param s the stereotype view to be set

Modified: branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java?view=diff&pathrev=17231&r1=17230&r2=17231
==============================================================================
--- branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java	(original)
+++ branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java	2009-08-08 10:13:27-0700
@@ -255,7 +255,7 @@
      * Get all the child figs that represent the individual stereotypes
      * @return a List of the stereotype Figs
      */
-    private List<FigStereotype> getStereotypeFigs() {
+    List<FigStereotype> getStereotypeFigs() {
         final List<FigStereotype> stereotypeFigs =
             new ArrayList<FigStereotype>();
         for (Object f : getFigs()) {
@@ -349,6 +349,14 @@
 
     }
     
+    /**
+     * Get the number of stereotypes contained in this group
+     * @return the number of stereotypes in this group
+     */
+    public int getStereotypeCount() {
+        return stereotypeCount;
+    }
+    
     private Rectangle getBoundsForNextStereotype() {
         return new Rectangle(
                 bigPort.getX() + 1,

Modified: branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/ui/UMLExpressionModel2.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/ui/UMLExpressionModel2.java?view=diff&pathrev=17231&r1=17230&r2=17231
==============================================================================
--- branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/ui/UMLExpressionModel2.java	(original)
+++ branches/BRANCH_0_28_x/src/argouml-app/src/org/argouml/uml/ui/UMLExpressionModel2.java	2009-08-08 10:13:27-0700
@@ -169,12 +169,17 @@
     private void setExpression(String lang, String body) {
         // Expressions are DataTypes, not independent model elements
         // be careful not to reuse them
+        Object oldExpression = null;
         if (mustRefresh || expression == null) {
+            oldExpression = expression;
             expression = newExpression();
         }
         expression = Model.getDataTypesHelper().setLanguage(expression, lang);
         expression = Model.getDataTypesHelper().setBody(expression, body);
         setExpression(expression);
+        if (oldExpression != null) {
+            Model.getUmlFactory().delete(oldExpression);
+        }
     }
 
     /**

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

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.