de.winterdrache.layout
Interface MSBLayout.Constraints

All Known Subinterfaces:
MSBLayout.MutableConstraints
All Known Implementing Classes:
MSBLayout.ConstraintsImpl
Enclosing class:
MSBLayout

public static interface MSBLayout.Constraints

Every box in an MSBLayout is associated with a Constraints object that controls the sizing and placement behaviour of the box. The methods MSBLayout.add(Component, Constraints), Container.add(Component, Object), hbox(Constraints) and vbox(Constraints) accept Constraints that will be used for the new box. If you do not use one of these methods, MSBLayout will use a ConstraintsFactory to provide an appropriate Constraints object.

Constraints is a read-only interface. The interface MutableConstraints extends Constraints with the corresponding methods for setting constraints.

A simple implementation of this interface is available as the ConstraintsImpl class.

Author:
Matthias S. Benkmann
See Also:
MSBLayout.ConstraintsImpl, MSBLayout.MutableConstraints

Method Summary
 int bottom()
          Returns the bottom margin which is either a non-negative number of pixels or one of the Gap constants.
 String[] groups()
          Returns the names of all Groups this box is member of.
 float halign()
          Returns the horizontal alignment of this box, i.e. its horizontal placement within the containing parent box.
 int hfill()
          Returns the box's willingness to grow horizontally to fill excess space.
 float hscale()
          A box that is part of a Group with tieWidth() uses the group's tied minimum, preferred and maximum widths multiplied by this factor.
 int hshrink()
          When several sibling boxes are shrunk smaller than their preferred widths because the container is too small, the hshrink() value determines the relative amount that is taken away from a box's width.
 int hweight()
          When several sibling boxes are grown larger than their preferred widths to fill excess space in the containing box, the hweight() value determines the relative amounts of additional width the boxes get.
 int left()
          Returns the left margin which is either a non-negative number of pixels or one of the Gap constants.
 Insets margin()
          Returns the amount of blank space added around the box's content where each of the top, left, bottom and right values is either a non-negative number of pixels or one of the Gap constants.
 Dimension padding()
          Returns an amount of space that is added to the box's minimum, preferred and maximum sizes when doing size computations.
 int right()
          Returns the right margin which is either a non-negative number of pixels or one of the Gap constants.
 int top()
          Returns the top margin which is either a non-negative number of pixels or one of the Gap constants.
 float valign()
          Returns the vertical alignment of this box, i.e. its vertical placement within the containing parent box.
 int vfill()
          Returns the box's willingness to grow vertically to fill excess space.
 float vscale()
          A box that is part of a Group with Group.tieHeight() uses the group's tied minimum, preferred and maximum heights multiplied by this factor.
 int vshrink()
          When several sibling boxes are shrunk smaller than their preferred heights because the container is too small, the vshrink() value determines the relative amount that is taken away from a box's height.
 int vweight()
          When several sibling boxes are grown larger than their preferred heights to fill excess space in the containing box, the vweight() value determines the relative amounts of additional height the boxes get.
 

Method Detail

groups

String[] groups()
Returns the names of all Groups this box is member of. If the box is member of no groups, a 0-length array is returned.

See Also:
MSBLayout.MutableConstraints.groups(String), MSBLayout.MutableConstraints.groups(String[])

hfill

int hfill()
Returns the box's willingness to grow horizontally to fill excess space. See MutableConstraints.hfill(int) for details on the possible values.

See Also:
MSBLayout.MutableConstraints.hfill(int), vfill()

vfill

int vfill()
Returns the box's willingness to grow vertically to fill excess space. See MutableConstraints.vfill(int) for details on the possible values.

See Also:
MSBLayout.MutableConstraints.vfill(int), vfill()

hscale

float hscale()
A box that is part of a Group with tieWidth() uses the group's tied minimum, preferred and maximum widths multiplied by this factor.


vscale

float vscale()
A box that is part of a Group with Group.tieHeight() uses the group's tied minimum, preferred and maximum heights multiplied by this factor.


margin

Insets margin()
Returns the amount of blank space added around the box's content where each of the top, left, bottom and right values is either a non-negative number of pixels or one of the Gap constants. The returned Insets object aggregates the values returned by left(), right(), bottom() and top().

