Java Reference
In-Depth Information
project uses this feature, as does the Ecore diagram that GMF provides. Both use
cases for using diagram partitioning are covered in Section 4.5.6, “Diagram
Partitioning.”
On the
Canvas
, a number of
Top Node Reference
elements can be added.
The root object of your DSL maps to the
Canvas
, so top nodes on your diagram
typically map to a
Containment Feature
of the root object. This setting tells
the diagram where to store newly created objects to the domain model instance,
but sometimes another feature is used to retrieve children for display. In this case,
the
Children Feature
property is set, although for most models, it's not nec-
essary. In Section 11.3.3, “References, Containment, and Phantom Nodes,” we
discuss how it is also possible to show elements that are not contained in the root
object as top nodes on the
Canvas
, using a concept known as “phantom” nodes
and connectors.
To a
Top Node Reference
,
we can add a
Node Mapping
to define a
domain element, its Node from the graphical definition, and its creation tool
from our palette. You can add several elements to a
Node Mapping
. The most
popular is a
Feature Label Mapping
. With this property, a
Diagram Label
from the graphical definition can be mapped to an attribute (or collection of
attributes) from the domain element specified in the node mapping. An example
in Figure 11-9 from our
dnc.gmfmap
model shows the mapping of our attribute
label.
Figure 11-9
Feature label mapping
In this case, we are using three of our
Attribute
properties from the
domain model:
name
,
lowerBound
, and
upperBound
. We've also specified that,
using the
MESSAGE_FORMAT
method of parsing in-place edits of our label, it
should display the name, a space, and then the lower- and upper-bound proper-
ties in square brackets, separated by a comma. Note that the default values you
Search WWH ::
Custom Search