svn commit: r13385 - branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml: . diagram/ui profile

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2007-08-17 14:43:30-0700
New Revision: 13385

Modified:
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/StereotypeUtility.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigProfileIcon.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/FigNodeStrategy.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ModelUtils.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ProfileManagerImpl.java

Log:
improving tests

solving bugs

improving documentation

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/StereotypeUtility.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/StereotypeUtility.java?view=diff&rev=13385&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/StereotypeUtility.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/StereotypeUtility.java&r1=13384&r2=13385
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/StereotypeUtility.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/StereotypeUtility.java	2007-08-17 14:43:30-0700
@@ -115,16 +115,18 @@
         // adds all stereotypes defined at the profiles applied to the
         // current namespace
         Object namespace = Model.getFacade().getNamespace(modelElement);
-        while(true) {
-            getApplicableStereotypesInNamespace(modelElement, paths,
-                    availableStereotypes, namespace);
-            Object newNamespace = Model.getFacade().getNamespace(namespace);
-            
-            if (newNamespace == null) {
-                break;
+        if (namespace != null) {
+            while (true) {
+                getApplicableStereotypesInNamespace(modelElement, paths,
+                        availableStereotypes, namespace);
+                Object newNamespace = Model.getFacade().getNamespace(namespace);
+
+                if (newNamespace == null) {
+                    break;
+                }
+
+                namespace = newNamespace;
             }
-            
-            namespace = newNamespace;
         }
         
         // adds all stereotypes defined at the profiles applied 

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&rev=13385&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&r1=13384&r2=13385
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java	2007-08-17 14:43:30-0700
@@ -1649,6 +1649,8 @@
 		    originalNameFig = this.getNameFig();
 		    this.setNameFig(stereotypeFigProfileIcon.getLabelFig());
 
+		    stereotypeFigProfileIcon.getLabelFig().addPropertyChangeListener(this);
+		    
 		    getBigPort().
 		    	setBounds(stereotypeFigProfileIcon.getBounds());
 		 
@@ -2097,7 +2099,11 @@
             Collection stereos = Model.getFacade().getStereotypes(modelElement);
 
             if (getStereotypeView() == STEREOTYPE_VIEW_BIG_ICON
-                    && (stereos == null || stereos.size() != 1)) {
+                    && (stereos == null || stereos.size() != 1 ||
+                            (stereos
+                            .size() == 1 && getProject()
+                            .getProfileConfiguration().getFigNodeStrategy()
+                            .getIconForStereotype(stereos.iterator().next()) == null))) {
                 practicalView = STEREOTYPE_VIEW_TEXTUAL;
             }
             return practicalView;

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigProfileIcon.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigProfileIcon.java?view=diff&rev=13385&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigProfileIcon.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigProfileIcon.java&r1=13384&r2=13385
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigProfileIcon.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigProfileIcon.java	2007-08-17 14:43:30-0700
@@ -25,6 +25,7 @@
 package org.argouml.uml.diagram.ui;

 

 import java.awt.Image;

+import java.beans.PropertyChangeEvent;

 

 import org.tigris.gef.presentation.FigImage;

 import org.tigris.gef.presentation.FigNode;

@@ -41,7 +42,7 @@
     private FigImage image = null;

     

     private FigText  label = null;

-

+    

     private static final int GAP = 2;

 

     /**

@@ -55,7 +56,7 @@
 	label = new FigSingleLineText(0, image.getHeight() + GAP, 0, 0, true);

 	label.setText(str);

 	label.calcBounds();

-

+	

 	addFig(image);

 	addFig(label);

 

@@ -103,7 +104,5 @@
         this.label.setText(txt);

 	this.label.calcBounds();

 	this.calcBounds();

-    }

-    

-    

+    }       

 }


Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/FigNodeStrategy.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/FigNodeStrategy.java?view=diff&rev=13385&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/FigNodeStrategy.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/FigNodeStrategy.java&r1=13384&r2=13385
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/FigNodeStrategy.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/FigNodeStrategy.java	2007-08-17 14:43:30-0700
@@ -39,7 +39,7 @@
      * having this stereotype  

      * 

      * @param stereotype the stereotype model element

-     * @return the icon

+     * @return the icon or <code>null</code> if the stereotype has no icon 

      */

     Image getIconForStereotype(Object stereotype);

     


Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ModelUtils.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ModelUtils.java?view=diff&rev=13385&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ModelUtils.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ModelUtils.java&r1=13384&r2=13385
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ModelUtils.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ModelUtils.java	2007-08-17 14:43:30-0700
@@ -28,7 +28,19 @@
 

 import org.argouml.model.Model;

 

+/**

+ * Contains helper methods

+ *

+ * @author maurelio1234

+ */

 public class ModelUtils {

+    /**

+     * Finds a type in a model by name

+     * 

+     * @param s the type name

+     * @param model the model

+     * @return the type or <code>null</code> if the type has not been found.

+     */

     public static Object findTypeInModel(String s, Object model) {

 

         if (!Model.getFacade().isANamespace(model)) {


Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ProfileManagerImpl.java?view=diff&rev=13385&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ProfileManagerImpl.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ProfileManagerImpl.java&r1=13384&r2=13385
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ProfileManagerImpl.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/profile/ProfileManagerImpl.java	2007-08-17 14:43:30-0700
@@ -178,11 +178,15 @@
      * @param p the profile

      * @see org.argouml.uml.profile.ProfileManager#registerProfile(org.argouml.uml.profile.Profile)

      */

-    public void registerProfile(Profile p) {

-        if (!profiles.contains(p)) {

+    public void registerProfile(Profile p) {        

+        if (p != null && !profiles.contains(p)) {

             if (p instanceof UserDefinedProfile

                     || getProfileForClass(p.getClass().getName()) == null) {

                 profiles.add(p);

+                

+                // this profile could have not been loaded when the default profile configuration 

+                // was loaded at first, so we need to do it again

+                loadDefaultProfilesfromConfiguration();

             }

         }

     }

@@ -192,8 +196,10 @@
      * @see org.argouml.uml.profile.ProfileManager#removeProfile(org.argouml.uml.profile.Profile)

      */

     public void removeProfile(Profile p) {

-        profiles.remove(p);

-        defaultProfiles.remove(p);

+        if (p != null) {

+            profiles.remove(p);

+            defaultProfiles.remove(p);

+        }

     }

 

     /**

@@ -247,7 +253,7 @@
     }

 

     public void addSearchPathDirectory(String path) {

-        if (!searchDirectories.contains(path)) {

+        if (path != null && !searchDirectories.contains(path)) {

             searchDirectories.add(path);

             updateSearchDirectoriesConfiguration();

         }
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.