GMF MapModel is a model combining GMF GraphModel, GMF ToolModel and domain Ecore model all together and finally describing diagram editor. Composed instance of this model should be transformed into GMF GenModel prior to diagram code generation.
There are two types of link mappings:
- Type based links
- Reference based links
The first type is used when particular EClass is specified and creation of such link in runtime means creation of this EClass instance. When EClass is not specified then this is the second type of link mapping; creation of such link in runtime means setting the specified reference value.
Type Based Links
Mapping property 'domainMetaElement' specifies EClass (type) of the link. If 'sourceMetaFeature' property is not specified then 'containmentFeature' is used to denote link source (iow link container is it's source). If 'sourceMetaFeature' is specified then it should be a EReference defined within link EClass and it's value is the link source. Property 'linkMetaFeature' must always be specified and it references link target.
Reference Based Links
Properties 'domainMetaElement' and 'sourceMetaFeature' should not be specified. Property 'linkMetaFeature' is an EReference; EClass that contains it is a link source and EReference type is a link target.
Nodes and links may have arbitrary number of labels. Toolsmith may specify EAttribute or a number of EAttributes that label represents on diagram (label features) and in this case parser will be generated that constructs label text from attribute value(s) and parses text entered by user in new attribute value(s). If attributes are not specified ('features' property) then no parser is generated so toolsmith should provide handwritten parser implementation.
Generated parsers use java.text.MessageFormat class. This class requires a pattern string and a number of objects to produce label text; in our case pattern string is defined by 'viewPattern' property and the objects are values of label features (order is important). When user types in some text using direct editing facility it is passed to the parser and it uses 'editPattern' string to extract a set of objects that will be new label features values.
It is also possible to store label text in notation model. Such labels have DescriptionStyle in notation model and label text is stored in 'description' feature. In this case label features should not be specified and in GMF GenModel for GenLabel toolsmith should create DesignLabelModelFacet. When diagram editor is defined without domain model all labels in GMF GenModel receive DesignLabelModelFacet by default (during transformation stage). Since java.text.MessageFormat is not used properties 'viewPattern' and 'editPattern' are ignored and user may enter arbitrary text.