[Uml-devel] KDE/kdesdk/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sun May 8 08:22:52 UTC 2005
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);
More information about the umbrello-devel
mailing list