See Also:
MSBLayout.Gap, MSBLayout.MutableConstraints.margin(Insets), MSBLayout.MutableConstraints.margin(int, int, int, int), padding(), left(), top(), bottom(), right()

left

int left()
Returns the left margin which is either a non-negative number of pixels or one of the Gap constants.

See Also:
margin()

right

int right()
Returns the right margin which is either a non-negative number of pixels or one of the Gap constants.

See Also:
margin()

top

int top()
Returns the top margin which is either a non-negative number of pixels or one of the Gap constants.

See Also:
margin()

bottom

int bottom()
Returns the bottom margin which is either a non-negative number of pixels or one of the Gap constants.

See Also:
margin()

padding

Dimension padding()
Returns an amount of space that is added to the box's minimum, preferred and maximum sizes when doing size computations. The width and height components of the Dimension are always non-negative. Note that padding is very different from a margin. A margin is an empty space around a box. Padding on the other hand grows the box's content. Unlike margins, padding is used rather infrequently.

See Also:
MSBLayout.MutableConstraints.padding(Dimension), MSBLayout.MutableConstraints.padding(int, int), margin()

hweight

int hweight()
When several sibling boxes are grown larger than their preferred widths to fill excess space in the containing box, the hweight() value determines the relative amounts of additional width the boxes get. A box with twice the hweight() value, will receive twice the space. hshrink() has the same role when shrinking boxes below their preferred widths. The returned value is always >0 and <=MAX_WEIGHT_SHRINK. A weight of 0 is not possible. A box that is not supposed to grow is defined by hfill()==0.

See Also:
MSBLayout.MutableConstraints.hweight(int), hfill(), hshrink(), vweight()

vweight

int vweight()
When several sibling boxes are grown larger than their preferred heights to fill excess space in the containing box, the vweight() value determines the relative amounts of additional height the boxes get. A box with twice the vweight() value, will receive twice the space. vshrink() has the same role when shrinking boxes below their preferred heights. The returned value is always >0 and <=MAX_WEIGHT_SHRINK. A weight of 0 is not possible. A box that is not supposed to grow is defined by vfill()==0.

See Also:
MSBLayout.MutableConstraints.vweight(int), vfill(), vshrink(), hweight()

hshrink

int hshrink()
When several sibling boxes are shrunk smaller than their preferred widths because the container is too small, the hshrink() value determines the relative amount that is taken away from a box's width. A box with twice the hshrink() value will lose twice the space. hweight() has the same role when growing boxes larger than their preferred widths. The returned value is always >0 and <=MAX_WEIGHT_SHRINK. A weight of 0 is not allowed because it must always be possible to fit the layout inside the container, which may require shrinking all boxes even below their minimum widths.

See Also:
MSBLayout.MutableConstraints.hshrink(int), hweight(), vweight()

vshrink

int vshrink()
When several sibling boxes are shrunk smaller than their preferred heights because the container is too small, the vshrink() value determines the relative amount that is taken away from a box's height. A box with twice the vshrink() value will lose twice the space. vweight() has the same role when growing boxes larger than their preferred heights. The returned value is always >0 and <=MAX_WEIGHT_SHRINK. A weight of 0 is not allowed because it must always be possible to fit the layout inside the container, which may require shrinking all boxes even below their minimum heights.

See Also:
MSBLayout.MutableConstraints.vshrink(int), vweight(), hweight()

halign

float halign()
Returns the horizontal alignment of this box, i.e. its horizontal placement within the containing parent box. For more information on alignment see MutableConstraints.halign(float).

See Also:
MSBLayout.MutableConstraints.halign(float), valign()

valign

float valign()
Returns the vertical alignment of this box, i.e. its vertical placement within the containing parent box. For more information on alignment see MutableConstraints.halign(float).

See Also:
MSBLayout.MutableConstraints.valign(float), halign()


Copyright © 2010 Matthias S. Benkmann. See LICENSE file for licensing details.
Hosted on Get MSBLayout at SourceForge.net. Fast, secure and Free Open Source software downloads