public class BoundSize

  1. Object
  2. BoundSize

A size that contains minimum, preferred and maximum size of type UnitValue.

This class is a simple value container and it is immutable.

If a size is missing (i.e., null) that boundary should be considered “not in use”.

You can create a BoundSize from a String with the use of boolean, boolean)

Fields

public static final BoundSize NULL_SIZE
public static final BoundSize ZERO_PIXEL

Constructors

public BoundSize(UnitValue minMaxPref, String createString)Constructor that use the same value for min/preferred/max size.
public BoundSize(UnitValue min, UnitValue preferred, UnitValue max, String createString)Constructor.
public BoundSize(UnitValue min, UnitValue preferred, UnitValue max, boolean gapPush, String createString)Constructor.

Methods

public final UnitValue getMin()Returns the minimum size as sent into the constructor.
public final UnitValue getPreferred()Returns the preferred size as sent into the constructor.
public final UnitValue getMax()Returns the maximum size as sent into the constructor.
public boolean getGapPush()If the size should be hinted as “pushing” and thus want to occupy free space if noone else is claiming it.
public boolean isUnset()Returns if this bound size has no min, preferred and maximum size set (they are all null)
public int constrain(int size, float refValue, ContainerWrapper parent)Makes sure that size is within min and max of this size.

Inherited methods

Field details

NULL_SIZE

public static final BoundSize NULL_SIZE

ZERO_PIXEL

public static final BoundSize ZERO_PIXEL

Constructor details

BoundSize

public BoundSize(UnitValue minMaxPref, String createString)
Constructor that use the same value for min/preferred/max size.

Parameters

minMaxPref UnitValue
The value to use for min/preferred/max size.
createString String
The string used to create the BoundsSize.

BoundSize

public BoundSize(UnitValue min, UnitValue preferred, UnitValue max, String createString)
Constructor. This method is here for serilization only and should normally not be used. Use boolean, boolean) instead.

Parameters

min UnitValue
The minimum size. May be null.
preferred UnitValue
The preferred size. May be null.
max UnitValue
The maximum size. May be null.
createString String
The string used to create the BoundsSize.

BoundSize

public BoundSize(UnitValue min, UnitValue preferred, UnitValue max, boolean gapPush, String createString)
Constructor. This method is here for serilization only and should normally not be used. Use boolean, boolean) instead.

Parameters

min UnitValue
The minimum size. May be null.
preferred UnitValue
The preferred size. May be null.
max UnitValue
The maximum size. May be null.
gapPush boolean
If the size should be hinted as “pushing” and thus want to occupy free space if no one else is claiming it.
createString String
The string used to create the BoundsSize.

Method details

getMin

public final UnitValue getMin()
Returns the minimum size as sent into the constructor.

Returns

The minimum size as sent into the constructor. May be null.

getPreferred

public final UnitValue getPreferred()
Returns the preferred size as sent into the constructor.

Returns

The preferred size as sent into the constructor. May be null.

getMax

public final UnitValue getMax()
Returns the maximum size as sent into the constructor.

Returns

The maximum size as sent into the constructor. May be null.

getGapPush

public boolean getGapPush()
If the size should be hinted as “pushing” and thus want to occupy free space if noone else is claiming it.

Returns

The value.

isUnset

public boolean isUnset()
Returns if this bound size has no min, preferred and maximum size set (they are all null)

Returns

If unset.

constrain

public int constrain(int size, float refValue, ContainerWrapper parent)
Makes sure that size is within min and max of this size.

Parameters

size int
The size to constrain.
refValue float
The reference to use for relative sizes.
parent ContainerWrapper
The parent container.

Returns

The size, constrained within min and max.