[Uml-devel] KDE_3_2_BRANCH: kdesdk/umbrello/umbrello

Jonathan Riddell jri at jriddell.org
Sat Mar 27 12:55:02 UTC 2004


CVS commit by jriddell: 

Backport fix from Mon Mar 22 15:21:37 2004
--
CVS commit by okellogg:

createAutoAssociations: Fix problems with the association direction
 being inverted (see bugs.kde.org #78192.)


  M +17 -3     umlview.cpp   1.119.2.3


--- kdesdk/umbrello/umbrello/umlview.cpp  #1.119.2.2:1.119.2.3
@@ -2469,7 +2469,16 @@ void UMLView::createAutoAssociations( UM
                         continue;
                 // Both objects are represented in this view:
+                // Assign widget roles as indicated by the UMLAssociation.
+                UMLWidget *widgetA, *widgetB;
+                if (myID == roleAObj->getID()) {
+                        widgetA = widget;
+                        widgetB = pOtherWidget;
+                } else {
+                        widgetA = pOtherWidget;
+                        widgetB = widget;
+                }
                 // Check that the assocwidget does not already exist.
                 Uml::Association_Type assocType = assoc->getAssocType();
-                AssociationWidget * temp = findAssocWidget(assocType, widget, pOtherWidget);
+                AssociationWidget * temp = findAssocWidget(assocType, widgetA, widgetB);
                 if (temp) {
                         temp->calculateEndingPoints();  // recompute assoc lines
@@ -2477,5 +2486,5 @@ void UMLView::createAutoAssociations( UM
                 }
                 // Check that the assoc is allowed.
-                if (!AssocRules::allowAssociation(assocType, widget, pOtherWidget, false)) {
+                if (!AssocRules::allowAssociation(assocType, widgetA, widgetB, false)) {
                         kdDebug() << "createAutoAssociations: not transferring assoc "
                                   << "of type " << assocType << endl;
@@ -2483,5 +2492,8 @@ void UMLView::createAutoAssociations( UM
                 }
                 // Create the AssociationWidget.
-                temp = new AssociationWidget( this, widget, assocType, pOtherWidget );
+                temp = new AssociationWidget( this );
+                temp->setWidgetA(widgetA);
+                temp->setWidgetB(widgetB);
+                temp->setAssocType(assocType);
                 temp->setVisibilityA(assoc->getVisibilityA());
                 temp->setVisibilityB(assoc->getVisibilityB());
@@ -2492,4 +2504,6 @@ void UMLView::createAutoAssociations( UM
                 temp->setRoleNameA(assoc->getRoleNameA());
                 temp->setRoleNameB(assoc->getRoleNameB());
+                temp->calculateEndingPoints();
+                temp->setActivated(true);
                 if (! addAssociation(temp))
                         delete temp;






More information about the umbrello-devel mailing list