Summary: | Can't create more then one "message" from class A to class B in collaboration diagram | ||
---|---|---|---|
Product: | [Applications] umbrello | Reporter: | Anthony Parent <tonyp> |
Component: | general | Assignee: | Umbrello Development Group <umbrello-devel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Anthony Parent
2004-06-22 23:35:55 UTC
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; |