de.winterdrache.layout
Class MSBLayout.ConstraintsImpl

java.lang.Object
  extended by de.winterdrache.layout.MSBLayout.ConstraintsImpl
All Implemented Interfaces:
MSBLayout.Constraints, MSBLayout.MutableConstraints
Enclosing class:
MSBLayout

public static class MSBLayout.ConstraintsImpl
extends Object
implements MSBLayout.MutableConstraints

A straightforward implementation of the MutableConstraints interface. There will rarely be a reason to create your own MutableConstraints implementation, but if you do, ConstraintsImpl can serve as a base class since all of its fields are protected.

Author:
Matthias S. Benkmann

Field Summary
protected static String[] ANONYMOUS_GROUP
          Constant String[]{ "" } that can (but need not be) used as return value for groups().
protected  String[] groups
          The groups() list.
protected  float halign
          The halign() value.
protected  int hfill
          The hfill() value.
protected  float hscale
          The hscale() value.
protected  int hshrink
          The hshrink() value.
protected  int hweight
          The hweight() value.
protected  int marginBotton
          The bottom() value.
protected  int marginLeft
          The left() value.
protected  int marginRight
          The right() value.
protected  int marginTop
          The top() value.
protected static String[] NO_GROUPS
          Constant String[]{} that can (but need not be) used as return value for groups().
protected  int paddingHeight
          The height component of padding().
protected  int paddingWidth
          The width component of padding().
protected  float valign
          The valign() value.
protected  int vfill
          The vfill() value.
protected  float vscale
          The vscale() value.
protected  int vshrink
          The vshrink() value.
protected  int vweight
          The vweight() value.
 
Constructor Summary
MSBLayout.ConstraintsImpl()
          Creates a default set of MutableConstraints.
MSBLayout.ConstraintsImpl(int hfill, int vfill, float halign, float valign, Insets margin, int hweight, int vweight, Dimension padding, float hscale, float vscale, int hshrink, int vshrink)
          Creates a new ConstraintsImpl object for the given constraints.
MSBLayout.ConstraintsImpl(MSBLayout.Constraints orig)
          Creates a copy of the Constraints from orig.
 
