Java Reference
In-Depth Information
Figure 11-13
Side-affixed node
Looking at the generated code, you'll find that the edit part for the parent
rectangle extends AbstractBorderedShapeEditPart and installs
BorderItemSelectionEditPolicy on its child to restrict movement around
the border. The port edit part extends AbstractBorderItemEditPart and
installs a NonResizableEditPolicy , so it's not necessary to set Max / Min /
Preferred dimensions on the figure. Note that this approach applies to exter-
nal labels as well.
11.3.6 Link Mapping
To m a p a Connection from the graphical definition to a domain model and
palette creation tool, use the Link Mapping element. Four major use cases are
supported for link mappings: design links, domain element references, links rep-
resenting domain class elements, and phantom node links.
Note that it's possible to create links that do not map to domain elements,
so-called design links. In this case, simply select a palette tool and diagram link,
leaving all properties for the domain empty. Links created this way can be made
between all top-level nodes on the diagram, although they represent no domain
model information.
Links create connections between elements on the diagram and can represent
several types of reference relationships found in a domain model. Regular refer-
ences are the most typical use for links on a diagram and are the most straight-
forward to implement. Links can also represent full-fledged domain ( EClass )
elements, with source and target references. As mentioned already, containment
references can be represented using links to top-level nodes on a diagram using
the “phantom node” concept. We explore each of these in turn here.
In the case of a normal EReference between two elements, a link mapping
simply requires specifying the target. Consider the following example, where
Topic is linked to itself by a normal (noncontainment) subtopics reference, as
seen in Figure 11-14. To create a link mapping to represent this relationship as a
connection between two nodes on a diagram, the mapping properties are as indi-
cated. The only property in the Domain Meta Information category that
needs to be set is the Target Feature . The generator and runtime can infer the
appropriate node types that are valid by specifying only this property.
 
Search WWH ::




Custom Search