net.miginfocom.layout

Class DimConstraint

public final class DimConstraint extends Object implements Externalizable

A simple value holder for a constraint for one dimension.
Constructor Summary
DimConstraint()
Empty constructor.
Method Summary
UnitValuegetAlign()
Returns the alignment used either as a default value for sub-entities or for this entity.
UnitValuegetAlignOrDefault(boolean isCols)
StringgetEndGroup()
Returns the end group that this entity should be in for the demension that this object is describing.
BoundSizegetGapAfter()
Returns the gap after this entity.
BoundSizegetGapBefore()
Returns the gap before this entity.
FloatgetGrow()
Returns the grow weight.

Grow weight is how flexible the entity should be, relative to other entities, when it comes to growing.

intgetGrowPriority()
Returns the grow priority.
FloatgetShrink()
Returns the shrink priority.
intgetShrinkPriority()
Returns the shrink priority.
BoundSizegetSize()
Returns the min/preferred/max size for the entity in the dimension that this object describes.
StringgetSizeGroup()
Returns the size group that this entity should be in for the dimension that this object is describing.
booleanisFill()
Returns if the component in the row/column that this constraint should default be grown in the same dimension that this constraint represents (width for column and height for a row).
booleanisNoGrid()
Returns if the row/column should default to flow and not to grid behaviour.
voidreadExternal(ObjectInput in)
voidsetAlign(UnitValue uv)
Sets the alignment used wither as a default value for sub-entities or for this entity.
voidsetEndGroup(String s)
Sets the end group that this entity should be in for the demension that this object is describing.
voidsetFill(boolean b)
Sets if the component in the row/column that this constraint should default be grown in the same dimension that this constraint represents (width for column and height for a row).
voidsetGapAfter(BoundSize size)
Sets the gap after this entity.
voidsetGapBefore(BoundSize size)
Sets the gap before this entity.
voidsetGrow(Float weight)
Sets the grow weight.

Grow weight is how flexible the entity should be, relative to other entities, when it comes to growing.

voidsetGrowPriority(int p)
Sets the grow priority.
voidsetNoGrid(boolean b)
Sets if the row/column should default to flow and not to grid behaviour.
voidsetShrink(Float weight)
Sets the shrink priority.
voidsetShrinkPriority(int p)
Sets the shrink priority.
voidsetSize(BoundSize size)
Sets the min/preferred/max size for the entity in the dimension that this object describes.
voidsetSizeGroup(String s)
Sets the size group that this entity should be in for the dimension that this object is describing.
voidwriteExternal(ObjectOutput out)

Constructor Detail

DimConstraint

public DimConstraint()
Empty constructor.

Method Detail

getAlign

public UnitValue getAlign()
Returns the alignment used either as a default value for sub-entities or for this entity.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: The alignment.

getAlignOrDefault

public UnitValue getAlignOrDefault(boolean isCols)

getEndGroup

public String getEndGroup()
Returns the end group that this entity should be in for the demension that this object is describing. If this constraint is in an end group that is specified here. null means no end group and all other values are legal. Comparison with .equals(). Components in the same end group will have the same end coordinate.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: The current end group. null may be returned.

getGapAfter

public BoundSize getGapAfter()
Returns the gap after this entity. The gap is an empty space and can have a min/preferred/maximum size so that it can shrink and grow depending on available space. Gaps are against other entities' edges and not against other entities' gaps.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: The gap after this entity

getGapBefore

public BoundSize getGapBefore()
Returns the gap before this entity. The gap is an empty space and can have a min/preferred/maximum size so that it can shrink and grow depending on available space. Gaps are against other entities' edges and not against other entities' gaps.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: The gap before this entity

getGrow

public Float getGrow()
Returns the grow weight.

Grow weight is how flexible the entity should be, relative to other entities, when it comes to growing. null or zero mean it will never grow. An entity that has twice the grow weight compared to another entity will get twice as much of available space.

GrowWeight are only compared within the same GrowPrio.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: The current grow weight.

getGrowPriority

public int getGrowPriority()
Returns the grow priority. Relative priority is used for determining which entities gets the extra space first.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: The grow priority.

getShrink

public Float getShrink()
Returns the shrink priority. Relative priority is used for determining which entities gets smaller first when space is scarce. Shrink weight is how flexible the entity should be, relative to other entities, when it comes to shrinking. null or zero mean it will never shrink (default). An entity that has twice the shrink weight compared to another entity will get twice as much of available space.

