Java Reference
In-Depth Information
impose further constraints on a connection's bounds. Connections are typically
managed by a single router instance and reside in a ConnectionLayer .
Anchors are used to place connection endpoints in either a fixed position or
a calculated position related to some figure. For example, the ChopboxAnchor
determines the point at which the bounds of a figure are intersected by the line
traveling from some reference point to the center of the figure, as seen in
Figure 9-7.
Reference
Owner Figure
Anchor Location
Center
Figure 9-7
Chopbox anchor
Connections can have end decorations, such as arrowheads or labels. A
DelegatingLayout is used to determine the placement of these decorations by
delegating to a Locator . When adding a rotatable PolygonDecoration or
label at the end of a polyline connection, its bounds are extended to allow these
elements to be painted in addition to the line itself.
Connections affect layout because routing must occur before children can be
placed. When validating a connection, a layout algorithm must remember its old
bounds when determining the new, and invalidate the appropriate region in the
update manager. Fortunately, the default implementation does this for you.
9.1.6 Coordinate Systems
Draw2d has two coordinate systems to consider: absolute (inherited) and relative
(local). In the absolute situation (the default), figures can be compared with one
another because they all use the same system. It's “inherited” in the sense that
when a figure is moved, the children coordinates must be translated by the same
amount. In the relative (local) situation, coordinates are relative to the bounds
area of the parent, except for when the parent has insets. To use local coordi-
nates, the parent overrides useLocalCoordinates() for its children.
Table 9-1, from Draw2d, includes reasons you might choose to use local or
absolute coordinates.
 
Search WWH ::




Custom Search