Java Reference
In-Depth Information
Figure 11-10
Requirements model
Table 11-6
Link Mapping
Element
Property
Value
Mapping
Link Mapping
Target Feature
children : Requirement
Diagram Link
Connection RequirementChild
Tool
Creation Tool Child Requirement
On our diagram, we want to display RequirementGroup elements both as
root elements on the diagram and as children elements, whereby a link indicates
the containment of these elements in a RequirementGroup instance, not the
Model instance representing the canvas. The problem is, because both are of the
same type, the generated code from the GMF tooling cannot determine the
proper node to use, particularly when initializing a diagram from an existing
domain instance without a tip. To provide the tip, we can add a constraint to our
root RequirementGroup node definition to check that its eOpposite parent is
null ; only root elements won't have a parent reference. In OCL, this would be
parent.oclIsUndefined() .
In summary, a Toolsmith must be aware of how elements are created and
their storage within domain model instances when creating diagram mapping
definitions. Phantom nodes provide a solution when we do not want to represent
a containment relationship in a domain model as a containment representation
on a diagram. Inner nodes and compartments provide a straightforward way to
represent contained elements on a diagram, but can we indicate noncontainment
references in a domain model using these containment visual representations?
It's possible, but it requires some code modification. To store a child diagram ele-
ment in a separate model container, locate the generated xxxCreateCommand.
doDefaultElementCreation() method and modify it so that the newly
created element is stored in an appropriate place in the domain model, along
 
Search WWH ::




Custom Search