Shrink(Weight) are only compared within the same ShrinkPrio.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: The current shrink weight.

getShrinkPriority

public int getShrinkPriority()
Returns the shrink priority. Relative priority is used for determining which entities gets smaller first when space is scarce.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: The shrink priority.

getSize

public BoundSize getSize()
Returns the min/preferred/max size for the entity in the dimension that this object describes.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: The current size. Never null since v3.5.

See Also: .

getSizeGroup

public String getSizeGroup()
Returns the size group that this entity should be in for the dimension that this object is describing. If this constraint is in a size group that is specified here. null means no size group and all other values are legal. Comparison with .equals(). Components/columnss/rows in the same size group will have the same min/preferred/max size; that of the largest in the group for the first two and the smallest for max.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: The current size group. May be null.

isFill

public boolean isFill()
Returns if the component in the row/column that this constraint should default be grown in the same dimension that this constraint represents (width for column and height for a row).

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: code>true means that components should grow.

isNoGrid

public boolean isNoGrid()
Returns if the row/column should default to flow and not to grid behaviour. This means that the whole row/column will be one cell and all components will end up in that cell.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Returns: true means that the whole row/column should be one cell.

readExternal

public void readExternal(ObjectInput in)

setAlign

public void setAlign(UnitValue uv)
Sets the alignment used wither as a default value for sub-entities or for this entity.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: uv The new shrink priority. E.g. CENTER or LEADING.

setEndGroup

public void setEndGroup(String s)
Sets the end group that this entity should be in for the demension that this object is describing. If this constraint is in an end group that is specified here. null means no end group and all other values are legal. Comparison with .equals(). Components in the same end group will have the same end coordinate.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: s The new end group. null disables end grouping.

setFill

public void setFill(boolean b)
Sets if the component in the row/column that this constraint should default be grown in the same dimension that this constraint represents (width for column and height for a row).

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: b true means that components should grow.

setGapAfter

public void setGapAfter(BoundSize size)
Sets the gap after this entity. The gap is an empty space and can have a min/preferred/maximum size so that it can shrink and grow depending on available space. Gaps are against other entities' edges and not against other entities' gaps.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: size The new gap.

See Also: .

setGapBefore

public void setGapBefore(BoundSize size)
Sets the gap before this entity. The gap is an empty space and can have a min/preferred/maximum size so that it can shrink and grow depending on available space. Gaps are against other entities' edges and not against other entities' gaps.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: size The new gap.

See Also: .

setGrow

public void setGrow(Float weight)
Sets the grow weight.

Grow weight is how flexible the entity should be, relative to other entities, when it comes to growing. null or zero mean it will never grow. An entity that has twice the grow weight compared to another entity will get twice as much of available space.

GrowWeight are only compared within the same GrowPrio.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: weight The new grow weight.

setGrowPriority

public void setGrowPriority(int p)
Sets the grow priority. Relative priority is used for determining which entities gets the extra space first.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: p The new grow priority.

setNoGrid

public void setNoGrid(boolean b)
Sets if the row/column should default to flow and not to grid behaviour. This means that the whole row/column will be one cell and all components will end up in that cell.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: b true means that the whole row/column should be one cell.

setShrink

public void setShrink(Float weight)
Sets the shrink priority. Relative priority is used for determining which entities gets smaller first when space is scarce. Shrink weight is how flexible the entity should be, relative to other entities, when it comes to shrinking. null or zero mean it will never shrink (default). An entity that has twice the shrink weight compared to another entity will get twice as much of available space.

Shrink(Weight) are only compared within the same ShrinkPrio.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: weight The new shrink weight.

setShrinkPriority

public void setShrinkPriority(int p)
Sets the shrink priority. Relative priority is used for determining which entities gets smaller first when space is scarce.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: p The new shrink priority.

setSize

public void setSize(BoundSize size)
Sets the min/preferred/max size for the entity in the dimension that this object describes.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: size The new size. May be null.

setSizeGroup

public void setSizeGroup(String s)
Sets the size group that this entity should be in for the dimension that this object is describing. If this constraint is in a size group that is specified here. null means no size group and all other values are legal. Comparison with .equals(). Components/columnss/rows in the same size group will have the same min/preferred/max size; that of the largest in the group for the first two and the smallest for max.

For a more thorough explanation of what this constraint does see the white paper or cheat Sheet at www.migcomponents.com.

Parameters: s The new size group. null disables size grouping.

writeExternal

public void writeExternal(ObjectOutput out)