Bug 57588 - Can't create associative classes
Summary: Can't create associative classes
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: 1.1.1
Platform: Mandrake RPMs Linux
: NOR wishlist
Target Milestone: ---
Assignee: Oliver Kellogg
URL:
Keywords:
: 95727 151661 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-04-23 00:15 UTC by Albert Astals Cid
Modified: 2012-02-14 06:29 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Astals Cid 2003-04-23 00:15:41 UTC
Version:           1.1.1 (using KDE KDE 3.1)
Installed from:    Mandrake RPMs
OS:          Linux

I haven't been able of creating associative classes using Umbrello 1.1., i don't know if it is intended or maybe you can do them but i have not found the way.

Associative classes are a must (i think)
Comment 1 Jonathan Riddell 2003-04-23 00:59:20 UTC
This would be quite difficult to do with the current association code, but not
impossible.
Comment 2 Stevan White 2003-04-25 13:22:41 UTC
That's "association class", I think.  Just so we all know what we're talking
about, see the UML standard 03-03-01, sect 3.42.2.2 "a class symbol attached to
the association path by a dashed line."; for example see sect 3.42.6.
Comment 3 Albert Astals Cid 2003-04-25 18:42:49 UTC
Well, then my fault, in Spanish we say "Clase asociativa" that translated into English is 
associative class. But i meant what you describe, so what i want is the possiblility of 
creating "association class". 
Comment 4 Ion Jaureguialzo Sarasola 2004-10-30 19:23:36 UTC
Named "Association class" or "associative class", it's an inportant element; i'm teaching uml to my students and we can't make this class of elements, wich are really common.
Comment 5 Jonathan Riddell 2004-12-23 19:58:34 UTC
*** Bug 95727 has been marked as a duplicate of this bug. ***
Comment 6 John E. Harbold 2005-05-05 04:34:21 UTC
I use the Shlaer-Mellor method and the associative class is very important item in modelling a system.  I don't know if it is hard to implement in Umbrello, owing to the fact that a dotted line has to connect to a solid association.
Comment 7 Oliver Kellogg 2005-05-07 01:59:44 UTC
SVN commit 410203 by okellogg:

Implement main functionality of association class.  Still missing: XMI I/O.
CCBUG:57588


 M  +133 -20   trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.cpp  
 M  +13 -4     trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.h  
 M  +10 -0     trunk/KDE/kdesdk/umbrello/umbrello/class.h  
 M  +60 -40    trunk/KDE/kdesdk/umbrello/umbrello/classwidget.cpp  
 M  +14 -0     trunk/KDE/kdesdk/umbrello/umbrello/classwidget.h  
 M  +7 -0      trunk/KDE/kdesdk/umbrello/umbrello/umlwidget.cpp  
Comment 8 Oliver Kellogg 2005-05-08 17:21:48 UTC
SVN commit 410943 by okellogg:

Implement XMI I/O for the association class connecting line.
NB we don't yet create the XMI standard <UML:AssociationClass>
BUG:57588


 M  +4 -3      trunk/KDE/kdesdk/umbrello/ChangeLog  
 M  +38 -8     trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.cpp  
 M  +5 -0      trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.h  


--- trunk/KDE/kdesdk/umbrello/ChangeLog #410942:410943
@@ -1,9 +1,10 @@
 Version 1.5
 
+* Association classes
 * Externalization of folders (i.e. submodel files)
 
 * Bugs fixed / wishes implemented (see http://bugs.kde.org)
-87252 
+57588 87252
 
 Version 1.4.1 (maintenance release)
 
@@ -11,8 +12,8 @@
 * Crash on deleting attributes / enum literals
 * Crash in UMLView::createAutoAttributeAssociations()
 * Bugs from http://bugs.kde.org :
-53376 57667 57875 80924 89691 95353 100290 100307 101148 103123
-103133 103728 101541
+ 53376  57667  57875  70924  80924  89691  95353 100290 100307 101148
+103123 103133 103728 101541
 
 Version 1.4
 
--- trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.cpp #410942:410943
@@ -629,8 +629,11 @@
 		}
 	}
 
