[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Mon Mar 22 07:28:17 UTC 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.125
--- kdesdk/umbrello/umbrello/umlview.cpp #1.124:1.125
@@ -2474,7 +2474,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
@@ -2482,5 +2491,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;
@@ -2488,5 +2497,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());
@@ -2497,4 +2509,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