Method Summary
 int bottom()
          Returns the bottom margin which is either a non-negative number of pixels or one of the Gap constants.
 MSBLayout.MutableConstraints bottom(int margin)
          Sets the bottom margin and leaves the other margins unchanged.
 String[] groups()
          Returns the names of all Groups this box is member of.
 MSBLayout.MutableConstraints groups(String grps)
          Takes a comma-separated list of group names (that must not contain spurious whitespace) that will replace the list of groups this box is currently part of.
 MSBLayout.MutableConstraints groups(String[] grp)
          Takes a list of group names that will replace the list of groups this box is currently part of.
 float halign()
          Returns the horizontal alignment of this box, i.e. its horizontal placement within the containing parent box.
 MSBLayout.MutableConstraints halign(float a)
          When this box is contained in a box that has excess blank space, the alignment determines where that blank space will be relative to this box.
 int hfill()
          Returns the box's willingness to grow horizontally to fill excess space.
 MSBLayout.MutableConstraints hfill(int fill)
          Sets the box's willingness to grow horizontally to fill excess space. 0 means the Box insists on its preferred size. 1 means this Box is willing to grow to its maximum size if required. 2 means the Box is willing to grow beyond its maximum size if there is still too much space after all boxes with willingness == 1 have been grown to their max sizes.
 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.
 MSBLayout.MutableConstraints hscale(float scale)
          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.
 MSBLayout.MutableConstraints hshrink(int weight)
          When boxes are shrunk below their preferred sizes because their container is too small, the weight value determines the relative amount of space this Box will lose.
 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.
 MSBLayout.MutableConstraints hweight(int weight)
          When boxes are grown to fill excess space in the parent container, the weight value determines the relative portion of space this Box will get.
 int left()
          Returns the left margin which is either a non-negative number of pixels or one of the Gap constants.
 MSBLayout.MutableConstraints left(int margin)
          Sets the left margin and leaves the other margins unchanged.
 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.
 MSBLayout.MutableConstraints margin(Insets insets)
          Sets an amount of blank space to be added around the box's content.
 MSBLayout.MutableConstraints margin(int top, int left, int bottom, int right)
          Sets an amount of blank space to be added around the box's content.
 Dimension padding()
          Returns an amount of space that is added to the box's minimum, preferred and maximum sizes when doing size computations.
 MSBLayout.MutableConstraints padding(Dimension padding)
          Sets an amount of space to be added to the box's minimum, preferred and maximum sizes when doing size computations.
 MSBLayout.MutableConstraints padding(int width, int height)
          Sets an amount of space to be 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.
 MSBLayout.MutableConstraints right(int margin)
          Sets the right margin and leaves the other margins unchanged.
 MSBLayout.MutableConstraints setConstraints(MSBLayout.Constraints orig)
          Copies the settings from orig to this MutableConstraints object.
 int top()
          Returns the top margin which is either a non-negative number of pixels or one of the Gap constants.
 MSBLayout.MutableConstraints top(int margin)
          Sets the top margin and leaves the other margins unchanged.
 float valign()
          Returns the vertical alignment of this box, i.e. its vertical placement within the containing parent box.
 MSBLayout.MutableConstraints valign(float a)
          When this box is contained in a box that has excess blank space, the alignment determines where that blank space will be relative to this box.
 int vfill()
          Returns the box's willingness to grow vertically to fill excess space.
 MSBLayout.MutableConstraints vfill(int fill)
          Sets the box's willingness to grow vertically to fill excess space. 0 means the Box insists on its preferred size. 1 means this Box is willing to grow to its maximum size if required. 2 means the Box is willing to grow beyond its maximum size if there is still too much space after all boxes with willingness == 1 have been grown to their max sizes.
 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.
 MSBLayout.MutableConstraints vscale(float scale)
          A box that is part of a Group with 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.
 MSBLayout.MutableConstraints vshrink(int weight)
          When boxes are shrunk below their preferred sizes because their container is too small, the weight value determines the relative amount of space this Box will lose.
 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.
 MSBLayout.MutableConstraints vweight(int weight)
          When boxes are grown to fill excess space in the parent container, the weight value determines the relative portion of space this Box will get.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_GROUPS

protected static final String[] NO_GROUPS
Constant String[]{} that can (but need not be) used as return value for groups().


ANONYMOUS_GROUP

protected static final String[] ANONYMOUS_GROUP
Constant String[]{ "" } that can (but need not be) used as return value for groups().


groups

protected String[] groups
The groups() list. Never null but may be an empty array.


hfill

protected int hfill
The hfill() value.


vfill

protected int vfill
The vfill() value.


marginTop

protected int marginTop
The top() value.


marginBotton

protected int marginBotton
The bottom() value.


marginLeft

protected int marginLeft
The left() value.


marginRight

protected int marginRight
The right() value.


paddingWidth

protected int paddingWidth
The width component of padding().


paddingHeight

protected int paddingHeight
The height component of padding().


hscale

protected float hscale
The hscale() value.


vscale

protected float vscale
The vscale() value.


halign

protected float halign
The halign() value.


valign

protected float valign
The valign() value.


hweight

protected int hweight
The hweight() value.


vweight

protected int vweight
The vweight() value.


hshrink

protected int hshrink
The hshrink() value.


vshrink

protected int vshrink
The vshrink() value.

Constructor Detail

MSBLayout.ConstraintsImpl

public MSBLayout.ConstraintsImpl()
Creates a default set of MutableConstraints.
hfill 0 (= insist on preferred width)
vfill 0 (= insist on preferred height)
margin (Gap.WEAK_RELATED, Gap.WEAK_RELATED, Gap.WEAK_RELATED, Gap.WEAK_RELATED)
halign -1.0f (= justify)
valign -1.0f (= justify)
padding (0,0)
hscale 1.0f
vscale 1.0f
hweight 100
vweight 100
hshrink 100
vshrink 100


