[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Wed Mar 23 16:51:57 UTC 2005


CVS commit by okellogg: 

UMLCanvasObject::findChildObject(): Rename to findAssoc().
UMLClassifier::findChildObject(): add optional considerAncestors arg.


  M +10 -2     classifier.cpp   1.71
  M +1 -1      classifier.h   1.51
  M +1 -1      messagewidget.cpp   1.67
  M +1 -1      umlcanvasobject.cpp   1.34
  M +1 -1      umlcanvasobject.h   1.23


--- kdesdk/umbrello/umbrello/classifier.cpp  #1.70:1.71
@@ -276,5 +276,5 @@ UMLObjectList UMLClassifier::findChildOb
 }
 
-UMLObject* UMLClassifier::findChildObject(Uml::IDType id) {
+UMLObject* UMLClassifier::findChildObject(Uml::IDType id, bool considerAncestors /* =false */) {
         for (UMLClassifierListItemListIt lit(m_List); lit.current(); ++lit) {
                 UMLClassifierListItem* o = lit.current();
@@ -282,5 +282,13 @@ UMLObject* UMLClassifier::findChildObjec
                         return o;
         }
-        return UMLCanvasObject::findChildObject(id);
+        if (considerAncestors) {
+                UMLClassifierList ancestors = findSuperClassConcepts();
+                for (UMLClassifier *anc = ancestors.first(); anc; anc = ancestors.next()) {
+                        UMLObject *o = anc->findChildObject(id);
+                        if (o)
+                                return o;
+                }
+        }
+        return UMLCanvasObject::findAssoc(id);
 }
 

--- kdesdk/umbrello/umbrello/classifier.h  #1.50:1.51
@@ -292,5 +292,5 @@ public:
          * @return      The object found.  Will return 0 if none found.
          */
-        virtual UMLObject* findChildObject(Uml::IDType id);
+        virtual UMLObject* findChildObject(Uml::IDType id, bool considerAncestors = false);
 
         /**

--- kdesdk/umbrello/umbrello/messagewidget.cpp  #1.66:1.67
@@ -832,5 +832,5 @@ bool MessageWidget::loadFromXMI(QDomElem
         if (c) {
                 Uml::IDType opId = STR2ID(m_CustomOp);
-                m_pOperation = dynamic_cast<UMLOperation*>( c->findChildObject(opId) );
+                m_pOperation = dynamic_cast<UMLOperation*>( c->findChildObject(opId, true) );
                 if (m_pOperation) {
                         // If m_pOperation is set, m_CustomOp isn't used anyway.

--- kdesdk/umbrello/umbrello/umlcanvasobject.cpp  #1.33:1.34
@@ -133,5 +133,5 @@ UMLObjectList UMLCanvasObject::findChild
 }
 
-UMLObject* UMLCanvasObject::findChildObject(Uml::IDType id) {
+UMLObject* UMLCanvasObject::findAssoc(Uml::IDType id) {
         for (UMLAssociationListIt ait(m_AssocsList); ait.current(); ++ait) {
                 UMLAssociation *asso = ait.current();

--- kdesdk/umbrello/umbrello/umlcanvasobject.h  #1.22:1.23
@@ -175,5 +175,5 @@ public:
          * @return      Pointer to the object found (NULL if not found.)
          */
-        virtual UMLObject* findChildObject(Uml::IDType id);
+        UMLObject* findAssoc(Uml::IDType id);
 
         /**






More information about the umbrello-devel mailing list