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

Luis Sergio Oliveira <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: euluis
Date: 2009-10-31 03:11:05-0700
New Revision: 17438

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

Log:
Issue 5864: patch by Diego (diegonc) to enable Big Icon and a fix by to a bug that was in FigNodeModelElement.getPracticalView

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=17438&r1=17437&r2=17438
==============================================================================
--- 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-10-31 03:11:05-0700
@@ -80,6 +80,7 @@
 import org.argouml.notation.NotationProvider;
 import org.argouml.notation.NotationProviderFactory2;
 import org.argouml.notation.NotationSettings;
+import org.argouml.profile.FigNodeStrategy;
 import org.argouml.ui.ArgoJMenu;
 import org.argouml.ui.Clarifier;
 import org.argouml.ui.ProjectActions;
@@ -1785,8 +1786,8 @@
             }
 
             if (replaceIcon != null) {
-                stereotypeFigProfileIcon = new FigProfileIcon(replaceIcon,
-                        getName());
+                stereotypeFigProfileIcon = new FigProfileIcon(settings,
+                        replaceIcon, getName());
                 stereotypeFigProfileIcon.setOwner(getOwner());
 
                 stereotypeFigProfileIcon.setLocation(getBigPort()
@@ -2265,17 +2266,23 @@
         if (modelElement != null) {
             int stereotypeCount = getStereotypeCount();
 
-            if (getStereotypeView() 
-                    == DiagramAppearance.STEREOTYPE_VIEW_BIG_ICON
-                    && (stereotypeCount != 1 
-                            ||  (stereotypeCount == 1 
-                                    // TODO: Find a way to replace 
-                                    // this dependency on Project
-                                    && getProject().getProfileConfiguration()
-                                    .getFigNodeStrategy().getIconForStereotype(
-                                            getStereotypeFig().getStereotypeFigs().iterator().next().getOwner()) 
-                                            == null))) {
+            if (getStereotypeView()
+                    == DiagramAppearance.STEREOTYPE_VIEW_BIG_ICON) {
+                // TODO: Find a way to replace this dependency on Project
+                FigNodeStrategy figNodeStrategy = getProject()
+                    .getProfileConfiguration().getFigNodeStrategy();
+                Iterator<FigStereotype> figsIterator = getStereotypeFig()
+                    .getStereotypeFigs().iterator();
+                Object owner = figsIterator.hasNext() ?
+                        figsIterator.next().getOwner() : null;
+                if (stereotypeCount != 1
+                        || figNodeStrategy == null
+                        || owner == null
+                        ||  (stereotypeCount == 1
+                                && figNodeStrategy.getIconForStereotype(owner) 
+                                    == null)) {
                 practicalView = DiagramAppearance.STEREOTYPE_VIEW_TEXTUAL;
+                }
             }
         }
         return practicalView;

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigProfileIcon.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigProfileIcon.java?view=diff&pathrev=17438&r1=17437&r2=17438
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigProfileIcon.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigProfileIcon.java	2009-10-31 03:11:05-0700
@@ -27,6 +27,7 @@
 import java.awt.Image;
 import java.awt.Rectangle;
 
+import org.argouml.uml.diagram.DiagramSettings;
 import org.tigris.gef.presentation.FigImage;
 import org.tigris.gef.presentation.FigNode;
 import org.tigris.gef.presentation.FigText;
@@ -48,14 +49,14 @@
     /**
      * Default constructor.
      * 
+     * @param settings diagram settings
      * @param icon the icon
      * @param str the default name
-     * TODO: Define a constructor that takes diagram settings
      */
-    public FigProfileIcon(Image icon, String str) {
+    public FigProfileIcon(DiagramSettings settings, Image icon, String str) {
 	image = new FigImage(0, 0, icon);
 	Rectangle bounds = new Rectangle(0, image.getHeight() + GAP, 0, 0);
-	label = new FigSingleLineText(bounds, null, true);
+	label = new FigSingleLineText(bounds, settings, true);
 	label.setText(str);
 	label.calcBounds();

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

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.