[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sat Aug 27 11:37:04 UTC 2005


SVN commit 454020 by okellogg:

UMLClassifier::resolveRef(): Generate signals instead of directly calling
 UMLListView::childObjectAdded().


 M  +17 -5     classifier.cpp  
 M  +4 -21     umlwidget.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classifier.cpp #454019:454020
@@ -46,6 +46,8 @@
 }
 
 void UMLClassifier::setInterface(bool b /* = true */) {
+    // @todo get rid of direct dependencies to UMLListView
+    //  (e.g. move utility methods to Model_Utils and/or use signals)
     UMLListView::Icon_Type newIcon;
     if (b) {
         m_BaseType = ot_Interface;
@@ -428,11 +430,21 @@
         for (UMLObject *obj = m_List.first(); obj; obj = m_List.next())
          {  ....  }
          ****/
-        if (! obj->resolveRef()) {
-            success = false;
-        } else if (obj->getBaseType() != Uml::ot_Association) {
-            UMLListView *listView = UMLApp::app()->getListView();
-            listView->childObjectAdded(static_cast<UMLClassifierListItem*>(obj), this);
+        if (obj->resolveRef()) {
+            UMLClassifierListItem *cli = static_cast<UMLClassifierListItem*>(obj);
+            switch (cli->getBaseType()) {
+                case Uml::ot_Attribute:
+                    emit attributeAdded(cli);
+                    break;
+                case Uml::ot_Operation:
+                    emit operationAdded(cli);
+                    break;
+                case Uml::ot_Template:
+                    emit templateAdded(cli);
+                    break;
+                default:
+                    break;
+            }
         }
     }
     return success;
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidget.cpp #454019:454020
@@ -22,7 +22,6 @@
 #include "classifier.h"
 #include "uml.h"
 #include "umldoc.h"
-#include "umllistview.h"
 #include "umlview.h"
 #include "umlclassifierlistitemlist.h"
 #include "codegenerator.h"
@@ -34,8 +33,6 @@
 #include "dialogs/settingsdlg.h"
 #include "codedocument.h"
 #include "floatingtext.h"
-#include "objectwidget.h"
-#include "messagewidget.h"
 
 #include "clipboard/idchangelog.h"
 
@@ -547,17 +544,6 @@
         {
             UMLObject *pClone = m_pObject->clone();
             m_pView->addObject(pClone);
-            // Update the list view.
-            // CHECK: This smells of hack.
-            UMLListView *listview = UMLApp::app()->getListView();
-            if (dynamic_cast<UMLClassifier*>(pClone)) {
-                UMLClassifier *c = static_cast<UMLClassifier*>(pClone);
-                UMLClassifierListItemList items = c->getFilteredList(Uml::ot_UMLObject);
-                for (UMLClassifierListItemListIt it(items); it.current(); ++it) {
-                    UMLClassifierListItem *item = it.current();
-                    listview->childObjectAdded(item, c);
-                }
-            }
         }
         break;
 
@@ -681,17 +667,13 @@
 
             case wt_Text:
                 ft = static_cast<FloatingText *>( this );
-                switch( ft  -> getRole() ) {
-                case tr_Seq_Message:
+                if (ft->getRole() == tr_Seq_Message) {
                     setX( x );
                     setY( getY() );
-                    break;
-
-                default:
+                } else {
                     setX( getX() );
                     setY( getY() );
-                    break;
-                }//end switch role
+                }
                 break;
 
             default:
@@ -914,6 +896,7 @@
     else
         m_Text = strName;
     calculateSize();
+    adjustAssocs( getX(), getY() );
 }
 
 QString UMLWidget::getName() const {




More information about the umbrello-devel mailing list