svn commit: r17191 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-07-26 11:29:30-0700
New Revision: 17191

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java

Log:
Remove excessive calls to Model that could take place during delete (and so possibly cause invalid object exception due to missing model element)

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&pathrev=17191&r1=17190&r2=17191
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java	2009-07-26 11:29:30-0700
@@ -2242,18 +2242,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;
             }
@@ -2262,6 +2261,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: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java?view=diff&pathrev=17191&r1=17190&r2=17191
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigStereotypesGroup.java	2009-07-26 11:29:30-0700
@@ -241,7 +241,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()) {
@@ -335,6 +335,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,

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

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.