[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Tue Aug 17 23:30:06 UTC 2004
CVS commit by okellogg:
Add load/save for the new AssocWidget-from-UMLAttribute feature.
M +17 -5 associationwidget.cpp 1.114
M +10 -1 associationwidget.h 1.45
M +2 -0 umlview.cpp 1.168
--- kdesdk/umbrello/umbrello/associationwidget.cpp #1.113:1.114
@@ -18,4 +18,5 @@
#include "umlrole.h"
#include "listpopupmenu.h"
+#include "attribute.h"
#include "association.h"
#include "associationwidget.h"
@@ -208,4 +209,10 @@ UMLAssociation * AssociationWidget::getA
}
+UMLAttribute * AssociationWidget::getAttribute () {
+ if (m_pObject == NULL || m_pObject->getBaseType() != ot_Attribute)
+ return NULL;
+ return static_cast<UMLAttribute*>(m_pObject);
+}
+
FloatingText* AssociationWidget::getMultiWidget(Role_Type role) {
return m_role[role].m_pMulti;
@@ -2828,5 +2835,6 @@ void AssociationWidget::saveToXMI( QDomD
if (m_pObject) {
assocElement.setAttribute( "xmi.id", m_pObject->getID() );
- } else {
+ }
+ if (getAssociation() == NULL) {
assocElement.setAttribute( "type", m_AssocType );
assocElement.setAttribute( "visibilityA", m_role[A].m_Visibility);
@@ -2834,8 +2842,10 @@ void AssociationWidget::saveToXMI( QDomD
assocElement.setAttribute( "changeabilityA", m_role[A].m_Changeability);
assocElement.setAttribute( "changeabilityB", m_role[B].m_Changeability);
+ if (m_pObject == NULL) {
assocElement.setAttribute( "roleAdoc", m_role[A].m_RoleDoc);
assocElement.setAttribute( "roleBdoc", m_role[B].m_RoleDoc);
assocElement.setAttribute( "documentation", m_Doc );
}
+ }
assocElement.setAttribute( "widgetaid", getWidgetID(A) );
assocElement.setAttribute( "widgetbid", getWidgetID(B) );
@@ -2989,4 +2998,7 @@ bool AssociationWidget::loadFromXMI( QDo
} else if (myObj->getBaseType() == ot_Attribute) {
m_pObject = myObj;
+ QString type = qElement.attribute( "type", "-1" );
+ Uml::Association_Type aType = (Uml::Association_Type) type.toInt();
+ setAssocType(aType);
} else {
UMLAssociation * myAssoc = (UMLAssociation*)myObj;
--- kdesdk/umbrello/umbrello/associationwidget.h #1.44:1.45
@@ -27,4 +27,5 @@ class QDataStream;
class UMLView;
class UMLAssociation;
+class UMLAttribute;
using namespace Uml;
@@ -426,4 +427,12 @@ public:
/**
+ * Returns the UMLAttribute representation of this object.
+ *
+ * @return Pointer to the UMLAttribute that is represented by
+ * this AsociationWidget.
+ */
+ UMLAttribute * getAttribute ();
+
+ /**
* Sets the text of the FloatingText identified by the ft's Text_Role.
* Overrides operation from LinkWidget.
--- kdesdk/umbrello/umbrello/umlview.cpp #1.167:1.168
@@ -2395,4 +2395,5 @@ void UMLView::createAutoAttributeAssocia
// create a composition AssocWidget
AssociationWidget *a = new AssociationWidget (this, widget, at_Composition, w);
+ a->setUMLObject(attr);
a->calculateEndingPoints();
a->setVisibility(attr->getScope(), B);
@@ -2425,4 +2426,5 @@ void UMLView::createAutoAttributeAssocia
AssociationWidget *a = new AssociationWidget
(this, widget, at_Aggregation, w);
+ a->setUMLObject(attr);
a->calculateEndingPoints();
a->setVisibility(attr->getScope(), B);
More information about the umbrello-devel
mailing list