Java Reference
In-Depth Information
} else {
return false;
}
IAdaptable layoutHint = ((ILayoutNodeOperation)
operation).getLayoutHint();
String layoutType = (String) layoutHint.getAdapter(String. class );
return LayoutType.DEFAULT.equals(layoutType);
}
}
As you can see, our default provider simply extends the runtime-provided
LeftRightProvider and only needs to override the provides() method to
enable our provider for mindmap diagrams. We'll further modify this provider
later to get the layout we want, but for now, this is all we need to get started.
Besides the need to provide both left-to-right and right-to-left layout of topics
about a centered root, we want to ignore dependency links when performing a
layout. More specifically, we want to lay out topics in a tree structure while
arranging relationship links to avoid topics; relationship links will be optionally
hidden and should not be considered during main layout.
When deployed, this provider replaces the default layout provider that the
menu item and toolbar invoke. Section 4.3.5, “Subtopic Figure,” explores what
is required to programmatically invoke layout on a diagram as we create
subtopics using a keyboard shortcut.
Subtopic Figure
For our notation, we want root Topic elements to be displayed with a rounded
rectangle, and subtopic elements to be displayed with a single underline. Our
domain model has no notion of distinct Topic and subtopic elements, so this
means we end up with two figures for the Topic element that will change
depending on the structure of the elements. Furthermore, we might decide that
n -level subtopic elements should have yet another notation, so we focus on a
solution that is general. Currently, the models of GMF cannot handle this type
of definition, whereby a different figure represents a domain element based on its
state. This is a planned enhancement for GMF, but in the meantime, we begin by
adding a new subtopic figure.
The subtopic figure is a rectangle with only the bottom border drawn,
thereby appearing as an underline for our subtopic name. The makeup of this fig-
ure is somewhat complicated. Table 4-7 details our subtopic figure and node
properties. Note the use of CustomBorder , which uses a provided runtime
figure.
Search WWH ::




Custom Search