Package attachlayout
Contains a layout manager and its constraints that allow to organize components
in a container by defining attachments for every side of a component (See
also Sample included).
See:
Description
Interface Summary |
AttachConstants |
Defines and holds constants used with an AttachLayout. |
Class Summary |
AttachLayout |
LayoutManager that allows to organize components
in a container by defining attachments for every side of a component (See
also Sample included).
|
AttachLayout.Constraints |
Defines constraints by specifying an anchor, connection type and offset
for every side of the component to lay out. |
Package attachlayout Description
Contains a layout manager and its constraints that allow to organize components
in a container by defining attachments for every side of a component (See
also Sample included).
An attachment is defined by specifying an anchor, connection type
and offset.
Anchors
Possible anchors are the container's layout borders,
other components in the same container, relative positions (percentages of
container width or height), virtual boxes or no anchor at all.
Container's layout borders as anchor:
The container's layout borders are defined by the edge
of the container minus container insets.
When the TOP side of a component is attached, the anchor will be the
container's top layout border, for the LEFT side the anchor is the
container's left layout border, etc.
Components as anchor:
A component's side can be attached to any side of the same direction
(horizontal or vertical) of any other component in the same container.
A side of the horizontal direction (LEFT or RIGHT) can only be attached to
another component's side of the horizontal direction (LEFT or RIGHT side).
The same principle holds for sides of the vertical direction
(TOP or BOTTOM).
Relative position as anchor:
A relative position is defined as a percentage of the container's
layout area size. The layout area is the area inside the layout borders.
For example, a relative position of 50 for the left side of a component,
will attach the component's left side to the left-right center of the area
in the container's layout borders.
Virtual box as anchor:
It is possible to add virtual boxes to the container's layout. These can be regarded as
components wihtout a visible representation. When a box is added, its position and size is determined by the attachments
defined for that box as if the box where a component.
Added boxes can be used as anchor, similar to using components as anchors.
No anchor:
Not specifying an anchor for a side, allows a component to choose its own
size in the direction of the unattached side.
The component's size will be set to its preferred size in that
direction or to the preferred size specified in the attachment of that
component. The preferred size for a direction (width or height),
if specified in an attachment for a component, always overrules the
component's own preferred size in that direction. Invisible components are
always treated as having a preferred size of 0 in both directions.
Connection types
Two connection types can be set when attached
to an anchor: elastic or fixed. When set to fixed, the specified offset is
interpreted as the exact distance (both minimum and maximum distance)
between the anchor and the attached side. When set to elastic,
the offset is interpreted as the minimum distance between anchor and attached
side.
Offsets
Offsets can be specified depending on the
anchor type: when attached to no anchor, no offset can be set.
The offset is the minimum distance in pixels between the anchor and the
attached component's side. A positive offset always moves a component away
from the anchor, a negative offset moves the component the opposite way.
For example, when attaching a component's left side to another component
(it does not matter to which side, left or right), a positive offset will
move the attached component to the right.
When attaching a component's right side to another component
(left or right side), a positive offset will move the attached component
to the left.
Invisible components are treated as having size and offsets 0 for all sides.
Resizing policy
By cleverly combining different attachments, it is very easy to also
control the resizing policy of every component in both horizontal and
vertical directions individually. See Sample
included for details.
|
Copyright © 2003-2008, Paul Neyens  All Rights Reserved.
|
PREV PACKAGE
NEXT PACKAGE |
FRAMES
NO FRAMES |