Java Reference
In-Depth Information
Compartments
A
Compartment
is defined as a diagram element, although it is always contained
within another element, unlike connections, nodes, and (external) labels.
Additional properties available for compartments are
Accessor
,
Collapsible
,
and
Needs Title
.
Collapsible
is a Boolean property that determines whether the compart-
ment will have a handle that, when clicked, collapses and expands the compart-
ment. The
Needs Title
property determines whether a string label is placed
above the compartment. The title given to the compartment is the name of the
Compartment
element itself, but you can change this in the generator model.
An important aspect of using compartments is to set the proper layout on the
container. It's best to specify a
Flow Layout
using
CENTER
alignment, Vertical
orientation, and
Force Single Line
equal to
true
for compartments that
have list items. Of course, it's possible not to define a layout at all, as it is possi-
ble to use just a labeled container as the compartment figure.
TIP
Keep in mind a couple things when dealing with collapsible compartments.
First, the default size facet mentioned earlier helps keep a reasonable
shrunken size of your node because one or two items added to a list in a
compartment won't likely stretch the node beyond the default 40
×
40 size
of a node plate. In this case, collapsing the compartment hides the list
items, but the node itself does not shrink, as you might expect. Setting the
default size facet to, say, 40
×
15 gives you the desired effect. Second, recall
that, when manually resized, a node no longer collapses down, but it
respects the sizing the user selected. To restore the node to autosizing,
select it and use the Auto Size button on the diagram's main toolbar.
The Tooling model is one of GMF's simplest models, mainly because it is not yet
complete. Primarily, the tooling model defines a diagram's palette—that is, the
creation tools for creating nodes and links.
At the root of a tooling definition model is the
Tool Registry
. This ele-
ment contains the
Palette
and any number of
Menu
s and shared
Action
elements. At this time, GMF generates only code for
Palette
elements. The
remaining elements are left to future versions of GMF.
Search WWH ::
Custom Search