umbrello: umbrello/umllistviewitem.h Source File

umbrello 2.32.3 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

umllistviewitem.h
Go to the documentation of this file.
1 /***************************************************************************
2 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2002-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef UMLLISTVIEWITEM_H
12 #define UMLLISTVIEWITEM_H
13
14 #include "basictypes.h"
15 #include "icon_utils.h"
16
17 #include <QDomDocument>
18 #include <QDomElement>
19 #include <QMap>
20 #include <QPointer>
21 #include <QTreeWidget>
22
23 // forward declarations
24 class UMLListView;
25 class UMLObject;
26 class UMLClassifierListItem;
27
28 typedef QTreeWidgetItemIterator UMLListViewItemIterator;
29
39 class UMLListViewItem : public QTreeWidgetItem
40 {
41 public:
42 enum ListViewType
43 {
44 //the values in this enum are saved out to the file
45 //for file compatibility, only add new values to the end
46 lvt_Min = 799,
47 lvt_View = 800,
48 lvt_Logical_View,
49 lvt_UseCase_View,
50 lvt_Logical_Folder,
51 lvt_UseCase_Folder,
52 lvt_UseCase_Diagram,
53 lvt_Collaboration_Diagram,
54 lvt_Class_Diagram,
55 lvt_State_Diagram,
56 lvt_Activity_Diagram,
57 lvt_Sequence_Diagram,
58 lvt_Actor,
59 lvt_UseCase,
60 lvt_Class,
61 lvt_Attribute,
62 lvt_Operation,
63 lvt_Template,
64 lvt_Interface,
65 lvt_Package,
66 lvt_Component_Diagram,
67 lvt_Component_Folder,
68 lvt_Component_View,
69 lvt_Component,
70 lvt_Diagrams, // currently unused
71 lvt_Artifact,
72 lvt_Deployment_Diagram,
73 lvt_Deployment_Folder,
74 lvt_Deployment_View,
75 lvt_Node,
76 lvt_Datatype,
77 lvt_Datatype_Folder,
78 lvt_Enum,
79 lvt_Entity,
80 lvt_EntityAttribute,
81 lvt_EntityRelationship_Diagram,
82 lvt_EntityRelationship_Folder,
83 lvt_EntityRelationship_Model,
84 lvt_Subsystem,
85 lvt_Model,
86 lvt_EnumLiteral,
87 lvt_UniqueConstraint,
88 lvt_PrimaryKeyConstraint,
89 lvt_ForeignKeyConstraint,
90 lvt_CheckConstraint,
91 lvt_Category,
92 lvt_Port,
93 lvt_Properties,
94 lvt_Properties_AutoLayout,
95 lvt_Properties_Class,
96 lvt_Properties_CodeGeneration,
97 lvt_Properties_CodeImport,
98 lvt_Properties_CodeViewer,
99 lvt_Properties_Font,
100 lvt_Properties_General,
101 lvt_Properties_UserInterface,
102 lvt_Association,
103 lvt_Object_Diagram,
104 lvt_Instance,
105 lvt_InstanteAttribute,
106 // enter new values above
107 lvt_Max,
108 lvt_Unknown = -1
109 };
110
111 static QString toString(ListViewType type);
112
113 UMLListViewItem(UMLListView * parent, const QString &name, ListViewType t, UMLObject* o = 0);
114 explicit UMLListViewItem(UMLListView * parent);
115 explicit UMLListViewItem(UMLListViewItem * parent);
116 UMLListViewItem(UMLListViewItem * parent, const QString &name, ListViewType t, UMLObject* o = 0);
117 UMLListViewItem(UMLListViewItem * parent, const QString &name, ListViewType t, Uml::ID::Type id);
118 ~UMLListViewItem();
119
120 ListViewType type() const;
121
122 void setID(Uml::ID::Type id);
123 Uml::ID::Type ID() const;
124
125 void setUMLObject(UMLObject * obj);
126 UMLObject * umlObject() const;
127
128 bool isOwnParent(Uml::ID::Type listViewItemID);
129
130 void updateObject();
131 void updateFolder();
132
133 void setText(int column, const QString &text);
134 void setText(const QString &text);
135 QString getSavedText() const;
136 void setVisible(bool state);
137
138 QString toolTip();
139
140 void setIcon(Icon_Utils::IconType iconType);
141
142 void addClassifierListItem(UMLClassifierListItem *child, UMLListViewItem *childItem);
143
144 void deleteChildItem(UMLClassifierListItem *child);
145
146 //virtual int compare(UMLListViewItem *other, int col, bool ascending) const;
147
148 UMLListViewItem* deepCopy(UMLListViewItem *newParent);
149
150 UMLListViewItem* findUMLObject(const UMLObject *o);
151 UMLListViewItem* findChildObject(UMLClassifierListItem *cli);
152 UMLListViewItem* findItem(Uml::ID::Type id);
153
154 UMLListViewItem* childItem(int i);
155
156 void saveToXMI1(QDomDocument& qDoc, QDomElement& qElement);
157 bool loadFromXMI1(QDomElement& qElement);
158
159 bool isOpen() { return isExpanded(); }
160 void setOpen(bool state);
161
162 public slots:
163 void slotEditFinished(const QString &newText);
164
165 protected:
166 void init();
167
168 void cancelRenameWithMsg();
169
176 typedef QMap<UMLClassifierListItem*, UMLListViewItem*> ChildObjectMap;
177
178 ListViewType m_type;
179 Uml::ID::Type m_id;
180 QPointer<UMLObject> m_object;
181 QString m_label;
182 ChildObjectMap m_comap;
183
184 };
185
186 QDebug operator<<(QDebug dbg, const UMLListViewItem& item);
187
188 #endif
basictypes.h
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition: classifierlistitem.h:30
UMLListViewItem
Items used by UMLListView.
Definition: umllistviewitem.h:40
UMLListViewItem::addClassifierListItem
void addClassifierListItem(UMLClassifierListItem *child, UMLListViewItem *childItem)
Definition: umllistviewitem.cpp:242
UMLListViewItem::updateFolder
void updateFolder()
Definition: umllistviewitem.cpp:418
UMLListViewItem::deepCopy
UMLListViewItem * deepCopy(UMLListViewItem *newParent)
Definition: umllistviewitem.cpp:815
UMLListViewItem::m_type
ListViewType m_type
Definition: umllistviewitem.h:178
UMLListViewItem::saveToXMI1
void saveToXMI1(QDomDocument &qDoc, QDomElement &qElement)
Definition: umllistviewitem.cpp:891
UMLListViewItem::setUMLObject
void setUMLObject(UMLObject *obj)
Definition: umllistviewitem.cpp:302
UMLListViewItem::toolTip
QString toolTip()
Definition: umllistviewitem.cpp:203
UMLListViewItem::m_label
QString m_label
Definition: umllistviewitem.h:181
UMLListViewItem::findUMLObject
UMLListViewItem * findUMLObject(const UMLObject *o)
Definition: umllistviewitem.cpp:837
UMLListViewItem::ChildObjectMap
QMap< UMLClassifierListItem *, UMLListViewItem * > ChildObjectMap
Definition: umllistviewitem.h:176
UMLListViewItem::umlObject
UMLObject * umlObject() const
Definition: umllistviewitem.cpp:312
UMLListViewItem::deleteChildItem
void deleteChildItem(UMLClassifierListItem *child)
Definition: umllistviewitem.cpp:250
UMLListViewItem::getSavedText
QString getSavedText() const
Definition: umllistviewitem.cpp:460
UMLListViewItem::slotEditFinished
void slotEditFinished(const QString &newText)
Definition: umllistviewitem.cpp:479
UMLListViewItem::m_comap
ChildObjectMap m_comap
Definition: umllistviewitem.h:182
UMLListViewItem::loadFromXMI1
bool loadFromXMI1(QDomElement &qElement)
Definition: umllistviewitem.cpp:934
UMLListViewItem::cancelRenameWithMsg
void cancelRenameWithMsg()
Definition: umllistviewitem.cpp:707
UMLListViewItem::toString
static QString toString(ListViewType type)
Definition: umllistviewitem.cpp:964
UMLListViewItem::isOpen
bool isOpen()
Definition: umllistviewitem.h:159
UMLListViewItem::setText
void setText(int column, const QString &text)
Definition: umllistviewitem.cpp:451
UMLListViewItem::ID
Uml::ID::Type ID() const
Definition: umllistviewitem.cpp:271
UMLListViewItem::m_id
Uml::ID::Type m_id
Definition: umllistviewitem.h:179
UMLListViewItem::ListViewType
ListViewType
Definition: umllistviewitem.h:43
UMLListViewItem::lvt_Logical_Folder
@ lvt_Logical_Folder
Definition: umllistviewitem.h:50
UMLListViewItem::lvt_UseCase_Folder
@ lvt_UseCase_Folder
Definition: umllistviewitem.h:51
UMLListViewItem::lvt_Association
@ lvt_Association
Definition: umllistviewitem.h:102
UMLListViewItem::lvt_View
@ lvt_View
Definition: umllistviewitem.h:47
UMLListViewItem::lvt_Deployment_View
@ lvt_Deployment_View
Definition: umllistviewitem.h:74
UMLListViewItem::lvt_Actor
@ lvt_Actor
Definition: umllistviewitem.h:58
UMLListViewItem::lvt_State_Diagram
@ lvt_State_Diagram
Definition: umllistviewitem.h:55
UMLListViewItem::lvt_Node
@ lvt_Node
Definition: umllistviewitem.h:75
UMLListViewItem::lvt_Component_View
@ lvt_Component_View
Definition: umllistviewitem.h:68
UMLListViewItem::lvt_Properties_UserInterface
@ lvt_Properties_UserInterface
Definition: umllistviewitem.h:101
UMLListViewItem::lvt_Collaboration_Diagram
@ lvt_Collaboration_Diagram
Definition: umllistviewitem.h:53
UMLListViewItem::lvt_Properties_Font
@ lvt_Properties_Font
Definition: umllistviewitem.h:99
UMLListViewItem::lvt_Deployment_Folder
@ lvt_Deployment_Folder
Definition: umllistviewitem.h:73
UMLListViewItem::lvt_Max
@ lvt_Max
Definition: umllistviewitem.h:107
UMLListViewItem::lvt_Operation
@ lvt_Operation
Definition: umllistviewitem.h:62
UMLListViewItem::lvt_Entity
@ lvt_Entity
Definition: umllistviewitem.h:79
UMLListViewItem::lvt_Class
@ lvt_Class
Definition: umllistviewitem.h:60
UMLListViewItem::lvt_EntityRelationship_Diagram
@ lvt_EntityRelationship_Diagram
Definition: umllistviewitem.h:81
UMLListViewItem::lvt_PrimaryKeyConstraint
@ lvt_PrimaryKeyConstraint
Definition: umllistviewitem.h:88
UMLListViewItem::lvt_Component
@ lvt_Component
Definition: umllistviewitem.h:69
UMLListViewItem::lvt_Properties_CodeImport
@ lvt_Properties_CodeImport
Definition: umllistviewitem.h:97
UMLListViewItem::lvt_Deployment_Diagram
@ lvt_Deployment_Diagram
Definition: umllistviewitem.h:72
UMLListViewItem::lvt_Diagrams
@ lvt_Diagrams
Definition: umllistviewitem.h:70
UMLListViewItem::lvt_Enum
@ lvt_Enum
Definition: umllistviewitem.h:78
UMLListViewItem::lvt_ForeignKeyConstraint
@ lvt_ForeignKeyConstraint
Definition: umllistviewitem.h:89
UMLListViewItem::lvt_UseCase_View
@ lvt_UseCase_View
Definition: umllistviewitem.h:49
UMLListViewItem::lvt_Properties
@ lvt_Properties
Definition: umllistviewitem.h:93
UMLListViewItem::lvt_Logical_View
@ lvt_Logical_View
Definition: umllistviewitem.h:48
UMLListViewItem::lvt_Component_Folder
@ lvt_Component_Folder
Definition: umllistviewitem.h:67
UMLListViewItem::lvt_Datatype_Folder
@ lvt_Datatype_Folder
Definition: umllistviewitem.h:77
UMLListViewItem::lvt_Properties_AutoLayout
@ lvt_Properties_AutoLayout
Definition: umllistviewitem.h:94
UMLListViewItem::lvt_Properties_CodeGeneration
@ lvt_Properties_CodeGeneration
Definition: umllistviewitem.h:96
UMLListViewItem::lvt_UseCase
@ lvt_UseCase
Definition: umllistviewitem.h:59
UMLListViewItem::lvt_Datatype
@ lvt_Datatype
Definition: umllistviewitem.h:76
UMLListViewItem::lvt_Object_Diagram
@ lvt_Object_Diagram
Definition: umllistviewitem.h:103
UMLListViewItem::lvt_UniqueConstraint
@ lvt_UniqueConstraint
Definition: umllistviewitem.h:87
UMLListViewItem::lvt_EntityRelationship_Model
@ lvt_EntityRelationship_Model
Definition: umllistviewitem.h:83
UMLListViewItem::lvt_EnumLiteral
@ lvt_EnumLiteral
Definition: umllistviewitem.h:86
UMLListViewItem::lvt_Instance
@ lvt_Instance
Definition: umllistviewitem.h:104
UMLListViewItem::lvt_Interface
@ lvt_Interface
Definition: umllistviewitem.h:64
UMLListViewItem::lvt_Activity_Diagram
@ lvt_Activity_Diagram
Definition: umllistviewitem.h:56
UMLListViewItem::lvt_EntityRelationship_Folder
@ lvt_EntityRelationship_Folder
Definition: umllistviewitem.h:82
UMLListViewItem::lvt_Properties_Class
@ lvt_Properties_Class
Definition: umllistviewitem.h:95
UMLListViewItem::lvt_Min
@ lvt_Min
Definition: umllistviewitem.h:46
UMLListViewItem::lvt_Attribute
@ lvt_Attribute
Definition: umllistviewitem.h:61
UMLListViewItem::lvt_Category
@ lvt_Category
Definition: umllistviewitem.h:91
UMLListViewItem::lvt_EntityAttribute
@ lvt_EntityAttribute
Definition: umllistviewitem.h:80
UMLListViewItem::lvt_Unknown
@ lvt_Unknown
Definition: umllistviewitem.h:108
UMLListViewItem::lvt_Model
@ lvt_Model
Definition: umllistviewitem.h:85
UMLListViewItem::lvt_Template
@ lvt_Template
Definition: umllistviewitem.h:63
UMLListViewItem::lvt_Port
@ lvt_Port
Definition: umllistviewitem.h:92
UMLListViewItem::lvt_Component_Diagram
@ lvt_Component_Diagram
Definition: umllistviewitem.h:66
UMLListViewItem::lvt_UseCase_Diagram
@ lvt_UseCase_Diagram
Definition: umllistviewitem.h:52
UMLListViewItem::lvt_Properties_General
@ lvt_Properties_General
Definition: umllistviewitem.h:100
UMLListViewItem::lvt_Subsystem
@ lvt_Subsystem
Definition: umllistviewitem.h:84
UMLListViewItem::lvt_Artifact
@ lvt_Artifact
Definition: umllistviewitem.h:71
UMLListViewItem::lvt_CheckConstraint
@ lvt_CheckConstraint
Definition: umllistviewitem.h:90
UMLListViewItem::lvt_Sequence_Diagram
@ lvt_Sequence_Diagram
Definition: umllistviewitem.h:57
UMLListViewItem::lvt_Class_Diagram
@ lvt_Class_Diagram
Definition: umllistviewitem.h:54
UMLListViewItem::lvt_InstanteAttribute
@ lvt_InstanteAttribute
Definition: umllistviewitem.h:105
UMLListViewItem::lvt_Package
@ lvt_Package
Definition: umllistviewitem.h:65
UMLListViewItem::lvt_Properties_CodeViewer
@ lvt_Properties_CodeViewer
Definition: umllistviewitem.h:98
UMLListViewItem::m_object
QPointer< UMLObject > m_object
Definition: umllistviewitem.h:180
UMLListViewItem::type
ListViewType type() const
Definition: umllistviewitem.cpp:234
UMLListViewItem::UMLListViewItem
UMLListViewItem(UMLListView *parent, const QString &name, ListViewType t, UMLObject *o=0)
Definition: umllistviewitem.cpp:58
UMLListViewItem::setID
void setID(Uml::ID::Type id)
Definition: umllistviewitem.cpp:285
UMLListViewItem::init
void init()
Definition: umllistviewitem.cpp:192
UMLListViewItem::updateObject
void updateObject()
Definition: umllistviewitem.cpp:339
UMLListViewItem::setVisible
void setVisible(bool state)
Definition: umllistviewitem.cpp:261
UMLListViewItem::setIcon
void setIcon(Icon_Utils::IconType iconType)
Definition: umllistviewitem.cpp:468
UMLListViewItem::setOpen
void setOpen(bool state)
Definition: umllistviewitem.cpp:434
UMLListViewItem::findItem
UMLListViewItem * findItem(Uml::ID::Type id)
Definition: umllistviewitem.cpp:873
UMLListViewItem::findChildObject
UMLListViewItem * findChildObject(UMLClassifierListItem *cli)
Definition: umllistviewitem.cpp:856
UMLListViewItem::childItem
UMLListViewItem * childItem(int i)
Definition: umllistviewitem.cpp:959
UMLListViewItem::~UMLListViewItem
~UMLListViewItem()
Definition: umllistviewitem.cpp:185
UMLListViewItem::isOwnParent
bool isOwnParent(Uml::ID::Type listViewItemID)
Definition: umllistviewitem.cpp:321
UMLListView
Displays the list view for the program.
Definition: umllistview.h:47
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
icon_utils.h
Icon_Utils::IconType
IconType
Definition: icon_utils.h:47
Model_Utils::newText
QString newText(UMLObject::ObjectType type)
Definition: model_utils.cpp:620
Uml::ID::Type
std::string Type
Definition: basictypes.h:351
operator<<
QDebug operator<<(QDebug dbg, const UMLListViewItem &item)
Definition: umllistviewitem.cpp:1079
UMLListViewItemIterator
QTreeWidgetItemIterator UMLListViewItemIterator
Definition: umllistviewitem.h:26