Version: 1.2.90 (using KDE 3.2.2, compiled sources) Compiler: gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) OS: Linux (i686) release 2.4.20-6 CVS Head as of 06/22/04 When editing a collaboration diagram I can't generate more then one "message" (f(x)) from a class to any other class. There are times when one class may send several different messages to another class. While I can create more then one instance of the second class and send one message to each, that seems confusing to me in that it seems to imply that you have multiple instances in the program of each class. When in fact there are only one instance of each class talking back and forth.
This isn't one of the rules in assocwidget, it causes an error message: umbrello: UMLView::addWidget: Not adding (id=120/type=312/name=new_class_1) because it's already there umbrello: ERROR: cannot addAssocInViewAndDoc(), deleting
the bug is also present in version 1.3.0 with kde 3.3. How about having a link option instead of a message one? The link would be a simple line and multiples messages (in both directions) would be properties of this link, each message represented be an arrow.
CVS commit by okellogg: Permit more than one message from one collaborating object to another. BUG:83834 M +14 -8 associationwidget.cpp 1.140 M +5 -0 umlview.cpp 1.207 M +10 -0 umlview.h 1.72 --- kdesdk/umbrello/umbrello/associationwidget.cpp #1.139:1.140 @@ -106,16 +106,18 @@ AssociationWidget::AssociationWidget(UML mergeAssociationDataIntoUMLRepresentation(); - //collaboration messages need a name label because it's that - //which handles the right click menu options + // Collaboration messages need a name label because it's that + // which lets operator== distinguish them, which in turn + // permits us to have more than one message between two objects. if (getAssocType() == at_Coll_Message) { // Create a temporary name to bring on setName() - ObjectWidget *ow = static_cast<ObjectWidget*>(m_role[B].m_pWidget); - QString localIdStr = ID2STR(ow->getLocalID()); - setName("m" + localIdStr); - if (m_pObject) + int collabID = m_pView->generateCollaborationId(); + setName("m" + QString::number(collabID)); + if (m_pObject) { m_pName->setUMLObject( m_pObject ); - else + } else { + ObjectWidget *ow = static_cast<ObjectWidget*>(m_role[B].m_pWidget); m_pName->setUMLObject( ow->getUMLObject() ); } + } } @@ -216,5 +218,9 @@ bool AssociationWidget::operator==(Assoc } - return true; + // Two objects in a collaboration can have multiple messages between each other. + // Here we depend on the messages having names, and the names must be different. + // That is the reason why collaboration messages have strange initial names like + // "m29997" or similar. + return (getName() == Other.getName()); } --- kdesdk/umbrello/umbrello/umlview.cpp #1.206:1.207 @@ -130,4 +130,5 @@ void UMLView::init() { m_nCanvasWidth = UMLView::defaultCanvasSize; m_nCanvasHeight = UMLView::defaultCanvasSize; + m_nCollaborationId = 0; // Initialize other data @@ -221,4 +222,8 @@ void UMLView::setName(const QString &nam } +int UMLView::generateCollaborationId() { + return ++m_nCollaborationId; +} + void UMLView::print(KPrinter *pPrinter, QPainter & pPainter) { int height, width; --- kdesdk/umbrello/umbrello/umlview.h #1.71:1.72 @@ -948,4 +948,9 @@ public: } + /** + * Used for creating unique name of collaboration messages. + */ + int generateCollaborationId(); + protected: @@ -1148,4 +1153,9 @@ protected: void forceUpdateWidgetFontMetrics(QPainter *painter); + /** + * Used for creating unique name of collaboration messages. + */ + int m_nCollaborationId; + QPoint m_Pos, m_LineToPos; bool m_bCreateObject, m_bDrawRect, m_bDrawSelectedOnly, m_bPaste;