Java Reference
In-Depth Information
Now that we've proven that we can quickly create a basic diagram to allow
for graphical editing of our DSL, let's go back and explore in detail more of the
options available using GMF.
BEST PRACTICE
At this point, it's a good idea to consider how to best work with a collec-
tion of GMF models. EMF has no real refactoring support, per se, so it's
important to understand that changes to a model with references to
another won't be propagated as you might expect. However, EMF does
allow you to work on several models within a single resource set, in which
case it does a much nicer job of keeping models in synch. To accomplish
this in GMF, it's best to work within the mapping model editor. This way,
changes to tooling, gmfgraph, the domain, and the mapping model should
not result in broken models because they are all in the same editor and
resource set.
4.3.5 Improving the Mindmap Diagram
So far, we've used the default settings that GMF provides and have established
that everything is working. Now let's go back and refine our models to get closer
to what we want from our mindmap diagram. The label icons are superfluous,
as are the full rectangles for our subtopics, so let's begin by improving our nota-
tion elements and regenerating the diagram. Before completing this section, you
might want to review the GMF tooling models described in Chapter 11.
Updating the Graphical Definition
Using our mapping model editor instance and expanding our
mindmap.
gmfgraph
node, create a new
Figure Descriptor
named
TopicFigure
in
the
Figure Gallery
. To this descriptor, add a child
Rounded Rectangle
named
TopicFigure
. Adjust both the
Corner Height
and
Width
properties
to
15
. Add a
Stack Layout
to the
Rounded Rectangle
to center our label in
the rectangle. Add a child label named
TopicNameFigure
, and to keep the label
from getting too close to our left and right edges, add an
Insets
child to the rec-
tangle and set the
Left
and
Right
properties to
5
. We want to have the default
line color set to blue, but we won't use the
Foreground Color
elements
because we want the default color to be reflected in the diagram preferences.
Search WWH ::
Custom Search