Java Reference
In-Depth Information
the result of a snag with applying gradients (discussed in Section 4.6.5,
“Gradient Figures”). Note that we have defined ListItemLabel with an Inset
element that keeps our attribute and operation compartment list items from
aligning too close to the edge of the outer rectangle. We've done similarly in the
outer rectangle, adding an Inset to keep the lowermost operation from being too
close to the bottom of the rounded rectangle. Also note that our ListItem
Diagram Label element has no Accessor selected, leaving its External
attribute as true . Unlike other labels within nodes, selecting the
BasicRectangle as the Diagram Label figure and adding a child accessor to
the ListItemLabel Figure Descriptor causes the generated compartment
to not function properly.
TIP
Compartments require the proper layout in the parent figure in order to
look correct.The parent figure should use a Flow Layout with vertical ori-
entation and force a single line option if the compartments are to be as
typically seen in UML Class nodes.
Also note our use of GridLayout and GridDataLayout elements through-
out. These let us accomplish the layout of our archetype name and its stereotype
label so that they remain centered in our rectangle. Our compartments for attrib-
utes and labels use basic rectangle figures. Note that we don't bother setting their
fill and outline properties to false because compartment figures defined will
generate an extension of the runtime's ResizableCompartmentFigure that
takes care of rendering compartments properly. The EditPart generated will
extend ListCompartmentEditPart , and the attribute and operation labels
within these compartments will implement CompartmentEditPart , using
WrappingLabel for the figure. Taking advantage of the runtime's compartment
support saves us some work because it provides proper layout, collapse, expand,
and filtering functionality.
We also define a package figure and node, which is similar to the Archetype
figure, aside from the fact that it uses a regular outer Rectangle and not a
RoundedRectangle . Also, we'll later map only one compartment to our pack-
age figure, to list subpackages. Because we have so much potential duplication in
defining this figure, we turn to the Figure Ref element to avoid redundancy, as
shown in Table 4-33.
 
Search WWH ::




Custom Search