2020-04-10 00:03:55 +03:00
header
from typing import TYPE_CHECKING
from gaphor.core.modeling.element import Element
if TYPE_CHECKING:
2020-09-01 22:54:23 +03:00
from gaphor.UML import Dependency, Namespace, Package
2020-04-10 00:03:55 +03:00
%%
override Element
# defined above
%%
override NamedElement
# Define extra attributes defined in UML model
class NamedElement(Element):
name: attribute[str]
qualifiedName: derived[List[str]]
2020-08-18 12:15:34 +03:00
visibility: enumeration
2020-04-10 00:03:55 +03:00
namespace: relation_one[Namespace]
clientDependency: relation_many[Dependency]
supplierDependency: relation_many[Dependency]
2020-08-18 22:26:53 +03:00
memberNamespace: relation_many[Namespace]
2020-04-10 00:03:55 +03:00
%%
override NamedElement.qualifiedName(NamedElement.namespace): derived[List[str]]
def _namedelement_qualifiedname(self) -> List[str]:
2020-10-07 09:45:40 +03:00
"""Returns the qualified name of the element as a tuple."""
2020-04-10 00:03:55 +03:00
if self.namespace:
return _namedelement_qualifiedname(self.namespace) + [self.name]
else:
return [self.name]
NamedElement.qualifiedName = derived(
"qualifiedName",
List[str],
0,
1,
lambda obj: [_namedelement_qualifiedname(obj)],
)
%%
2020-09-01 22:54:23 +03:00
override PackageableElement
class PackageableElement(NamedElement):
owningPackage: relation_one[Package]
%%
2020-05-30 10:02:58 +03:00
override StyleSheet
2020-05-26 20:25:47 +03:00
# defined in gaphor.core.modeling.presentation
%%
2020-05-30 10:02:58 +03:00
override StyleSheet.styleSheet
2020-05-26 20:25:47 +03:00
# defined in gaphor.core.modeling.presentation
%%
2020-04-10 00:03:55 +03:00
override Presentation
# defined in gaphor.core.modeling.presentation
%%
override Element.presentation
# defined in gaphor.core.modeling.presentation
%%
2020-12-22 19:03:26 +03:00
override Presentation.diagram
# defined in gaphor.core.modeling.presentation
%%
2020-04-10 00:03:55 +03:00
override Presentation.subject
# defined in gaphor.core.modeling.presentation
%%
2020-12-22 19:03:26 +03:00
override Presentation.parent
# defined in gaphor.core.modeling.presentation
%%
override Presentation.children
# defined in gaphor.core.modeling.presentation
%%
2020-04-10 00:03:55 +03:00
override Diagram
# defined in gaphor.core.modeling.diagram
2020-12-22 19:03:26 +03:00
%%
override Diagram.ownedPresentation
# defined in gaphor.core.modeling.presentation