svn commit: r12862 - branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2007-06-17 04:48:33-0700
New Revision: 12862

Modified:
   branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java

Log:
supporting streotypes which have icons becoming hidden

Modified: branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java?view=diff&rev=12862&p1=branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java&p2=branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java&r1=12861&r2=12862
==============================================================================
--- branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java	(original)
+++ branches/gsoc2007/maurelio1234/argouml/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java	2007-06-17 04:48:33-0700
@@ -28,8 +28,10 @@
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Vector;
 
 import org.apache.log4j.Logger;
+import org.argouml.kernel.ProjectManager;
 import org.argouml.model.AddAssociationEvent;
 import org.argouml.model.Model;
 import org.argouml.model.RemoveAssociationEvent;
@@ -75,6 +77,8 @@
 
     private int stereotypeCount = 0;
     
+    private boolean hidingStereotypesWithIcon = false;
+    
     /**
      * The constructor.
      *
@@ -250,12 +254,31 @@
                     removeFig((Fig) figs.get(i));
                 }
             }
+            
+            // remove all stereotypes that have a graphical icon
+            updateHiddenStereotypes();
         }
     }
 
+    private void updateHiddenStereotypes() {
+	List figs = getFigs();
+
+	for (int i = 0; i < figs.size(); ++i) {
+	    Fig f = (Fig) figs.get(i);
+	    if (f instanceof FigStereotype) {
+		FigStereotype fs = (FigStereotype) f;
+		fs.setVisible(ProjectManager.getManager().getCurrentProject()
+			.getProfileConfiguration().getFigNodeStrategy()
+			.getIconForStereotype(fs.getOwner()) == null
+			|| !isHidingStereotypesWithIcon());
+	    }
+	}
+    }
+
     /*
-     * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
-     */
+         * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int,
+         *      int)
+         */
     protected void setBoundsImpl(int x, int y, int w, int h) {
         Fig fig;
         int yy = y;
@@ -285,4 +308,13 @@
 
     protected void createModelElement() {
     }
+
+    public boolean isHidingStereotypesWithIcon() {
+        return hidingStereotypesWithIcon;
+    }
+
+    public void setHidingStereotypesWithIcon(boolean hidingStereotypesWithIcon) {
+        this.hidingStereotypesWithIcon = hidingStereotypesWithIcon;
+        updateHiddenStereotypes();
+    }
 }
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.