MSBLayout.ConstraintsImpl

public MSBLayout.ConstraintsImpl(MSBLayout.Constraints orig)
Creates a copy of the Constraints from orig.


MSBLayout.ConstraintsImpl

public MSBLayout.ConstraintsImpl(int hfill,
                                 int vfill,
                                 float halign,
                                 float valign,
                                 Insets margin,
                                 int hweight,
                                 int vweight,
                                 Dimension padding,
                                 float hscale,
                                 float vscale,
                                 int hshrink,
                                 int vshrink)
Creates a new ConstraintsImpl object for the given constraints.

Method Detail

setConstraints

public MSBLayout.MutableConstraints setConstraints(MSBLayout.Constraints orig)
Description copied from interface: MSBLayout.MutableConstraints
Copies the settings from orig to this MutableConstraints object.

Specified by:
setConstraints in interface MSBLayout.MutableConstraints
Returns:
this

groups

public String[] groups()
Description copied from interface: MSBLayout.Constraints
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.

Specified by:
groups in interface MSBLayout.Constraints
See Also:
MSBLayout.MutableConstraints.groups(String), MSBLayout.MutableConstraints.groups(String[])

groups

public MSBLayout.MutableConstraints groups(String[] grp)
Description copied from interface: MSBLayout.MutableConstraints
Takes a list of group names that will replace the list of groups this box is currently part of. null may be passed to remove the box from any groups.

Specified by:
groups in interface MSBLayout.MutableConstraints
See Also:
MSBLayout.Constraints.groups(), MSBLayout.MutableConstraints.groups(String)

groups

public MSBLayout.MutableConstraints groups(String grps)
Description copied from interface: MSBLayout.MutableConstraints
Takes a comma-separated list of group names (that must not contain spurious whitespace) that will replace the list of groups this box is currently part of. null may be passed to remove the box from any groups. Note that passing the empty string will NOT clear the list of groups. The empty string is a legitimate group name.

Specified by:
groups in interface MSBLayout.MutableConstraints
See Also:
MSBLayout.Constraints.groups(), MSBLayout.MutableConstraints.groups(String[])

halign

public MSBLayout.MutableConstraints halign(float a)
Description copied from interface: MSBLayout.MutableConstraints
When this box is contained in a box that has excess blank space, the alignment determines where that blank space will be relative to this box.

An alignment < 0 means "justify", i.e. if this box is the first or the last in the container box, it will touch at least one edge of the container, otherwise it will be positioned exactly in the middle between its two sibling boxes. An alignment between 0.0 and 1.0 specifies the percentage of all blank space that is to be placed before this box. E.g an alignment of 0.5 means that 50% of the empty space will be placed before the Box and 50% after it. Note that this will not necessarily result in the Box being in the exact center of the container box, because the presence of sibling boxes will affect its placement, too. Alignments >1.0 mean the same as 1.0.

In no event will alignment cause 2 boxes to overlap. E.g. 2 sibling boxes with alignment 0.5 will not overlap each other. Instead they will form a cluster that is as a whole centered (with respect to the empty space, not necessarily with respect to the parent container). If the alignment of a box is less than the alignment of a sibling box that comes before it, its alignment will be assumed to be the same as the sibling.

The alignment can be set independently for horizontal (halign) and vertical alignment (valign).

MSBLayout.setSingleBoxJustifyBehaviour(float, float, int, int) controls how the special case of a single box without siblings is handled when its alignment is "justify".

Specified by:
halign in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.Constraints.halign(), MSBLayout.MutableConstraints.valign(float)

halign

public float halign()
Description copied from interface: MSBLayout.Constraints
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).

Specified by:
halign in interface MSBLayout.Constraints
See Also:
MSBLayout.MutableConstraints.halign(float), MSBLayout.Constraints.valign()

