[Uml-devel] branches/work/isi-umbrello/umbrello/umbrello
Hassan Kouch
hkouch at hotmail.com
Fri Feb 16 03:48:46 UTC 2007
SVN commit 634029 by kouch:
fix SaveToXmi and LaodToXmi for the object flow on the activity diagram (UML2.0)
M +2 -1 listpopupmenu.cpp
M +5 -5 objectflowwidget.cpp
M +29 -1 umlview.cpp
M +5 -2 widget_factory.cpp
--- branches/work/isi-umbrello/umbrello/umbrello/listpopupmenu.cpp #634028:634029
@@ -36,6 +36,7 @@
#include "activitywidget.h"
#include "preconditionwidget.h"
#include "combinedfragmentwidget.h"
+#include "objectflowwidget.h"
#include "forkjoinwidget.h"
#include "objectwidget.h"
@@ -355,7 +356,7 @@
insertStdItems(false, type);
insertStdItem(mt_Line_Color);
break;
-
+ case Uml::wt_Object_Flow:
case Uml::wt_Signal:
setupColor( object -> getUseFillColour() );
insertSeparator();
--- branches/work/isi-umbrello/umbrello/umbrello/objectflowwidget.cpp #634028:634029
@@ -147,7 +147,7 @@
void ObjectFlowWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
QDomElement ObjectFlowElement = qDoc.createElement( "objectflowwidget" );
UMLWidget::saveToXMI( qDoc, ObjectFlowElement );
- // ObjectFlowElement.setAttribute( "objectflowname", m_Text );
+ ObjectFlowElement.setAttribute( "objectflowname", m_Text );
ObjectFlowElement.setAttribute( "documentation", m_Doc );
qElement.appendChild( ObjectFlowElement );
}
@@ -155,11 +155,11 @@
bool ObjectFlowWidget::loadFromXMI( QDomElement & qElement ) {
if( !UMLWidget::loadFromXMI( qElement ) )
return false;
- //m_Text = qElement.attribute( "objectflowname", "" );
+ m_Text = qElement.attribute( "objectflowname", "" );
m_Doc = qElement.attribute( "documentation", "" );
- /* QString type = qElement.attribute( "objectflowtype", "1" );
- setObjectFlowType( (ObjectFlowType)type.toInt() );
- */return true;
+ //QString type = qElement.attribute( "objectflowtype", "1" );
+ // setObjectFlowType( (ObjectFlowType)type.toInt() );
+ return true;
}
--- branches/work/isi-umbrello/umbrello/umbrello/umlview.cpp #634028:634029
@@ -87,6 +87,7 @@
#include "signalwidget.h"
#include "forkjoinwidget.h"
#include "activitywidget.h"
+#include "objectflowwidget.h"
#include "seqlinewidget.h"
#include "uniqueid.h"
#include "umllistviewitemlist.h"
@@ -1704,7 +1705,32 @@
m_WidgetList.append( pWidget );
}
break;
-
+
+ case wt_Object_Flow:
+ {
+ 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;
@@ -3186,6 +3212,7 @@
while( !widgetElement.isNull() ) {
widget = loadWidgetFromXMI(widgetElement);
if (widget) {
+ kDebug() << "load widgets from xmi !!!! " << widget->getName() << endl;
m_WidgetList.append( widget );
// In the interest of best-effort loading, in case of a
// (widget == NULL) we still go on.
@@ -3208,6 +3235,7 @@
}
QString tag = widgetElement.tagName();
+ kDebug() << "load widget from xmi tag!!!! " << tag << endl;
QString idstr = widgetElement.attribute( "xmi.id", "-1" );
widget = Widget_Factory::makeWidgetFromXMI(tag, idstr, this);
--- branches/work/isi-umbrello/umbrello/umbrello/widget_factory.cpp #634028:634029
@@ -45,6 +45,7 @@
#include "boxwidget.h"
#include "associationwidget.h"
#include "objectwidget.h"
+#include "objectflowwidget.h"
#include "messagewidget.h"
#include "statewidget.h"
#include "forkjoinwidget.h"
@@ -163,10 +164,10 @@
UMLWidget *widget = NULL;
if (tag == "statewidget" || tag == "notewidget" || tag == "boxwidget" ||
tag == "floatingtext" || tag == "activitywidget" || tag == "forkjoin" || tag == "preconditionwidget" || tag == "endoflifewidget" ||
- tag == "combinedFragmentwidget" || tag == "signalwidget" || tag == "floatingdashlinewidget" ||
+ tag == "combinedFragmentwidget" || tag == "signalwidget" || tag == "objectflowwidget" || tag == "floatingdashlinewidget" ||
// tests for backward compatibility:
tag == "UML:StateWidget" || tag == "UML:NoteWidget" ||
- tag=="UML:CombinedFragmentWidget" || tag == "UML:FloatingTextWidget" || tag == "UML:SignalWidget" || tag == "UML:ActivityWidget") {
+ tag=="UML:CombinedFragmentWidget" || tag == "UML:FloatingTextWidget" || tag == "UML:SignalWidget" || tag == "UML:ActivityWidget" || tag == "UML:ObjectFlowWidget" ) {
// 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
@@ -195,6 +196,8 @@
widget = new CombinedFragmentWidget(view, CombinedFragmentWidget::Ref, Uml::id_Reserved);
} else if (tag == "signalwidget") {
widget = new SignalWidget(view, SignalWidget::Send, Uml::id_Reserved);
+ } else if (tag == "objectflowwidget") {
+ widget = new ObjectFlowWidget(view,Uml::id_Reserved);
}
} else {
// Find the UMLObject and create the Widget to represent it
More information about the umbrello-devel
mailing list