Java Reference
In-Depth Information
or
(oppositeEnd.oclIsTypeOf(dnc::Thing) and self.oclIsTypeOf(dnc::Thing))
or
(oppositeEnd.oclIsTypeOf(dnc::Description) and
self.oclIsTypeOf(dnc::Description)))
The Link Constraint s provide some important functionality to our link
and to the Practitioner's usability of our diagram. The first constraint allows only
a generalization link to be drawn from an archetype that does not yet have a
superclass. In this manner, we restrict the underlying metamodel to just one
superclass. Also, we prohibit cyclic inheritance by applying a target end con-
straint that checks to see if the oppositeEnd of the link contains the source in its
superclasses list. With that, we disallow generalization to one's self. Finally, we
prevent generalization relationships between archetypes of different types. In this
approach to domain modeling, generalization is rarely used, and it doesn't make
sense to inherit from one type of archetype to another.
4.6.4 Generation
At this point, we're ready to transform our mapping model into the generator
model. Do this as before using the provided right-click menu action and corre-
sponding wizard. If you find that the wizard cannot locate the dnc.genmodel
file, use the Find in Workspace feature to locate the model and continue. Open
the produced dnc.gmfgen model in the editor and change the Same File for
Diagram and Model property to true , and change the Diagram File
Extension property to dnc . Because our diagram allows for the creation of par-
titions to represent packages, it might be convenient to add shortcuts from arche-
types in one package to another. Add the string dnc to the Contains
Shortcuts To property in the Diagram category of the Gen Diagram element
to provide shortcut support. Now we can run the diagram using our same launch
configuration as before. Using the generated wizard, create a new DNC diagram
and test its functionality. There's no color yet, but all the elements should func-
tion. Notice that you cannot specify a data type for attributes at this time with
the in-place editor. We address how this is done later when we add a custom
parser for attributes in Section 4.6.7, “Custom Parsers.”
4.6.5 Gradient Figures
Our archetypes don't currently have any color, which is their most significant
attribute. Instead of simply filling in each archetype with a background color, we
use a gradient effect. GEF enables you to add a gradient to a figure but does not
Search WWH ::




Custom Search