[Uml-devel] branches/KDE/3.5/kdesdk/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sat Feb 17 22:55:31 UTC 2007
SVN commit 634671 by okellogg:
{get,set}Visibility(), syncToModel(): Handle binding of m_pObject to UMLAttribute.
BUG:139872
M +3 -1 ChangeLog
M +40 -22 umbrello/associationwidget.cpp
M +2 -2 umbrello/associationwidget.h
--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #634670:634671
@@ -1,10 +1,12 @@
Version 1.5.7
* Bugs fixed from http://bugs.kde.org:
+* Support for utility classes in Ada import and code generator (89167)
* %date% and %time% not being parsed (96612)
-* Relationships for entities do not live outside of an entity relationship diagram (125146)
+* Relationships for entities do not live outside of the diagram (125146)
* Javascript wrong Code Generation (135527)
* Javascript Code Generation creates bad format methods (135540)
+* Incorrect Association Properties text (139872)
* Associations not updated during move of class on diagram (140709)
* Crash when deleting the link between a package and a class (141602)
* Ada95 Code Generation Errors for Aggregation (141644)
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.cpp #634670:634671
@@ -233,13 +233,13 @@
return !(*this == Other);
}
-UMLAssociation * AssociationWidget::getAssociation () {
+UMLAssociation * AssociationWidget::getAssociation () const {
if (m_pObject == NULL || m_pObject->getBaseType() != ot_Association)
return NULL;
return static_cast<UMLAssociation*>(m_pObject);
}
-UMLAttribute * AssociationWidget::getAttribute () {
+UMLAttribute * AssociationWidget::getAttribute () const {
if (m_pObject == NULL)
return NULL;
Uml::Object_Type ot = m_pObject->getBaseType();
@@ -464,18 +464,27 @@
}
Uml::Visibility AssociationWidget::getVisibility(Role_Type role) const {
- if (m_pObject == NULL || m_pObject->getBaseType() != ot_Association)
- return m_role[role].m_Visibility;
- UMLAssociation *umla = static_cast<UMLAssociation*>(m_pObject);
- return umla->getVisibility(role);
+ const UMLAssociation *assoc = getAssociation();
+ if (assoc)
+ return assoc->getVisibility(role);
+ const UMLAttribute *attr = getAttribute();
+ if (attr)
+ return attr->getVisibility();
+ return m_role[role].m_Visibility;
}
void AssociationWidget::setVisibility(Uml::Visibility value, Role_Type role)
{
if (value == getVisibility(role))
return;
- if (m_pObject && m_pObject->getBaseType() == ot_Association) // update our model object
- getAssociation()->setVisibility(value, role);
+ if (m_pObject) {
+ // update our model object
+ const Uml::Object_Type ot = m_pObject->getBaseType();
+ if (ot == ot_Association)
+ getAssociation()->setVisibility(value, role);
+ else if (ot == ot_Attribute)
+ getAttribute()->setVisibility(value);
+ }
m_role[role].m_Visibility = value;
// update role pre-text attribute as appropriate
if (m_role[role].m_pRole) {
@@ -1209,6 +1218,11 @@
UMLAssociation *uml = getAssociation();
if (uml == NULL) {
+ UMLAttribute *attr = getAttribute();
+ if (attr == NULL)
+ return;
+ setVisibility(attr->getVisibility(), B);
+ setRoleName(attr->getName(), B);
return;
}
// block signals until finished
@@ -1230,13 +1244,13 @@
// this will synchronize UMLAssociation w/ this new Widget
void AssociationWidget::mergeAssociationDataIntoUMLRepresentation()
{
-
- UMLAssociation *uml = getAssociation();
- if (uml == NULL)
+ UMLAssociation *umlassoc = getAssociation();
+ UMLAttribute *umlattr = getAttribute();
+ if (umlassoc == NULL && umlattr == NULL)
return;
// block emit modified signal, or we get a horrible loop
- uml->blockSignals(true);
+ m_pObject->blockSignals(true);
// would be desirable to do the following
// so that we can be sure its back to initial state
@@ -1246,26 +1260,30 @@
// floating text widgets
FloatingTextWidget *text = getNameWidget();
if (text)
- uml->setName(text->getText());
+ m_pObject->setName(text->getText());
text = getRoleWidget(A);
- if (text)
- uml->setRoleName(text->getText(), A);
+ if (text && umlassoc)
+ umlassoc->setRoleName(text->getText(), A);
text = getRoleWidget(B);
- if (text)
- uml->setRoleName(text->getText(), B);
+ if (text) {
+ if (umlassoc)
+ umlassoc->setRoleName(text->getText(), B);
+ else if (umlattr)
+ umlattr->setName(text->getText());
+ }
text = getMultiWidget(A);
- if (text)
- uml->setMulti(text->getText(), A);
+ if (text && umlassoc)
+ umlassoc->setMulti(text->getText(), A);
text = getMultiWidget(B);
- if (text)
- uml->setMulti(text->getText(), B);
+ if (text && umlassoc)
+ umlassoc->setMulti(text->getText(), B);
// unblock
- uml->blockSignals(false);
+ m_pObject->blockSignals(false);
}
/** Adjusts the ending point of the association that connects to Widget */
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/associationwidget.h #634670:634671
@@ -483,7 +483,7 @@
* @return Pointer to the UMLAssociation that is represented by
* this AsociationWidget.
*/
- UMLAssociation * getAssociation ();
+ UMLAssociation * getAssociation() const;
/**
* Returns the UMLAttribute representation of this object.
@@ -491,7 +491,7 @@
* @return Pointer to the UMLAttribute that is represented by
* this AsociationWidget.
*/
- UMLAttribute * getAttribute ();
+ UMLAttribute * getAttribute() const;
/**
* Sets the text of the FloatingTextWidget identified by the ft's Text_Role.
More information about the umbrello-devel
mailing list