[Uml-devel] branches/work/isi-umbrello/umbrello/umbrello

Hassan Kouch hkouch at hotmail.com
Mon Feb 5 16:08:19 UTC 2007


SVN commit 630511 by kouch:

implement of laodToXmi and SaveToXmi of the combined Fragment (UML2.0)


 M  +1 -2      combinedfragmentwidget.cpp  
 M  +1 -1      combinedfragmentwidget.h  
 M  +2 -1      listpopupmenu.cpp  
 M  +1 -1      umlnamespace.h  
 M  +26 -0     umlview.cpp  
 M  +5 -1      widget_factory.cpp  


--- branches/work/isi-umbrello/umbrello/umbrello/combinedfragmentwidget.cpp #630510:630511
@@ -36,7 +36,7 @@
 
 CombinedFragmentWidget::CombinedFragmentWidget(UMLView * view, CombinedFragmentType combinedfragmentType, Uml::IDType id ) : UMLWidget(view, id)
 {
-    UMLWidget::setBaseType( Uml::wt_Combined_Fragment );
+    UMLWidget::setBaseType( Uml::wt_CombinedFragment );
     setCombinedFragmentType( combinedfragmentType );
     updateComponentSize();
 }
@@ -225,7 +225,6 @@
 //     return status;
 // }
 
-
 void CombinedFragmentWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
     QDomElement combinedFragmentElement = qDoc.createElement( "combinedFragmentwidget" );
     UMLWidget::saveToXMI( qDoc, combinedFragmentElement );
--- branches/work/isi-umbrello/umbrello/umbrello/combinedfragmentwidget.h #630510:630511
@@ -53,7 +53,7 @@
      * @param combinedfragmentType      The type of combined fragment.
      * @param id                The ID to assign (-1 will prompt a new ID.)
      */
-    CombinedFragmentWidget( UMLView * view, CombinedFragmentType combinedfragmentType = Opt, Uml::IDType id = Uml::id_None );
+    CombinedFragmentWidget( UMLView * view, CombinedFragmentType combinedfragmentType = Ref, Uml::IDType id = Uml::id_None );
 
 
     /**
--- branches/work/isi-umbrello/umbrello/umbrello/listpopupmenu.cpp #630510:630511
@@ -34,6 +34,7 @@
 #include "statewidget.h"
 #include "activitywidget.h"
 #include "preconditionwidget.h"
+#include "combinedfragmentwidget.h"
 #include "forkjoinwidget.h"
 #include "objectwidget.h"
 
@@ -405,7 +406,7 @@
         insertStdItem(mt_Change_Font);
         break;
 
-    case Uml::wt_Combined_Fragment:
+    case Uml::wt_CombinedFragment:
 	setupColor( object -> getUseFillColour() );
         insertSeparator();
         insertStdItem(mt_Cut);
--- branches/work/isi-umbrello/umbrello/umbrello/umlnamespace.h #630510:630511
@@ -106,7 +106,7 @@
     wt_Association,             // has UMLObject representation
     wt_ForkJoin,                 // does not have UMLObject representation
     wt_Precondition,		// does not have UMLObject representation
-    wt_Combined_Fragment,	// does not have UMLObject representation
+    wt_CombinedFragment,	// does not have UMLObject representation 
     wt_End_Of_Life		
 };
 
--- branches/work/isi-umbrello/umbrello/umbrello/umlview.cpp #630510:630511
@@ -1625,6 +1625,32 @@
         }
         break;
 
+   case wt_CombinedFragment:
+        {
+            ObjectWidget* pObjectWidget = static_cast<ObjectWidget*>(pWidget);
+            if (pObjectWidget == NULL) {
+                kDebug() << "UMLView::addWidget(): pObjectWidget is NULL" << endl;
+                return false;
+            }
+            Uml::IDType newID = log->findNewID( pWidget -> getID() );
+            if (newID == Uml::id_None) {
+                return false;
+            }
+            pObjectWidget -> setID( newID );
+            Uml::IDType nNewLocalID = getLocalID();
+            Uml::IDType nOldLocalID = pObjectWidget -> getLocalID();
+            m_pIDChangesLog->addIDChange( nOldLocalID, nNewLocalID );
+            pObjectWidget -> setLocalID( nNewLocalID );
+            UMLObject *pObject = m_pDoc -> findObjectById( newID );
+            if( !pObject ) {
+                kDebug() << "addWidget::Can't find UMLObject" << endl;
+                return false;
+            }
+            pWidget -> setUMLObject( pObject );
+            m_WidgetList.append( pWidget );
+        }
+        break;
+
     default:
         kDebug() << "Trying to add an invalid widget type" << endl;
         return false;
--- branches/work/isi-umbrello/umbrello/umbrello/widget_factory.cpp #630510:630511
@@ -49,6 +49,7 @@
 #include "statewidget.h"
 #include "forkjoinwidget.h"
 #include "activitywidget.h"
+#include "combinedfragmentwidget.h"
 #include "seqlinewidget.h"
 #include "preconditionwidget.h"
 #include "cmds.h"
@@ -161,9 +162,10 @@
     UMLWidget *widget = NULL;
     if (tag == "statewidget" || tag == "notewidget" || tag == "boxwidget" ||
         tag == "floatingtext" || tag == "activitywidget" || tag == "forkjoin" || tag == "preconditionwidget" ||
+        tag == "combinedFragmentwidget"  ||
             // tests for backward compatibility:
             tag == "UML:StateWidget" || tag == "UML:NoteWidget" ||
-            tag == "UML:FloatingTextWidget" || tag == "UML:ActivityWidget") {
+            tag=="UML:CombinedFragmentWidget" || tag == "UML:FloatingTextWidget" || tag == "UML:ActivityWidget") {
         // Loading of widgets which do NOT represent any UMLObject, 
         // just graphic stuff with no real model information
         //FIXME while boxes and texts are just diagram objects, activities and
@@ -186,6 +188,8 @@
             widget = new ForkJoinWidget(view, false, Uml::id_Reserved);
         } else if (tag == "preconditionwidget") {
             widget = new PreconditionWidget(view, NULL, Uml::id_Reserved);
+	} else if (tag == "combinedFragmentwidget") {
+            widget = new CombinedFragmentWidget(view, CombinedFragmentWidget::Ref, Uml::id_Reserved);
 	}
     } else {
         // Find the UMLObject and create the Widget to represent it




More information about the umbrello-devel mailing list