[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
Oliver.Kellogg at t-online.de
Sat Sep 13 06:05:01 UTC 2003
CVS commit by okellogg:
Support for creation of pure widget associations in the constructor.
Minor cosmetics.
M +26 -23 associationwidget.cpp 1.35
--- kdesdk/umbrello/umbrello/associationwidget.cpp #1.34:1.35
@@ -48,9 +48,12 @@ AssociationWidget::AssociationWidget(QWi
UMLDoc *umldoc = m_pView->getDocument();
- // set up UMLAssociation obj
- m_pAssociation = new UMLAssociation( umldoc, Type, WidgetA->getUMLObject(), WidgetB->getUMLObject() );
- umldoc->addAssociation( m_pAssociation );
+ // set up UMLAssociation obj if both roles are UML objects
+ UMLObject* umlRoleA = WidgetA->getUMLObject();
+ UMLObject* umlRoleB = WidgetB->getUMLObject();
+ if (umlRoleA != NULL && umlRoleB != NULL) {
+ m_pAssociation = umldoc->createUMLAssociation( umlRoleA, umlRoleB, Type);
connect(m_pAssociation, SIGNAL(modified()), this,
SLOT(mergeUMLRepresentationIntoAssociationData()));
+ }
setAssocType(Type);
@@ -769,5 +772,5 @@ bool AssociationWidget::activate() {
}
- if( m_pMultiB != NULL && AssocRules::allowMultiplicity( type, getWidgetA() -> getBaseType() ) ) {
+ if( m_pMultiB != NULL && AssocRules::allowMultiplicity( type, getWidgetB() -> getBaseType() ) ) {
m_pMultiB->setAssoc(this);
m_pMultiB->setRole( tr_MultiB );
@@ -1838,7 +1840,7 @@ QPoint AssociationWidget::calculatePoint
---------------
- sol_2 = -B - --- / 2
+ -B - --- / 2
\/ B - 4*A*C
- --------------------------------
+ sol_2 = --------------------------------
2*A
@@ -2442,5 +2443,5 @@ void AssociationWidget::mouseReleaseEven
menuType = ListPopupMenu::mt_Collaboration_Message;
}
- }//end else
+ }
m_pMenu = new ListPopupMenu(m_pView, menuType);
m_pMenu->popup(me -> globalPos());
@@ -3282,5 +3281,7 @@ bool AssociationWidget::loadFromXMI( QDo
kdError() << "AssociationWidget::loadFromXMI(): "
<< "cannot find widget for roleA id " << aId << endl;
- return false;
+ /* Just returning false here is a little harsh when the rest of the diagram
+ might load okay. As a compromise, let's be tolerant if the ID is -1. */
+ return (aId == -1);
}
UMLWidget *pWidgetB = m_pView->findWidget( bId );
@@ -3288,5 +3289,7 @@ bool AssociationWidget::loadFromXMI( QDo
kdError() << "AssociationWidget::loadFromXMI(): "
<< "cannot find widget for roleB id " << bId << endl;
- return false;
+ /* Just returning false here is a little harsh when the rest of the diagram
+ might load okay. As a compromise, let's be tolerant if the ID is -1. */
+ return (bId == -1);
}
setWidgetA(pWidgetA);
More information about the umbrello-devel
mailing list