Add a "note" field to Element

This can be used for arbitrary notes taken by the user.
This commit is contained in:
Arjan Molenaar 2021-06-15 21:50:27 +02:00
parent 50af854e46
commit eda0c7d4fe
No known key found for this signature in database
GPG Key ID: BF977B918996CB13
3 changed files with 61 additions and 44 deletions

View File

@ -31,6 +31,7 @@ class Comment(Element):
# defined in gaphor.core.modeling.presentation
Element.note = attribute("note", str)
Diagram.name = attribute("name", str)
Comment.body = attribute("body", str)
# 12: override StyleSheet.styleSheet

View File

@ -11,7 +11,12 @@ from typing import TYPE_CHECKING, Callable, Iterator, Optional, Type, TypeVar, o
from typing_extensions import Protocol
from gaphor.core.modeling.event import ElementUpdated
from gaphor.core.modeling.properties import relation_many, relation_one, umlproperty
from gaphor.core.modeling.properties import (
attribute,
relation_many,
relation_one,
umlproperty,
)
if TYPE_CHECKING:
from gaphor.core.modeling.coremodel import Comment
@ -37,6 +42,7 @@ Id = str
class Element:
"""Base class for all model data classes."""
note: attribute[str]
appliedStereotype: relation_many[Element]
comment: relation_many[Comment]
directedRelationship: relation_many[Presentation]

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<gaphor xmlns="http://gaphor.sourceforge.net/model" version="3.0" gaphor-version="2.4.1">
<gaphor xmlns="http://gaphor.sourceforge.net/model" version="3.0" gaphor-version="2.5.0">
<Package id="3867dda4-7a95-11ea-a112-7f953848cf85">
<name>
<val>Core</val>
@ -23,6 +23,9 @@
</ownedType>
</Package>
<Diagram id="3867dda5-7a95-11ea-a112-7f953848cf85">
<element>
<ref refid="3867dda4-7a95-11ea-a112-7f953848cf85"/>
</element>
<name>
<val>main</val>
</name>
@ -48,11 +51,8 @@
<ref refid="1cb6f4e2-b9a9-11eb-93ad-535118859f0b"/>
</reflist>
</ownedPresentation>
<package>
<ref refid="3867dda4-7a95-11ea-a112-7f953848cf85"/>
</package>
<canvas>
<item id="4cda498f-7a95-11ea-a112-7f953848cf85" type="ClassItem">
</Diagram>
<ClassItem id="4cda498f-7a95-11ea-a112-7f953848cf85">
<matrix>
<val>(1.0, 0.0, 0.0, 1.0, 495.59873557593505, 36.538360595703125)</val>
</matrix>
@ -71,8 +71,8 @@
<subject>
<ref refid="4cda498e-7a95-11ea-a112-7f953848cf85"/>
</subject>
</item>
<item id="5cdae47f-7a95-11ea-a112-7f953848cf85" type="ClassItem">
</ClassItem>
<ClassItem id="5cdae47f-7a95-11ea-a112-7f953848cf85">
<matrix>
<val>(1.0, 0.0, 0.0, 1.0, 560.8694152832031, 521.4187622070312)</val>
</matrix>
@ -91,8 +91,8 @@
<subject>
<ref refid="5cdae47e-7a95-11ea-a112-7f953848cf85"/>
</subject>
</item>
<item id="639b48d1-7a95-11ea-a112-7f953848cf85" type="ClassItem">
</ClassItem>
<ClassItem id="639b48d1-7a95-11ea-a112-7f953848cf85">
<matrix>
<val>(1.0, 0.0, 0.0, 1.0, 221.6815955120582, 389.32879638671875)</val>
</matrix>
@ -111,8 +111,8 @@
<subject>
<ref refid="639b48d0-7a95-11ea-a112-7f953848cf85"/>
</subject>
</item>
<item id="68e63fac-7a95-11ea-a112-7f953848cf85" type="AssociationItem">
</ClassItem>
<AssociationItem id="68e63fac-7a95-11ea-a112-7f953848cf85">
<diagram>
<ref refid="3867dda5-7a95-11ea-a112-7f953848cf85"/>
</diagram>
@ -146,8 +146,8 @@
<tail-connection>
<ref refid="639b48d1-7a95-11ea-a112-7f953848cf85"/>
</tail-connection>
</item>
<item id="1875194e-7a96-11ea-a112-7f953848cf85" type="GeneralizationItem">
</AssociationItem>
<GeneralizationItem id="1875194e-7a96-11ea-a112-7f953848cf85">
<diagram>
<ref refid="3867dda5-7a95-11ea-a112-7f953848cf85"/>
</diagram>
@ -172,8 +172,8 @@
<tail-connection>
<ref refid="5cdae47f-7a95-11ea-a112-7f953848cf85"/>
</tail-connection>
</item>
<item id="c9b0922c-7a97-11ea-a112-7f953848cf85" type="GeneralizationItem">
</GeneralizationItem>
<GeneralizationItem id="c9b0922c-7a97-11ea-a112-7f953848cf85">
<diagram>
<ref refid="3867dda5-7a95-11ea-a112-7f953848cf85"/>
</diagram>
@ -198,8 +198,8 @@
<tail-connection>
<ref refid="639b48d1-7a95-11ea-a112-7f953848cf85"/>
</tail-connection>
</item>
<item id="4b561cdd-7cf9-11ea-b719-1f391582df99" type="GeneralizationItem">
</GeneralizationItem>
<GeneralizationItem id="4b561cdd-7cf9-11ea-b719-1f391582df99">
<diagram>
<ref refid="3867dda5-7a95-11ea-a112-7f953848cf85"/>
</diagram>
@ -224,8 +224,8 @@
<tail-connection>
<ref refid="5175e1cd-7cf9-11ea-b719-1f391582df99"/>
</tail-connection>
</item>
<item id="5175e1cd-7cf9-11ea-b719-1f391582df99" type="ClassItem">
</GeneralizationItem>
<ClassItem id="5175e1cd-7cf9-11ea-b719-1f391582df99">
<matrix>
<val>(1.0, 0.0, 0.0, 1.0, 894.1235656738281, 241.19900512695312)</val>
</matrix>
@ -244,8 +244,8 @@
<subject>
<ref refid="5175e1cc-7cf9-11ea-b719-1f391582df99"/>
</subject>
</item>
<item id="15e4b0b3-9f17-11ea-b537-dfaaecc5bf61" type="ClassItem">
</ClassItem>
<ClassItem id="15e4b0b3-9f17-11ea-b537-dfaaecc5bf61">
<matrix>
<val>(1.0, 0.0, 0.0, 1.0, 772.714640616123, 521.4187622070312)</val>
</matrix>
@ -264,8 +264,8 @@
<subject>
<ref refid="15e4b0b2-9f17-11ea-b537-dfaaecc5bf61"/>
</subject>
</item>
<item id="29de062c-9f17-11ea-b537-dfaaecc5bf61" type="GeneralizationItem">
</ClassItem>
<GeneralizationItem id="29de062c-9f17-11ea-b537-dfaaecc5bf61">
<diagram>
<ref refid="3867dda5-7a95-11ea-a112-7f953848cf85"/>
</diagram>
@ -290,8 +290,8 @@
<tail-connection>
<ref refid="15e4b0b3-9f17-11ea-b537-dfaaecc5bf61"/>
</tail-connection>
</item>
<item id="9bdd3fed-9f17-11ea-b537-dfaaecc5bf61" type="CommentItem">
</GeneralizationItem>
<CommentItem id="9bdd3fed-9f17-11ea-b537-dfaaecc5bf61">
<matrix>
<val>(1.0, 0.0, 0.0, 1.0, 879.1386901855469, 418.12652587890625)</val>
</matrix>
@ -307,8 +307,8 @@
<subject>
<ref refid="9bdd3fec-9f17-11ea-b537-dfaaecc5bf61"/>
</subject>
</item>
<item id="ada170c7-9f17-11ea-b537-dfaaecc5bf61" type="CommentLineItem">
</CommentItem>
<CommentLineItem id="ada170c7-9f17-11ea-b537-dfaaecc5bf61">
<diagram>
<ref refid="3867dda5-7a95-11ea-a112-7f953848cf85"/>
</diagram>
@ -330,8 +330,8 @@
<tail-connection>
<ref refid="9bdd3fed-9f17-11ea-b537-dfaaecc5bf61"/>
</tail-connection>
</item>
<item id="cf596824-e0b9-11ea-b7ab-f5b4c130f24e" type="AssociationItem">
</CommentLineItem>
<AssociationItem id="cf596824-e0b9-11ea-b7ab-f5b4c130f24e">
<diagram>
<ref refid="3867dda5-7a95-11ea-a112-7f953848cf85"/>
</diagram>
@ -365,8 +365,8 @@
<tail-connection>
<ref refid="5175e1cd-7cf9-11ea-b719-1f391582df99"/>
</tail-connection>
</item>
<item id="216581ca-4465-11eb-8946-9bdfa28f7a50" type="AssociationItem">
</AssociationItem>
<AssociationItem id="216581ca-4465-11eb-8946-9bdfa28f7a50">
<diagram>
<ref refid="3867dda5-7a95-11ea-a112-7f953848cf85"/>
</diagram>
@ -400,8 +400,8 @@
<tail-connection>
<ref refid="5cdae47f-7a95-11ea-a112-7f953848cf85"/>
</tail-connection>
</item>
<item id="446a3744-4465-11eb-8946-9bdfa28f7a50" type="AssociationItem">
</AssociationItem>
<AssociationItem id="446a3744-4465-11eb-8946-9bdfa28f7a50">
<diagram>
<ref refid="3867dda5-7a95-11ea-a112-7f953848cf85"/>
</diagram>
@ -435,8 +435,8 @@
<tail-connection>
<ref refid="639b48d1-7a95-11ea-a112-7f953848cf85"/>
</tail-connection>
</item>
<item id="d6e5886b-478f-11eb-a938-8fcfae32d12c" type="CommentItem">
</AssociationItem>
<CommentItem id="d6e5886b-478f-11eb-a938-8fcfae32d12c">
<matrix>
<val>(1.0, 0.0, 0.0, 1.0, 456.234375, 311.32879638671875)</val>
</matrix>
@ -452,8 +452,8 @@
<subject>
<ref refid="d6e5886a-478f-11eb-a938-8fcfae32d12c"/>
</subject>
</item>
<item id="f4982c28-478f-11eb-a938-8fcfae32d12c" type="CommentLineItem">
</CommentItem>
<CommentLineItem id="f4982c28-478f-11eb-a938-8fcfae32d12c">
<diagram>
<ref refid="3867dda5-7a95-11ea-a112-7f953848cf85"/>
</diagram>
@ -475,8 +475,8 @@
<tail-connection>
<ref refid="d6e5886b-478f-11eb-a938-8fcfae32d12c"/>
</tail-connection>
</item>
<item id="1cb6f4e2-b9a9-11eb-93ad-535118859f0b" type="AssociationItem">
</CommentLineItem>
<AssociationItem id="1cb6f4e2-b9a9-11eb-93ad-535118859f0b">
<diagram>
<ref refid="3867dda5-7a95-11ea-a112-7f953848cf85"/>
</diagram>
@ -507,9 +507,7 @@
<tail-connection>
<ref refid="5cdae47f-7a95-11ea-a112-7f953848cf85"/>
</tail-connection>
</item>
</canvas>
</Diagram>
</AssociationItem>
<Class id="4cda498e-7a95-11ea-a112-7f953848cf85">
<isAbstract>
<val>1</val>
@ -522,6 +520,7 @@
<ref refid="d092794e-e0b9-11ea-b7ab-f5b4c130f24e"/>
<ref refid="69c2575a-7a95-11ea-a112-7f953848cf85"/>
<ref refid="1ee6aec6-b9a9-11eb-93ad-535118859f0b"/>
<ref refid="a4c6f704-ce0f-11eb-abe3-018035c40dd4"/>
</reflist>
</ownedAttribute>
<package>
@ -1098,4 +1097,15 @@ diagram {
<val>String</val>
</typeValue>
</Property>
<Property id="a4c6f704-ce0f-11eb-abe3-018035c40dd4">
<class_>
<ref refid="4cda498e-7a95-11ea-a112-7f953848cf85"/>
</class_>
<name>
<val>note</val>
</name>
<typeValue>
<val>str</val>
</typeValue>
</Property>
</gaphor>