Bug 100290

Summary: Only the first attribute of the many with the same type is displayed in the class diagram
Product: [Applications] umbrello Reporter: David <emc_deux>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 1.3.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description David 2005-02-26 02:49:50 UTC
Version:           1.3.2 (using KDE 3.3.2, compiled sources)
Compiler:          gcc version 3.4.3
OS:                Linux (i686) release 2.6.8-24-default

If you import C++ classes with the following definition

class FirstClass {
}


class SecondCLass {
  FirstClass a;
  FirstClass b;
  FirstCLass c;
}

You see only in the class diagram the composition with the "a" attribute for SecondClass. The view code show all 3 attributes.
Comment 1 Oliver Kellogg 2005-02-26 12:25:55 UTC
CVS commit by okellogg: 

createAutoAttributeAssociations(): Consider attribute name (corresponds
 to association role B name) when deciding whether a given association widget
 between two given classes already exists.
BUG:100290 


  M +3 -1      umlview.cpp   1.208


--- kdesdk/umbrello/umbrello/umlview.cpp  #1.207:1.208
@@ -2499,8 +2499,10 @@ void UMLView::createAutoAttributeAssocia
                 Uml::Association_Type assocType = Uml::at_Composition;
                 UMLWidget *w = findWidget( attrType->getID() );
+                AssociationWidget *aw = NULL;
                 // if the attribute type has a widget representation on this view
                 if (w &&
                     // if the AssocWidget does not already exist then
-                    findAssocWidget(assocType, widget, w) == NULL &&
+                    ((aw = findAssocWidget(assocType, widget, w)) == NULL ||
+                      aw->getRoleName(Uml::B) != attr->getName()) &&
                     // if the current diagram type permits compositions
                     AssocRules::allowAssociation(assocType, widget, w, false)) {