Commit bb3e070f authored by Ralf Habacker's avatar Ralf Habacker

Add class InterfaceWidget

parent b9e551ba
......@@ -401,6 +401,7 @@ set(libumlwidgets_SRCS
umlwidgets/floatingdashlinewidget.cpp
umlwidgets/floatingtextwidget.cpp
umlwidgets/forkjoinwidget.cpp
umlwidgets/interfacewidget.cpp
umlwidgets/layoutgrid.cpp
umlwidgets/linkwidget.cpp
umlwidgets/messagewidget.cpp
......
......@@ -19,6 +19,7 @@
#include "entitywidget.h"
#include "floatingtextwidget.h"
#include "forkjoinwidget.h"
#include "interfacewidget.h"
#include "notewidget.h"
#include "objectwidget.h"
#include "objectnodewidget.h"
......@@ -208,7 +209,7 @@ void WidgetBasePopupMenu::insertSingleSelectionMenu(WidgetBase* widget)
case WidgetBase::wt_Interface:
{
ClassifierWidget* c = widget->asClassifierWidget();
InterfaceWidget* c = widget->asInterfaceWidget();
if (!c)
break;
insertSubMenuNew(type);
......
......@@ -41,6 +41,7 @@
#include "foreignkeyconstraint.h"
#include "forkjoinwidget.h"
#include "idchangelog.h"
#include "interfacewidget.h"
#include "import_utils.h"
#include "layoutgenerator.h"
#include "layoutgrid.h"
......@@ -3332,8 +3333,11 @@ void UMLScene::setClassWidgetOptions(ClassOptionsPage * page)
foreach(UMLWidget* pWidget, widgetList()) {
uIgnoreZeroPointer(pWidget);
WidgetBase::WidgetType wt = pWidget->baseType();
if (wt == WidgetBase::wt_Class || wt == WidgetBase::wt_Interface) {
page->setWidget(static_cast<ClassifierWidget *>(pWidget));
if (wt == WidgetBase::wt_Class) {
page->setWidget(pWidget->asClassifierWidget());
page->apply();
} else if (wt == WidgetBase::wt_Interface) {
page->setWidget(pWidget->asInterfaceWidget());
page->apply();
}
}
......
/***************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2019 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
#include "interfacewidget.h"
InterfaceWidget::InterfaceWidget(UMLScene *scene, UMLClassifier *c)
: ClassifierWidget(scene, c)
{
}
InterfaceWidget::InterfaceWidget(UMLScene *scene, UMLPackage *p)
: ClassifierWidget(scene, p)
{
}
/***************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2019 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
#ifndef INTERFACEWIDGET_H
#define INTERFACEWIDGET_H
#include "classifierwidget.h"
/**
* Provides an interface widget
*
* The implementation is currently in @ref ClassifierWidget
* and should be moved to this class for easier implementation
*
* @author Ralf Habacker
*/
class InterfaceWidget : public ClassifierWidget
{
public:
InterfaceWidget(UMLScene * scene, UMLClassifier * c);
InterfaceWidget(UMLScene * scene, UMLPackage * p);
};
#endif // INTERFACEWIDGET_H
......@@ -38,6 +38,7 @@
#include "floatingtextwidget.h"
#include "folder.h"
#include "forkjoinwidget.h"
#include "interfacewidget.h"
#include "messagewidget.h"
#include "node.h"
#include "nodewidget.h"
......@@ -127,7 +128,7 @@ UMLWidget *createWidget(UMLScene *scene, UMLObject *o)
newWidget = ow;
} else {
UMLClassifier *c = o->asUMLClassifier();
ClassifierWidget* interfaceWidget = new ClassifierWidget(scene, c);
InterfaceWidget* interfaceWidget = new InterfaceWidget(scene, c);
if (diagramType == Uml::DiagramType::Component || diagramType == Uml::DiagramType::Deployment) {
interfaceWidget->setDrawAsCircle(true);
}
......@@ -280,7 +281,7 @@ UMLWidget* makeWidgetFromXMI(const QString& tag,
widget = new ArtifactWidget(scene, o->asUMLArtifact());
} else if (tag == QLatin1String("interfacewidget")) {
if (validateObjType(UMLObject::ot_Interface, o, id))
widget = new ClassifierWidget(scene, o->asUMLClassifier());
widget = new InterfaceWidget(scene, o->asUMLClassifier());
} else if (tag == QLatin1String("datatypewidget")) {
if (validateObjType(UMLObject::ot_Datatype, o, id))
widget = new DatatypeWidget(scene, o->asUMLClassifier());
......
......@@ -1299,7 +1299,7 @@ Icon_Utils::IconType WidgetBase::toIcon(WidgetBase::WidgetType wt)
#include "enumwidget.h"
#include "floatingdashlinewidget.h"
#include "forkjoinwidget.h"
//#include "interfacewidget.h"
#include "interfacewidget.h"
#include "messagewidget.h"
#include "nodewidget.h"
#include "notewidget.h"
......@@ -1328,7 +1328,7 @@ EntityWidget* WidgetBase::asEntityWidget() { return dynamic_cast<EntityWidget* >
EnumWidget* WidgetBase::asEnumWidget() { return dynamic_cast<EnumWidget* >(this); }
FloatingDashLineWidget* WidgetBase::asFloatingDashLineWidget() { return dynamic_cast<FloatingDashLineWidget*>(this); }
ForkJoinWidget* WidgetBase::asForkJoinWidget() { return dynamic_cast<ForkJoinWidget* >(this); }
//InterfaceWidget* WidgetBase::asInterfaceWidget() { return dynamic_cast<InterfaceWidget* >(this); }
InterfaceWidget* WidgetBase::asInterfaceWidget() { return dynamic_cast<InterfaceWidget* >(this); }
MessageWidget* WidgetBase::asMessageWidget() { return dynamic_cast<MessageWidget* >(this); }
NodeWidget* WidgetBase::asNodeWidget() { return dynamic_cast<NodeWidget* >(this); }
NoteWidget* WidgetBase::asNoteWidget() { return dynamic_cast<NoteWidget* >(this); }
......
......@@ -39,7 +39,7 @@ class EnumWidget;
class FloatingDashLineWidget;
class FloatingTextWidget;
class ForkJoinWidget;
//class InterfaceWidget;
class InterfaceWidget;
class MessageWidget;
class NodeWidget;
class NoteWidget;
......@@ -237,7 +237,7 @@ public:
EnumWidget* asEnumWidget();
FloatingDashLineWidget* asFloatingDashLineWidget();
ForkJoinWidget* asForkJoinWidget();
//InterfaceWidget* asInterfaceWidget();
InterfaceWidget* asInterfaceWidget();
MessageWidget* asMessageWidget();
NodeWidget* asNodeWidget();
NoteWidget* asNoteWidget();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment