umbrello: umbrello/umllistviewitem.h Source File

umbrello 2.32.0 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-2021 *
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 #include <QXmlStreamWriter>
23
24 // forward declarations
25 class UMLListView;
26 class UMLObject;
27 class UMLClassifierListItem;
28
29 typedef QTreeWidgetItemIterator UMLListViewItemIterator;
30
40 class UMLListViewItem : public QTreeWidgetItem
41 {
42 public:
43 enum ListViewType
44 {
45 //the values in this enum are saved out to the file
46 //for file compatibility, only add new values to the end
47 lvt_Min = 799,
48 lvt_View = 800,
49 lvt_Logical_View,
50 lvt_UseCase_View,
51 lvt_Logical_Folder,
52 lvt_UseCase_Folder,
53 lvt_UseCase_Diagram,
54 lvt_Collaboration_Diagram,
55 lvt_Class_Diagram,
56 lvt_State_Diagram,
57 lvt_Activity_Diagram,
58 lvt_Sequence_Diagram,
59 lvt_Actor,
60 lvt_UseCase,
61 lvt_Class,
62 lvt_Attribute,
63 lvt_Operation,
64 lvt_Template,
65 lvt_Interface,
66 lvt_Package,
67 lvt_Component_Diagram,
68 lvt_Component_Folder,
69 lvt_Component_View,
70 lvt_Component,
71 lvt_Diagrams, // currently unused
72 lvt_Artifact,
73 lvt_Deployment_Diagram,
74 lvt_Deployment_Folder,
75 lvt_Deployment_View,
76 lvt_Node,
77 lvt_Datatype,
78 lvt_Datatype_Folder,
79 lvt_Enum,
80 lvt_Entity,
81 lvt_EntityAttribute,
82 lvt_EntityRelationship_Diagram,
83 lvt_EntityRelationship_Folder,
84 lvt_EntityRelationship_Model,
85 lvt_Subsystem,
86 lvt_Model,
87 lvt_EnumLiteral,
88 lvt_UniqueConstraint,
89 lvt_PrimaryKeyConstraint,
90 lvt_ForeignKeyConstraint,
91 lvt_CheckConstraint,
92 lvt_Category,
93 lvt_Port,
94 lvt_Properties,
95 lvt_Properties_AutoLayout,
96 lvt_Properties_Class,
97 lvt_Properties_CodeGeneration,
98 lvt_Properties_CodeImport,
99 lvt_Properties_CodeViewer,
100 lvt_Properties_Font,
101 lvt_Properties_General,
102 lvt_Properties_UserInterface,
103 lvt_Association,
104 lvt_Object_Diagram,
105 lvt_Instance,
106 lvt_InstanceAttribute,
107 // enter new values above
108 lvt_Max,
109 lvt_Unknown = -1
110 };
111
112 static QString toString(ListViewType type);
113
114 UMLListViewItem(UMLListView * parent, const QString &name, ListViewType t, UMLObject* o = 0);
115 explicit UMLListViewItem(UMLListView * parent);
116 explicit UMLListViewItem(UMLListViewItem * parent);
117 UMLListViewItem(UMLListViewItem * parent, const QString &name, ListViewType t, UMLObject* o = 0);
118 UMLListViewItem(UMLListViewItem * parent, const QString &name, ListViewType t, Uml::ID::Type id);
119 ~UMLListViewItem();
120
121 ListViewType type() const;
122
123 void setID(Uml::ID::Type id);
124 Uml::ID::Type ID() const;
125
126 void setUMLObject(UMLObject * obj);
127 UMLObject * umlObject() const;
128
129 bool isOwnParent(Uml::ID::Type listViewItemID);
130
131 void updateObject();
132 void updateFolder();
133
134 void setText(int column, const QString &text);
135 void setText(const QString &text);
136 QString getSavedText() const;
137 void setVisible(bool state);
138
139 QString toolTip();
140
141 void setIcon(Icon_Utils::IconType iconType);
142
143 void addChildItem(UMLObject *child, UMLListViewItem *childItem);
144
145 void deleteChildItem(UMLObject *child);
146
147 //virtual int compare(UMLListViewItem *other, int col, bool ascending) const;
148
149 UMLListViewItem* deepCopy(UMLListViewItem *newParent);
150
151 UMLListViewItem* findUMLObject(const UMLObject *o);
152 UMLListViewItem* findChildObject(UMLObject *child);
153 UMLListViewItem* findItem(Uml::ID::Type id);
154
155 UMLListViewItem* childItem(int i);
156
157 void saveToXMI1(QXmlStreamWriter& writer);
158 bool loadFromXMI1(QDomElement& qElement);
159
160 bool isOpen() { return isExpanded(); }
161 void setOpen(bool state);
162
163 public slots:
164 void slotEditFinished(const QString &newText);
165
166 protected:
167 void init();
168
169 void cancelRenameWithMsg();
170
177 typedef QMap<UMLObject*, UMLListViewItem*> ChildObjectMap;
178
179 ListViewType m_type;
180 Uml::ID::Type m_id;
181 QPointer<UMLObject> m_object;
182 QString m_label;
183 ChildObjectMap m_comap;
184
185 };
186
187 QDebug operator<<(QDebug dbg, const UMLListViewItem& item);
188
189 #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:41
UMLListViewItem::updateFolder
void updateFolder()
Definition: umllistviewitem.cpp:430
UMLListViewItem::deepCopy
UMLListViewItem * deepCopy(UMLListViewItem *newParent)
Definition: umllistviewitem.cpp:827
UMLListViewItem::m_type
ListViewType m_type
Definition: umllistviewitem.h:179
UMLListViewItem::setUMLObject
void setUMLObject(UMLObject *obj)
Definition: umllistviewitem.cpp:310
UMLListViewItem::toolTip
QString toolTip()
Definition: umllistviewitem.cpp:203
UMLListViewItem::m_label
QString m_label
Definition: umllistviewitem.h:182
UMLListViewItem::findUMLObject
UMLListViewItem * findUMLObject(const UMLObject *o)
Definition: umllistviewitem.cpp:849
UMLListViewItem::umlObject
UMLObject * umlObject() const
Definition: umllistviewitem.cpp:320
UMLListViewItem::getSavedText
QString getSavedText() const
Definition: umllistviewitem.cpp:472
UMLListViewItem::slotEditFinished
void slotEditFinished(const QString &newText)
Definition: umllistviewitem.cpp:491
UMLListViewItem::m_comap
ChildObjectMap m_comap
Definition: umllistviewitem.h:183
UMLListViewItem::loadFromXMI1
bool loadFromXMI1(QDomElement &qElement)
Definition: umllistviewitem.cpp:943
UMLListViewItem::cancelRenameWithMsg
void cancelRenameWithMsg()
Definition: umllistviewitem.cpp:719
UMLListViewItem::toString
static QString toString(ListViewType type)
Definition: umllistviewitem.cpp:973
UMLListViewItem::isOpen
bool isOpen()
Definition: umllistviewitem.h:160
UMLListViewItem::setText
void setText(int column, const QString &text)
Definition: umllistviewitem.cpp:463
UMLListViewItem::ID
Uml::ID::Type ID() const
Definition: umllistviewitem.cpp:279
UMLListViewItem::m_id
Uml::ID::Type m_id
Definition: umllistviewitem.h:180
UMLListViewItem::saveToXMI1
void saveToXMI1(QXmlStreamWriter &writer)
Definition: umllistviewitem.cpp:902
UMLListViewItem::ListViewType
ListViewType
Definition: umllistviewitem.h:44
UMLListViewItem::lvt_Logical_Folder
@ lvt_Logical_Folder
Definition: umllistviewitem.h:51
UMLListViewItem::lvt_UseCase_Folder
@ lvt_UseCase_Folder
Definition: umllistviewitem.h:52
UMLListViewItem::lvt_Association
@ lvt_Association
Definition: umllistviewitem.h:103
UMLListViewItem::lvt_View
@ lvt_View
Definition: umllistviewitem.h:48
UMLListViewItem::lvt_Deployment_View
@ lvt_Deployment_View
Definition: umllistviewitem.h:75
UMLListViewItem::lvt_Actor
@ lvt_Actor
Definition: umllistviewitem.h:59
UMLListViewItem::lvt_State_Diagram
@ lvt_State_Diagram
Definition: umllistviewitem.h:56
UMLListViewItem::lvt_Node
@ lvt_Node
Definition: umllistviewitem.h:76
UMLListViewItem::lvt_Component_View
@ lvt_Component_View
Definition: umllistviewitem.h:69
UMLListViewItem::lvt_Properties_UserInterface
@ lvt_Properties_UserInterface
Definition: umllistviewitem.h:102
UMLListViewItem::lvt_Collaboration_Diagram
@ lvt_Collaboration_Diagram
Definition: umllistviewitem.h:54
UMLListViewItem::lvt_Properties_Font
@ lvt_Properties_Font
Definition: umllistviewitem.h:100
UMLListViewItem::lvt_Deployment_Folder
@ lvt_Deployment_Folder
Definition: umllistviewitem.h:74
UMLListViewItem::lvt_Max
@ lvt_Max
Definition: umllistviewitem.h:108
UMLListViewItem::lvt_Operation
@ lvt_Operation
Definition: umllistviewitem.h:63
UMLListViewItem::lvt_Entity
@ lvt_Entity
Definition: umllistviewitem.h:80
UMLListViewItem::lvt_Class
@ lvt_Class
Definition: umllistviewitem.h:61
UMLListViewItem::lvt_EntityRelationship_Diagram
@ lvt_EntityRelationship_Diagram
Definition: umllistviewitem.h:82
UMLListViewItem::lvt_PrimaryKeyConstraint
@ lvt_PrimaryKeyConstraint
Definition: umllistviewitem.h:89
UMLListViewItem::lvt_Component
@ lvt_Component
Definition: umllistviewitem.h:70
UMLListViewItem::lvt_Properties_CodeImport
@ lvt_Properties_CodeImport
Definition: umllistviewitem.h:98
UMLListViewItem::lvt_Deployment_Diagram
@ lvt_Deployment_Diagram
Definition: umllistviewitem.h:73
UMLListViewItem::lvt_Diagrams
@ lvt_Diagrams
Definition: umllistviewitem.h:71
UMLListViewItem::lvt_Enum
@ lvt_Enum
Definition: umllistviewitem.h:79
UMLListViewItem::lvt_ForeignKeyConstraint
@ lvt_ForeignKeyConstraint
Definition: umllistviewitem.h:90
UMLListViewItem::lvt_UseCase_View
@ lvt_UseCase_View
Definition: umllistviewitem.h:50
UMLListViewItem::lvt_Properties
@ lvt_Properties
Definition: umllistviewitem.h:94
UMLListViewItem::lvt_Logical_View
@ lvt_Logical_View
Definition: umllistviewitem.h:49
UMLListViewItem::lvt_Component_Folder
@ lvt_Component_Folder
Definition: umllistviewitem.h:68
UMLListViewItem::lvt_Datatype_Folder
@ lvt_Datatype_Folder
Definition: umllistviewitem.h:78
UMLListViewItem::lvt_Properties_AutoLayout
@ lvt_Properties_AutoLayout
Definition: umllistviewitem.h:95
UMLListViewItem::lvt_Properties_CodeGeneration
@ lvt_Properties_CodeGeneration
Definition: umllistviewitem.h:97
UMLListViewItem::lvt_UseCase
@ lvt_UseCase
Definition: umllistviewitem.h:60
UMLListViewItem::lvt_Datatype
@ lvt_Datatype
Definition: umllistviewitem.h:77
UMLListViewItem::lvt_Object_Diagram
@ lvt_Object_Diagram
Definition: umllistviewitem.h:104
UMLListViewItem::lvt_UniqueConstraint
@ lvt_UniqueConstraint
Definition: umllistviewitem.h:88
UMLListViewItem::lvt_EntityRelationship_Model
@ lvt_EntityRelationship_Model
Definition: umllistviewitem.h:84
UMLListViewItem::lvt_EnumLiteral
@ lvt_EnumLiteral
Definition: umllistviewitem.h:87
UMLListViewItem::lvt_Instance
@ lvt_Instance
Definition: umllistviewitem.h:105
UMLListViewItem::lvt_Interface
@ lvt_Interface
Definition: umllistviewitem.h:65
UMLListViewItem::lvt_Activity_Diagram
@ lvt_Activity_Diagram
Definition: umllistviewitem.h:57
UMLListViewItem::lvt_EntityRelationship_Folder
@ lvt_EntityRelationship_Folder
Definition: umllistviewitem.h:83
UMLListViewItem::lvt_InstanceAttribute
@ lvt_InstanceAttribute
Definition: umllistviewitem.h:106
UMLListViewItem::lvt_Properties_Class
@ lvt_Properties_Class
Definition: umllistviewitem.h:96
UMLListViewItem::lvt_Min
@ lvt_Min
Definition: umllistviewitem.h:47
UMLListViewItem::lvt_Attribute
@ lvt_Attribute
Definition: umllistviewitem.h:62
UMLListViewItem::lvt_Category
@ lvt_Category
Definition: umllistviewitem.h:92
UMLListViewItem::lvt_EntityAttribute
@ lvt_EntityAttribute
Definition: umllistviewitem.h:81
UMLListViewItem::lvt_Unknown
@ lvt_Unknown
Definition: umllistviewitem.h:109
UMLListViewItem::lvt_Model
@ lvt_Model
Definition: umllistviewitem.h:86
UMLListViewItem::lvt_Template
@ lvt_Template
Definition: umllistviewitem.h:64
UMLListViewItem::lvt_Port
@ lvt_Port
Definition: umllistviewitem.h:93
UMLListViewItem::lvt_Component_Diagram
@ lvt_Component_Diagram
Definition: umllistviewitem.h:67
UMLListViewItem::lvt_UseCase_Diagram
@ lvt_UseCase_Diagram
Definition: umllistviewitem.h:53
UMLListViewItem::lvt_Properties_General
@ lvt_Properties_General
Definition: umllistviewitem.h:101
UMLListViewItem::lvt_Subsystem
@ lvt_Subsystem
Definition: umllistviewitem.h:85
UMLListViewItem::lvt_Artifact
@ lvt_Artifact
Definition: umllistviewitem.h:72
UMLListViewItem::lvt_CheckConstraint
@ lvt_CheckConstraint
Definition: umllistviewitem.h:91
UMLListViewItem::lvt_Sequence_Diagram
@ lvt_Sequence_Diagram
Definition: umllistviewitem.h:58
UMLListViewItem::lvt_Class_Diagram
@ lvt_Class_Diagram
Definition: umllistviewitem.h:55
UMLListViewItem::lvt_Package
@ lvt_Package
Definition: umllistviewitem.h:66
UMLListViewItem::lvt_Properties_CodeViewer
@ lvt_Properties_CodeViewer
Definition: umllistviewitem.h:99
UMLListViewItem::m_object
QPointer< UMLObject > m_object
Definition: umllistviewitem.h:181
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:60
UMLListViewItem::setID
void setID(Uml::ID::Type id)
Definition: umllistviewitem.cpp:293
UMLListViewItem::init
void init()
Definition: umllistviewitem.cpp:192
UMLListViewItem::findChildObject
UMLListViewItem * findChildObject(UMLObject *child)
Definition: umllistviewitem.cpp:867
UMLListViewItem::ChildObjectMap
QMap< UMLObject *, UMLListViewItem * > ChildObjectMap
Definition: umllistviewitem.h:177
UMLListViewItem::updateObject
void updateObject()
Definition: umllistviewitem.cpp:347
UMLListViewItem::setVisible
void setVisible(bool state)
Definition: umllistviewitem.cpp:269
UMLListViewItem::setIcon
void setIcon(Icon_Utils::IconType iconType)
Definition: umllistviewitem.cpp:480
UMLListViewItem::addChildItem
void addChildItem(UMLObject *child, UMLListViewItem *childItem)
Definition: umllistviewitem.cpp:242
UMLListViewItem::setOpen
void setOpen(bool state)
Definition: umllistviewitem.cpp:446
UMLListViewItem::findItem
UMLListViewItem * findItem(Uml::ID::Type id)
Definition: umllistviewitem.cpp:884
UMLListViewItem::childItem
UMLListViewItem * childItem(int i)
Definition: umllistviewitem.cpp:968
UMLListViewItem::~UMLListViewItem
~UMLListViewItem()
Definition: umllistviewitem.cpp:185
UMLListViewItem::isOwnParent
bool isOwnParent(Uml::ID::Type listViewItemID)
Definition: umllistviewitem.cpp:329
UMLListViewItem::deleteChildItem
void deleteChildItem(UMLObject *child)
Definition: umllistviewitem.cpp:254
UMLListView
Displays the list view for the program.
Definition: umllistview.h:48
UMLObject
The base class for UML objects.
Definition: umlobject.h:75
icon_utils.h
Icon_Utils::IconType
IconType
Definition: icon_utils.h:47
Model_Utils::newText
QString newText(UMLObject::ObjectType type)
Definition: model_utils.cpp:625
Uml::ID::Type
std::string Type
Definition: basictypes.h:385
operator<<
QDebug operator<<(QDebug dbg, const UMLListViewItem &item)
Definition: umllistviewitem.cpp:1088
UMLListViewItemIterator
QTreeWidgetItemIterator UMLListViewItemIterator
Definition: umllistviewitem.h:27