[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Wed Jun 27 04:40:14 UTC 2007
SVN commit 680734 by okellogg:
AssociationWidget constructor: Change the UMLAssociation* umlassoc arg to UMLObject*.
M +28 -13 associationwidget.cpp
M +6 -6 associationwidget.h
M +2 -4 umlview.cpp
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.cpp #680733:680734
@@ -59,13 +59,13 @@
// the preferred constructor
AssociationWidget::AssociationWidget(UMLView *view, UMLWidget* pWidgetA,
Association_Type assocType, UMLWidget* pWidgetB,
- UMLAssociation *umlassoc /* = NULL */)
+ UMLObject *umlobject /* = NULL */)
: WidgetBase(view)
{
init(view);
- if (umlassoc)
- setUMLAssociation(umlassoc);
- else
+ if (umlobject) {
+ setUMLObject(umlobject);
+ } else {
// set up UMLAssociation obj if assoc is represented and both roles are UML objects
if (UMLAssociation::assocTypeHasUMLRepresentation(assocType)) {
UMLObject* umlRoleA = pWidgetA->getUMLObject();
@@ -96,6 +96,7 @@
setUMLAssociation(myAssoc);
}
}
+ }
setWidget(pWidgetA, A);
setWidget(pWidgetB, B);
@@ -3104,15 +3105,29 @@
WidgetBase::setUMLObject(obj);
if (obj == NULL)
return;
- Uml::Object_Type ot = obj->getBaseType();
- if (ot == Uml::ot_Attribute) {
- UMLClassifier *klass = static_cast<UMLClassifier*>(obj->parent());
- connect(klass, SIGNAL(attributeRemoved(UMLClassifierListItem*)),
- this, SLOT(slotAttributeRemoved(UMLClassifierListItem*)));
- } else if (ot == Uml::ot_EntityAttribute) {
- UMLEntity *ent = static_cast<UMLEntity*>(obj->parent());
- connect(ent, SIGNAL(entityAttributeRemoved(UMLClassifierListItem*)),
- this, SLOT(slotAttributeRemoved(UMLClassifierListItem*)));
+ UMLClassifier *klass = NULL;
+ UMLEntity *ent = NULL;
+ const Uml::Object_Type ot = obj->getBaseType();
+ switch (ot) {
+ case Uml::ot_Association:
+ setUMLAssociation(dynamic_cast<UMLAssociation*>(obj));
+ break;
+ case Uml::ot_Operation:
+ setOperation(dynamic_cast<UMLOperation *>(obj));
+ break;
+ case Uml::ot_Attribute:
+ klass = static_cast<UMLClassifier*>(obj->parent());
+ connect(klass, SIGNAL(attributeRemoved(UMLClassifierListItem*)),
+ this, SLOT(slotAttributeRemoved(UMLClassifierListItem*)));
+ break;
+ case Uml::ot_EntityAttribute:
+ ent = static_cast<UMLEntity*>(obj->parent());
+ connect(ent, SIGNAL(entityAttributeRemoved(UMLClassifierListItem*)),
+ this, SLOT(slotAttributeRemoved(UMLClassifierListItem*)));
+ break;
+ default:
+ kError() << "UMLAssociation constructor: cannot associate UMLObject of type "
+ << ot << endl;
}
}
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.h #680733:680734
@@ -75,15 +75,15 @@
/**
* Constructor.
*
- * @param view The parent view of this widget.
- * @param WidgetA Pointer the role A widget for the association.
- * @param Type The Association_Type for this association.
- * @param WidgetB Pointer the role B widget for the association.
- * @param umlassoc Pointer the underlying UMLAssociation (if applicable.)
+ * @param view The parent view of this widget.
+ * @param WidgetA Pointer to the role A widget for the association.
+ * @param Type The Association_Type for this association.
+ * @param WidgetB Pointer to the role B widget for the association.
+ * @param umlobject Pointer to the underlying UMLObject (if applicable.)
*/
AssociationWidget(UMLView *view, UMLWidget* WidgetA,
Uml::Association_Type Type, UMLWidget* WidgetB,
- UMLAssociation *umlassoc = NULL);
+ UMLObject *umlobject = NULL);
/**
* Deconstructor.
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlview.cpp #680733:680734
@@ -2180,8 +2180,7 @@
// stereotyped <<CORBAInterface>>, create a UniAssociation widget.
if (type->getStereotype() == "CORBAInterface")
assocType = at_UniAssociation;
- AssociationWidget *a = new AssociationWidget (this, widget, assocType, w);
- a->setUMLObject(attr);
+ AssociationWidget *a = new AssociationWidget (this, widget, assocType, w, attr);
a->calculateEndingPoints();
a->setVisibility(attr->getVisibility(), B);
/*
@@ -2211,8 +2210,7 @@
// create an aggregation AssocWidget from the ClassifierWidget
// to the widget of the referenced type
AssociationWidget *a = new AssociationWidget
- (this, widget, at_Aggregation, w);
- a->setUMLObject(attr);
+ (this, widget, at_Aggregation, w, attr);
a->calculateEndingPoints();
a->setVisibility(attr->getVisibility(), B);
//a->setChangeability(true, B);
More information about the umbrello-devel
mailing list