-	// CHECK
-	// m_LinePath.setAssocType( getAssocType() );
+	// Prepare the association class line if needed.
+	if (m_pAssocClassWidget && !m_pAssocClassLine) {
+		createAssocClassLine();
+	}
+
 	if(status) {
 		m_bActivated = true;
 	}
@@ -2034,6 +2037,15 @@
 	}
 }
 
+void AssociationWidget::createAssocClassLine() {
+	if (m_pAssocClassLine == NULL)
+		m_pAssocClassLine = new QCanvasLine(m_pView->canvas());
+	computeAssocClassLine();
+	QPen pen(m_pView->getLineColor(), m_pView->getLineWidth(), DashLine);
+	m_pAssocClassLine->setPen(pen);
+	m_pAssocClassLine->setVisible(true);
+}
+
 void AssociationWidget::computeAssocClassLine() {
 	if (m_pAssocClassWidget == NULL || m_pAssocClassLine == NULL)
 		return;
@@ -2118,12 +2130,7 @@
 			return;
 		m_pAssocClassWidget = static_cast<ClassWidget*>(otherWidget);
 		m_pAssocClassWidget->setClassAssocWidget(this);
-		if (m_pAssocClassLine == NULL)
-			m_pAssocClassLine = new QCanvasLine(m_pView->canvas());
-		computeAssocClassLine();
-		QPen pen(m_pView->getLineColor(), m_pView->getLineWidth(), DashLine);
-		m_pAssocClassLine->setPen(pen);
-		m_pAssocClassLine->setVisible(true);
+		createAssocClassLine();
 		return;
 	}
 	// right button action:
@@ -3150,6 +3157,12 @@
 	if( m_role[B].m_pChangeWidget )
 		m_role[B].m_pChangeWidget -> saveToXMI( qDoc, assocElement );
 
+	if (m_pAssocClassWidget) {
+		QString acid = ID2STR(m_pAssocClassWidget->getID());
+		assocElement.setAttribute("assocclass", acid);
+		assocElement.setAttribute("aclsegindex", m_nLinePathSegmentIndex);
+	}
+
 	qElement.appendChild( assocElement );
 }
 
@@ -3292,6 +3305,23 @@
 	m_role[A].m_nTotalCount = totalcounta.toInt();
 	m_role[B].m_nTotalCount = totalcountb.toInt();
 
+	QString assocclassid = qElement.attribute("assocclass", "");
+	if (! assocclassid.isEmpty()) {
+		Uml::IDType acid = STR2ID(assocclassid);
+		UMLWidget *w = Umbrello::findWidget(acid, widgets);
+		if (w) {
+			m_pAssocClassWidget = static_cast<ClassWidget*>(w);
+			m_pAssocClassWidget->setClassAssocWidget(this);
+			// Preparation of the assoc class line is done in activate()
+			QString aclsegindex = qElement.attribute("aclsegindex", "0");
+			m_nLinePathSegmentIndex = aclsegindex.toInt();
+		} else {
+			kdError() << "AssociationWidget::loadFromXMI: "
+				  << "cannot find assocclass " << assocclassid
+				  << endl;
+		}
+	}
+
 	//now load child elements
 	QDomNode node = qElement.firstChild();
 	QDomElement element = node.toElement();
--- trunk/KDE/kdesdk/umbrello/umbrello/associationwidget.h #410942:410943
@@ -363,6 +363,11 @@
 	bool onAssocClassLine(const QPoint & point);
 
 	/**
+	 * Creates the association class connecting line.
+	 */
+	void createAssocClassLine();
+
+	/**
 	 * Renders the association class connecting line selected.
 	 */
 	void selectAssocClassLine(bool sel = true);
Comment 9 Oliver Kellogg 2012-02-14 06:29:03 UTC
*** Bug 151661 has been marked as a duplicate of this bug. ***