hfill

public MSBLayout.MutableConstraints hfill(int fill)
Description copied from interface: MSBLayout.MutableConstraints
Sets the box's willingness to grow horizontally to fill excess space. 0 means the Box insists on its preferred size. 1 means this Box is willing to grow to its maximum size if required. 2 means the Box is willing to grow beyond its maximum size if there is still too much space after all boxes with willingness == 1 have been grown to their max sizes.

Specified by:
hfill in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.MutableConstraints.vfill(int), MSBLayout.Constraints.hfill()

hfill

public int hfill()
Description copied from interface: MSBLayout.Constraints
Returns the box's willingness to grow horizontally to fill excess space. See MutableConstraints.hfill(int) for details on the possible values.

Specified by:
hfill in interface MSBLayout.Constraints
See Also:
MSBLayout.MutableConstraints.hfill(int), MSBLayout.Constraints.vfill()

hscale

public MSBLayout.MutableConstraints hscale(float scale)
Description copied from interface: MSBLayout.MutableConstraints
A box that is part of a Group with tieWidth() uses the group's tied minimum, preferred and maximum widths multiplied by this factor. You would use this feature when building a grid with same size cells to simulate merged cells.

Specified by:
hscale in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.Constraints.hscale(), MSBLayout.MutableConstraints.vscale(float)

hscale

public float hscale()
Description copied from interface: MSBLayout.Constraints
A box that is part of a Group with tieWidth() uses the group's tied minimum, preferred and maximum widths multiplied by this factor.

Specified by:
hscale in interface MSBLayout.Constraints

hweight

public MSBLayout.MutableConstraints hweight(int weight)
Description copied from interface: MSBLayout.MutableConstraints
When boxes are grown to fill excess space in the parent container, the weight value determines the relative portion of space this Box will get. You can think of this value as specifying how fast the box will grow in relation to other boxes in the same container. A box with twice the hweight() value, will receive twice the space. The value is always > 0 and <= MAX_WEIGHT_SHRINK and can be set independently for horizontal (hweight) and vertical space (vweight). ATTENTION! The weight must be greater than 0. This is different from GridBagLayout where a weight of 0 means that a box will not grow. If you don't want a box to grow, use MSBLayout.MutableConstraints.hfill(int)/ MSBLayout.MutableConstraints.vfill(int).

MSBLayout.MutableConstraints.hshrink(int) plays a similar role when shrinking a box below its preferred width.

Specified by:
hweight in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.MutableConstraints.vweight(int), MSBLayout.Constraints.hweight(), MSBLayout.MutableConstraints.hshrink(int)

hweight

public int hweight()
Description copied from interface: MSBLayout.Constraints
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. MSBLayout.Constraints.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 MSBLayout.Constraints.hfill()==0.

Specified by:
hweight in interface MSBLayout.Constraints
See Also:
MSBLayout.MutableConstraints.hweight(int), MSBLayout.Constraints.hfill(), MSBLayout.Constraints.hshrink(), MSBLayout.Constraints.vweight()

hshrink

public MSBLayout.MutableConstraints hshrink(int weight)
Description copied from interface: MSBLayout.MutableConstraints
When boxes are shrunk below their preferred sizes because their container is too small, the weight value determines the relative amount of space this Box will lose. You can think of this value as specifying how fast the box will shrink in relation to other boxes in the same container. A box with twice the hshrink() value, will lose twice the space. The value is always >0 and <=MAX_WEIGHT_SHRINK and can be set independently for horizontal (hshrink) and vertical space (vshrink). MSBLayout.MutableConstraints.hweight(int) plays a similar role when growing a box larger than its preferred width.

NOTE: When you find that the hshrink value seems to have no effect, this may be due to one of the following reasons:

Specified by:
hshrink in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.MutableConstraints.vshrink(int), MSBLayout.Constraints.hshrink(), MSBLayout.MutableConstraints.hweight(int)

hshrink

