[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Mon Oct 10 11:06:27 UTC 2005
SVN commit 469320 by okellogg:
Merge the class StereotypedWidget into UMLWidget.
It turns out that the single attribute, m_bShowStereotype, does
not warrant an own class:
- On the model side, the stereotype is already in UMLObject.
- A diamond-shaped multiple inheritance arises when a widget
is both resizable (ResizableWidget) and stereotyped.
M +0 -1 Makefile.am
M +3 -3 classifierwidget.cpp
M +2 -2 classifierwidget.h
M +2 -2 componentwidget.cpp
M +2 -2 componentwidget.h
M +2 -2 packagewidget.cpp
M +2 -2 packagewidget.h
D stereotypedwidget.cpp
D stereotypedwidget.h
M +14 -0 umlwidget.cpp
M +19 -0 umlwidget.h
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/Makefile.am #469319:469320
@@ -75,7 +75,6 @@
seqlinewidget.cpp \
statewidget.cpp \
stereotype.cpp \
-stereotypedwidget.cpp \
template.cpp \
textblock.cpp \
toolbarstate.cpp \
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classifierwidget.cpp #469319:469320
@@ -28,7 +28,7 @@
#include "listpopupmenu.h"
ClassifierWidget::ClassifierWidget(UMLView * view, UMLClassifier *c)
- : StereotypedWidget(view, c) {
+ : UMLWidget(view, c) {
init();
if (c != NULL && c->isInterface()) {
WidgetBase::setBaseType(Uml::wt_Interface);
@@ -738,7 +738,7 @@
conceptElement = qDoc.createElement("interfacewidget");
else
conceptElement = qDoc.createElement("classwidget");
- StereotypedWidget::saveToXMI( qDoc, conceptElement );
+ UMLWidget::saveToXMI( qDoc, conceptElement );
conceptElement.setAttribute( "showoperations", m_bShowOperations );
conceptElement.setAttribute( "showpubliconly", m_bShowPublicOnly );
conceptElement.setAttribute( "showopsigs", m_ShowOpSigs );
@@ -754,7 +754,7 @@
}
bool ClassifierWidget::loadFromXMI(QDomElement & qElement) {
- if (!StereotypedWidget::loadFromXMI(qElement))
+ if (!UMLWidget::loadFromXMI(qElement))
return false;
QString showatts = qElement.attribute( "showattributes", "0" );
QString showops = qElement.attribute( "showoperations", "1" );
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classifierwidget.h #469319:469320
@@ -15,7 +15,7 @@
#ifndef CLASSIFIERWIDGET_H
#define CLASSIFIERWIDGET_H
-#include "stereotypedwidget.h"
+#include "umlwidget.h"
class QPainter;
class UMLClassifier;
@@ -27,7 +27,7 @@
* @see UMLWidget
* Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
*/
-class ClassifierWidget : public StereotypedWidget {
+class ClassifierWidget : public UMLWidget {
public:
/**
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/componentwidget.cpp #469319:469320
@@ -19,7 +19,7 @@
#include <qpainter.h>
ComponentWidget::ComponentWidget(UMLView * view, UMLComponent *c)
- : StereotypedWidget(view, c) {
+ : UMLWidget(view, c) {
init();
setSize(100, 30);
calculateSize();
@@ -136,7 +136,7 @@
void ComponentWidget::saveToXMI(QDomDocument& qDoc, QDomElement& qElement) {
QDomElement conceptElement = qDoc.createElement("componentwidget");
- StereotypedWidget::saveToXMI(qDoc, conceptElement);
+ UMLWidget::saveToXMI(qDoc, conceptElement);
qElement.appendChild(conceptElement);
}
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/componentwidget.h #469319:469320
@@ -15,7 +15,7 @@
#ifndef COMPONENTWIDGET_H
#define COMPONENTWIDGET_H
-#include "stereotypedwidget.h"
+#include "umlwidget.h"
class UMLComponent;
@@ -30,7 +30,7 @@
* @see UMLWidget
* Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
*/
-class ComponentWidget : public StereotypedWidget {
+class ComponentWidget : public UMLWidget {
public:
/**
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/packagewidget.cpp #469319:469320
@@ -20,7 +20,7 @@
#include <qpainter.h>
PackageWidget::PackageWidget(UMLView * view, UMLPackage *o)
- : StereotypedWidget(view, o) {
+ : UMLWidget(view, o) {
init();
setSize(100, 30);
calculateSize();
@@ -115,7 +115,7 @@
void PackageWidget::saveToXMI(QDomDocument& qDoc, QDomElement& qElement) {
QDomElement conceptElement = qDoc.createElement("packagewidget");
- StereotypedWidget::saveToXMI(qDoc, conceptElement);
+ UMLWidget::saveToXMI(qDoc, conceptElement);
qElement.appendChild(conceptElement);
}
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/packagewidget.h #469319:469320
@@ -15,7 +15,7 @@
#ifndef PACKAGEWIDGET_H
#define PACKAGEWIDGET_H
-#include "stereotypedwidget.h"
+#include "umlwidget.h"
class UMLPackage;
@@ -30,7 +30,7 @@
* @see UMLWidget
* Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
*/
-class PackageWidget : public StereotypedWidget {
+class PackageWidget : public UMLWidget {
public:
/**
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidget.cpp #469319:469320
@@ -1044,6 +1044,16 @@
calculateSize();
}
+void UMLWidget::setShowStereotype(bool _status) {
+ m_bShowStereotype = _status;
+ calculateSize();
+ update();
+}
+
+bool UMLWidget::getShowStereotype() const {
+ return m_bShowStereotype;
+}
+
void UMLWidget::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
/*
Call after required actions in child class.
@@ -1067,6 +1077,8 @@
qElement.setAttribute("isinstance", m_bIsInstance);
if (!m_instanceName.isEmpty())
qElement.setAttribute("instancename", m_instanceName);
+ if (m_bShowStereotype)
+ qElement.setAttribute("showstereotype", m_bShowStereotype);
}
bool UMLWidget::loadFromXMI( QDomElement & qElement ) {
@@ -1105,6 +1117,8 @@
QString isinstance = qElement.attribute("isinstance", "0");
m_bIsInstance = (bool)isinstance.toInt();
m_instanceName = qElement.attribute("instancename", "");
+ QString showstereo = qElement.attribute("showstereotype", "0");
+ m_bShowStereotype = (bool)showstereo.toInt();
return true;
}
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlwidget.h #469319:469320
@@ -388,6 +388,20 @@
return m_instanceName;
}
+ /**
+ * Returns the status of whether to show Stereotype.
+ *
+ * @return True if stereotype is shown.
+ */
+ bool getShowStereotype() const;
+
+ /**
+ * Set the status of whether to show Stereotype.
+ *
+ * @param _show True if stereotype shall be shown.
+ */
+ virtual void setShowStereotype(bool _status);
+
virtual void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
virtual bool loadFromXMI( QDomElement & qElement );
@@ -588,6 +602,11 @@
*/
QString m_instanceName;
+ /**
+ * Should it show the <<stereotype>> of the widget
+ */
+ bool m_bShowStereotype;
+
///////////////// End of Data Loaded/Saved //////////////////////////
bool m_bMouseDown, m_bMouseOver, m_bSelected, m_bStartMove;
More information about the umbrello-devel
mailing list