public int hshrink()
Description copied from interface: MSBLayout.Constraints
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. MSBLayout.Constraints.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.

Specified by:
hshrink in interface MSBLayout.Constraints
See Also:
MSBLayout.MutableConstraints.hshrink(int), MSBLayout.Constraints.hweight(), MSBLayout.Constraints.vweight()

valign

public MSBLayout.MutableConstraints valign(float a)
Description copied from interface: MSBLayout.MutableConstraints
When this box is contained in a box that has excess blank space, the alignment determines where that blank space will be relative to this box. See MSBLayout.MutableConstraints.halign(float) for a detailed explanation of alignment.

Specified by:
valign in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.Constraints.valign(), MSBLayout.MutableConstraints.halign(float)

valign

public float valign()
Description copied from interface: MSBLayout.Constraints
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).

Specified by:
valign in interface MSBLayout.Constraints
See Also:
MSBLayout.MutableConstraints.valign(float), MSBLayout.Constraints.halign()

vfill

public MSBLayout.MutableConstraints vfill(int fill)
Description copied from interface: MSBLayout.MutableConstraints
Sets the box's willingness to grow vertically to fill excess space. 0 means the Box insists on its preferred size. 1 means this Box is willing to grow to its maximum size if required. 2 means the Box is willing to grow beyond its maximum size if there is still too much space after all boxes with willingness == 1 have been grown to their max sizes.

Specified by:
vfill in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.MutableConstraints.hfill(int), MSBLayout.Constraints.vfill()

vfill

public int vfill()
Description copied from interface: MSBLayout.Constraints
Returns the box's willingness to grow vertically to fill excess space. See MutableConstraints.vfill(int) for details on the possible values.

Specified by:
vfill in interface MSBLayout.Constraints
See Also:
MSBLayout.MutableConstraints.vfill(int), MSBLayout.Constraints.vfill()

vscale

public MSBLayout.MutableConstraints vscale(float scale)
Description copied from interface: MSBLayout.MutableConstraints
A box that is part of a Group with tieHeight() uses the group's tied minimum, preferred and maximum heights multiplied by this factor. You would use this feature when building a grid with same size cells to simulate merged cells.

Specified by:
vscale in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.MutableConstraints.hscale(float), MSBLayout.Constraints.vscale()

vscale

public float vscale()
Description copied from interface: MSBLayout.Constraints
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.

Specified by:
vscale in interface MSBLayout.Constraints

vweight

public MSBLayout.MutableConstraints vweight(int weight)
Description copied from interface: MSBLayout.MutableConstraints
When boxes are grown to fill excess space in the parent container, the weight value determines the relative portion of space this Box will get. You can think of this value as specifying how fast the box will grow in relation to other boxes in the same container. A box with twice the vweight() value, will receive twice the space. The value is always >0 and <= MAX_WEIGHT_SHRINK and can be set independently for horizontal (hweight) and vertical space (vweight). ATTENTION! The weight must be greater than 0. This is different from GridBagLayout where a weight of 0 means that a box will not grow. If you don't want a box to grow, use MSBLayout.MutableConstraints.hfill(int)/ MSBLayout.MutableConstraints.vfill(int).

MSBLayout.MutableConstraints.vshrink(int) plays a similar role when shrinking a box below its preferred height.

Specified by:
vweight in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.MutableConstraints.hweight(int), MSBLayout.Constraints.vweight(), MSBLayout.MutableConstraints.vshrink(int)

vweight

public int vweight()
Description copied from interface: MSBLayout.Constraints
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. MSBLayout.Constraints.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 MSBLayout.Constraints.vfill()==0.

Specified by:
vweight in interface MSBLayout.Constraints
See Also:
MSBLayout.MutableConstraints.vweight(int), MSBLayout.Constraints.vfill(), MSBLayout.Constraints.vshrink(), MSBLayout.Constraints.hweight()

vshrink

public MSBLayout.MutableConstraints vshrink(int weight)
Description copied from interface: MSBLayout.MutableConstraints
When boxes are shrunk below their preferred sizes because their container is too small, the weight value determines the relative amount of space this Box will lose. You can think of this value as specifying how fast the box will shrink in relation to other boxes in the same container. A box with twice the vshrink() value, will lose twice the space. The value is always >0 and <=MAX_WEIGHT_SHRINK and can be set independently for horizontal (hshrink) and vertical space (vshrink). MSBLayout.MutableConstraints.vweight(int) plays a similar role when growing a box larger than its preferred height.

NOTE: When you find that the vshrink value seems to have no effect, this may be due to one of the following reasons:

Specified by:
vshrink in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.MutableConstraints.hshrink(int), MSBLayout.Constraints.vshrink(), MSBLayout.MutableConstraints.vweight(int)

vshrink

public int vshrink()
Description copied from interface: MSBLayout.Constraints
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. MSBLayout.Constraints.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.

Specified by:
vshrink in interface MSBLayout.Constraints
See Also:
MSBLayout.MutableConstraints.vshrink(int), MSBLayout.Constraints.vweight(), MSBLayout.Constraints.hweight()

margin

public MSBLayout.MutableConstraints margin(Insets insets)
Description copied from interface: MSBLayout.MutableConstraints
Sets an amount of blank space to be added around the box's content. The top, left, bottom and right values can be either non-negative pixel values or Gap constants. To set the margins for the different sides individually, you can use the methods MSBLayout.MutableConstraints.top(int), MSBLayout.MutableConstraints.left(int), MSBLayout.MutableConstraints.bottom(int) and MSBLayout.MutableConstraints.right(int).

Specified by:
margin in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.Gap, MSBLayout.MutableConstraints.margin(int, int, int, int), MSBLayout.Constraints.margin(), MSBLayout.MutableConstraints.padding(Dimension), MSBLayout.MutableConstraints.top(int), MSBLayout.MutableConstraints.left(int), MSBLayout.MutableConstraints.bottom(int), MSBLayout.MutableConstraints.right(int)

margin

public MSBLayout.MutableConstraints margin(int top,
                                           int left,
                                           int bottom,
                                           int right)
Description copied from interface: MSBLayout.MutableConstraints
Sets an amount of blank space to be added around the box's content. The top, left, bottom and right values can be either non-negative pixel values or Gap constants. To set the margins for the different sides individually, you can use the methods MSBLayout.MutableConstraints.top(int), MSBLayout.MutableConstraints.left(int), MSBLayout.MutableConstraints.bottom(int) and MSBLayout.MutableConstraints.right(int).

Specified by:
margin in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.Gap, MSBLayout.MutableConstraints.margin(Insets), MSBLayout.Constraints.margin(), MSBLayout.MutableConstraints.padding(int, int), MSBLayout.MutableConstraints.top(int), MSBLayout.MutableConstraints.left(int), MSBLayout.MutableConstraints.bottom(int), MSBLayout.MutableConstraints.right(int)

left

public MSBLayout.MutableConstraints left(int margin)
Description copied from interface: MSBLayout.MutableConstraints
Sets the left margin and leaves the other margins unchanged. The argument can be either a non-negative pixel value or one of the Gap constants.

Specified by:
left in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.Gap, MSBLayout.MutableConstraints.margin(Insets), MSBLayout.MutableConstraints.margin(int, int, int, int), MSBLayout.MutableConstraints.padding(int, int), MSBLayout.Constraints.left()

right

public MSBLayout.MutableConstraints right(int margin)
Description copied from interface: MSBLayout.MutableConstraints
Sets the right margin and leaves the other margins unchanged. The argument can be either a non-negative pixel value or one of the Gap constants.

Specified by:
right in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.Gap, MSBLayout.MutableConstraints.margin(Insets), MSBLayout.MutableConstraints.margin(int, int, int, int), MSBLayout.MutableConstraints.padding(int, int), MSBLayout.Constraints.right()

top

public MSBLayout.MutableConstraints top(int margin)
Description copied from interface: MSBLayout.MutableConstraints
Sets the top margin and leaves the other margins unchanged. The argument can be either a non-negative pixel value or one of the Gap constants.

Specified by:
top in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.Gap, MSBLayout.MutableConstraints.margin(Insets), MSBLayout.MutableConstraints.margin(int, int, int, int), MSBLayout.MutableConstraints.padding(int, int), MSBLayout.Constraints.top()

bottom

public MSBLayout.MutableConstraints bottom(int margin)
Description copied from interface: MSBLayout.MutableConstraints
Sets the bottom margin and leaves the other margins unchanged. The argument can be either a non-negative pixel value or one of the Gap constants.

Specified by:
bottom in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.Gap, MSBLayout.MutableConstraints.margin(Insets), MSBLayout.MutableConstraints.margin(int, int, int, int), MSBLayout.MutableConstraints.padding(int, int), MSBLayout.Constraints.bottom()

margin

public Insets margin()
Description copied from interface: MSBLayout.Constraints
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 MSBLayout.Constraints.left(), MSBLayout.Constraints.right(), MSBLayout.Constraints.bottom() and MSBLayout.Constraints.top().

Specified by:
margin in interface MSBLayout.Constraints
See Also:
MSBLayout.Gap, MSBLayout.MutableConstraints.margin(Insets), MSBLayout.MutableConstraints.margin(int, int, int, int), MSBLayout.Constraints.padding(), MSBLayout.Constraints.left(), MSBLayout.Constraints.top(), MSBLayout.Constraints.bottom(), MSBLayout.Constraints.right()

left

public int left()
Description copied from interface: MSBLayout.Constraints
Returns the left margin which is either a non-negative number of pixels or one of the Gap constants.

Specified by:
left in interface MSBLayout.Constraints
See Also:
MSBLayout.Constraints.margin()

right

public int right()
Description copied from interface: MSBLayout.Constraints
Returns the right margin which is either a non-negative number of pixels or one of the Gap constants.

Specified by:
right in interface MSBLayout.Constraints
See Also:
MSBLayout.Constraints.margin()

top

public int top()
Description copied from interface: MSBLayout.Constraints
Returns the top margin which is either a non-negative number of pixels or one of the Gap constants.

Specified by:
top in interface MSBLayout.Constraints
See Also:
MSBLayout.Constraints.margin()

bottom

public int bottom()
Description copied from interface: MSBLayout.Constraints
Returns the bottom margin which is either a non-negative number of pixels or one of the Gap constants.

Specified by:
bottom in interface MSBLayout.Constraints
See Also:
MSBLayout.Constraints.margin()

padding

public MSBLayout.MutableConstraints padding(Dimension padding)
Description copied from interface: MSBLayout.MutableConstraints
Sets an amount of space to be added to the box's minimum, preferred and maximum sizes when doing size computations. The width and height components of the Dimension must be 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.

Specified by:
padding in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.MutableConstraints.padding(int, int), MSBLayout.Constraints.padding(), MSBLayout.MutableConstraints.margin(Insets)

padding

public MSBLayout.MutableConstraints padding(int width,
                                            int height)
Description copied from interface: MSBLayout.MutableConstraints
Sets an amount of space to be added to the box's minimum, preferred and maximum sizes when doing size computations. Both width and height must be 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.

Specified by:
padding in interface MSBLayout.MutableConstraints
Returns:
this
See Also:
MSBLayout.MutableConstraints.padding(Dimension), MSBLayout.Constraints.padding(), MSBLayout.MutableConstraints.margin(int, int, int, int)

padding

public Dimension padding()
Description copied from interface: MSBLayout.Constraints
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.

Specified by:
padding in interface MSBLayout.Constraints
See Also:
MSBLayout.MutableConstraints.padding(Dimension), MSBLayout.MutableConstraints.padding(int, int), MSBLayout.Constraints.margin()


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