public class LayeredLayout.LayeredLayoutConstraint.Inset extends Object
| Constructor and Description |
|---|
Inset(int side)
Creates a new inset for the given side.
|
| Modifier and Type | Method and Description |
|---|---|
LayeredLayout.LayeredLayoutConstraint.Inset |
bottom()
Gets the bottom inset in this constraint.
|
int |
calcPreferredValue(Container parent,
Component cmp)
Calculate the preferred value of this inset.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
changeReference(Container parent,
Component newRef,
float pos)
Changes the reference component, while updating the value to remain in the same
absolute position.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
changeUnits(byte unit)
Deprecated.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
changeUnits(byte unit,
Component cmp)
Deprecated.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
changeUnitsTo(byte unit,
Container parent)
Changes the units of this inset, and updates the value to remain
the same as the current value.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
changeUnitsTo(byte unit,
Rectangle refBox) |
LayeredLayout.LayeredLayoutConstraint |
constraint()
Gets the constraint that contains this inset.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
copy()
Creates a copy of this inset.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
copyTo(Component cmp)
Copies this inset into the corresponding inset of the provided component.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
copyTo(LayeredLayout.LayeredLayoutConstraint.Inset dest)
Copies this inset into another inset.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
copyTo(LayeredLayout.LayeredLayoutConstraint dest)
Copies this inset to the corresponding inset of the provided constraint.
|
int |
getAbsolutePixels(Component cmp)
Returns the total inset of this inset when applied to the given component.
|
float |
getCurrentValueMM()
Gets the current value of this inset in millimetres.
|
int |
getCurrentValuePx()
Gets the current value of this inset in pixels.
|
Set<Component> |
getDependencies()
Recursively gets all of the reference components of this inset.
|
Set<Component> |
getDependencies(Set<Component> deps)
Recursively gets all of the reference components of this inset.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
getOppositeInset()
Gets the opposite inset of this inset within its parent constraint.
|
Component |
getReferenceComponent()
Gets the reference component for this inset.
|
float |
getReferencePosition()
Gets the reference position for this inset.
|
int |
getSide()
Gets the side of this inset.
|
byte |
getUnit()
Gets the unit of this inset.
|
String |
getValueAsString()
Gets the value of this inset as a string.
|
String |
getValueAsString(int decimalPlaces)
Gets the value of this inset as a string rounding to the specified number of decimal places.
|
boolean |
isFixed()
Checks if this is a fixed inset.
|
boolean |
isFlexible()
Checks if this is a flexible inset.
|
boolean |
isHorizontal()
True if this is a horizontal inset (left or right).
|
boolean |
isVertical()
True if this is a vertical inset (top or bottom).
|
LayeredLayout.LayeredLayoutConstraint.Inset |
left()
Gets the left inset in this constraint.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
referenceComponent(Component cmp)
Sets the reference component for this inset.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
referencePosition(float position)
Sets the reference position for this inset.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
right()
Gets the right inset in the constraint.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
setAuto()
Sets the units to "auto" (i.e.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
setDips()
Sets the units to "dips" (millimetres).
|
LayeredLayout.LayeredLayoutConstraint.Inset |
setDips(float dips)
Sets the inset value to the provided dips/millimetre value.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
setPercent()
Sets the units to percent.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
setPercent(float percent)
Sets the inset value in percentage.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
setPixels()
Sets the units to pixels.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
setPixels(int px)
Sets the inset value to the provided number of pixels.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
setValueAsString(String value)
Sets the value of this inset as a string.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
top()
Gets the top inset in this constraint.
|
String |
toString()
Prints this inset as a string.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
translateMM(float delta,
boolean preferMM,
Container parent)
Translates the inset by delta millimetres.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
translatePixels(int delta,
boolean preferMM,
Container parent)
Translates the inset by delta pixels.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
unit(byte unit)
Sets the unit for this constraint.
|
LayeredLayout.LayeredLayoutConstraint.Inset |
value(float value)
Sets the value of this inset.
|
public Inset(int side)
side - One of Component.TOP, Component.BOTTOM, Component.LEFT, or Component.RIGHT.public String toString()
public String getValueAsString()
public String getValueAsString(int decimalPlaces)
getValueAsString()public LayeredLayout.LayeredLayoutConstraint.Inset setValueAsString(String value)
value - The value of this inset.public LayeredLayout.LayeredLayoutConstraint.Inset left()
public LayeredLayout.LayeredLayoutConstraint.Inset right()
public LayeredLayout.LayeredLayoutConstraint.Inset top()
public LayeredLayout.LayeredLayoutConstraint.Inset bottom()
public LayeredLayout.LayeredLayoutConstraint constraint()
public LayeredLayout.LayeredLayoutConstraint.Inset unit(byte unit)
unit - The unit. One of LayeredLayout.UNIT_AUTO, LayeredLayout.UNIT_DIPS, LayeredLayout.UNIT_PIXELS, or LayeredLayout.UNIT_PERCENT.setAuto(),
setDips(),
setPixels(),
setPercent(),
To change units while recalculating the value to be effectively equivalent.public LayeredLayout.LayeredLayoutConstraint.Inset setAuto()
unit(byte)public LayeredLayout.LayeredLayoutConstraint.Inset setDips()
unit(byte)public LayeredLayout.LayeredLayoutConstraint.Inset setPercent()
unit(byte)public LayeredLayout.LayeredLayoutConstraint.Inset setPixels()
public LayeredLayout.LayeredLayoutConstraint.Inset setPixels(int px)
px - The pixel value of the inset.public LayeredLayout.LayeredLayoutConstraint.Inset setDips(float dips)
dips - The inset value in millimetres.public LayeredLayout.LayeredLayoutConstraint.Inset setPercent(float percent)
percent - The inset value as a percentage.public LayeredLayout.LayeredLayoutConstraint.Inset referenceComponent(Component cmp)
cmp - The reference component. (I.e. the component that the inset is "anchored" to).referencePosition(float),
LayeredLayout.LayeredLayoutConstraint.setReferenceComponents(com.codename1.ui.Component...)public LayeredLayout.LayeredLayoutConstraint.Inset referencePosition(float position)
position - The reference position.LayeredLayout.LayeredLayoutConstraint.setReferencePositions(java.lang.String),
LayeredLayout.setReferencePositions(com.codename1.ui.Component, java.lang.String),
LayeredLayout.setReferencePositions(com.codename1.ui.Component, float...)public LayeredLayout.LayeredLayoutConstraint.Inset value(float value)
unit.
If the unit is LayeredLayout.UNIT_DIPS, then this value is interpreted in millimetres, etc..value - The value to set this inset to.public int getSide()
Component.TOP, Component#Bottom, Component.LEFT, Component.RIGHTComponent.TOP, Component#Bottom, Component.LEFT, Component.RIGHTpublic Component getReferenceComponent()
referenceComponent(com.codename1.ui.Component)public float getReferencePosition()
public int calcPreferredValue(Container parent, Component cmp)
parent - The parent container.cmp - The componentpublic Set<Component> getDependencies(Set<Component> deps)
deps - An "out" parameter. The set that will hold the dependencies.public Set<Component> getDependencies()
public LayeredLayout.LayeredLayoutConstraint.Inset getOppositeInset()
public LayeredLayout.LayeredLayoutConstraint.Inset copyTo(LayeredLayout.LayeredLayoutConstraint.Inset dest)
dest - The inset to copy to.public LayeredLayout.LayeredLayoutConstraint.Inset copyTo(LayeredLayout.LayeredLayoutConstraint dest)
dest - The constraint to copy the inset into.public LayeredLayout.LayeredLayoutConstraint.Inset copyTo(Component cmp)
cmp - The component that we are copying the inset into.public LayeredLayout.LayeredLayoutConstraint.Inset copy()
public byte getUnit()
LayeredLayout.UNIT_AUTO, LayeredLayout.UNIT_DIPS, LayeredLayout.UNIT_PIXELS, or LayeredLayout.UNIT_PERCENT.public boolean isFixed()
LayeredLayout.UNIT_AUTOpublic float getCurrentValueMM()
public int getCurrentValuePx()
public boolean isVertical()
public boolean isHorizontal()
public LayeredLayout.LayeredLayoutConstraint.Inset changeUnits(byte unit)
changeUnitsTo(byte, com.codename1.ui.Container)unit - The unit. One of LayeredLayout.UNIT_AUTO, LayeredLayout.UNIT_DIPS, LayeredLayout.UNIT_PIXELS, or LayeredLayout.UNIT_PERCENT.public LayeredLayout.LayeredLayoutConstraint.Inset changeUnits(byte unit, Component cmp)
changeUnitsTo(byte, com.codename1.ui.Container)unit - The unit. One of LayeredLayout.UNIT_AUTO, LayeredLayout.UNIT_DIPS, LayeredLayout.UNIT_PIXELS, or LayeredLayout.UNIT_PERCENT.cmp - The component for which the inset is applying.public LayeredLayout.LayeredLayoutConstraint.Inset changeUnitsTo(byte unit, Container parent)
unit - The unit. One of LayeredLayout.UNIT_AUTO, LayeredLayout.UNIT_DIPS, LayeredLayout.UNIT_PIXELS, or LayeredLayout.UNIT_PERCENT.parent - The container in which the layout applies.public LayeredLayout.LayeredLayoutConstraint.Inset changeUnitsTo(byte unit, Rectangle refBox)
public LayeredLayout.LayeredLayoutConstraint.Inset changeReference(Container parent, Component newRef, float pos)
parent - The parent container.newRef - The new reference component.pos - The reference position.public boolean isFlexible()
LayeredLayout.UNIT_AUTO.isFixed()public int getAbsolutePixels(Component cmp)
cmp - The component context.public LayeredLayout.LayeredLayoutConstraint.Inset translatePixels(int delta, boolean preferMM, Container parent)
delta - Pixels to translate this inset by.preferMM - If this is a flexible inset, then translating it will require changing it to fixed. true to use millimetres. false to use pixels.parent - The parent container used for calculating equivalent percent if this is a percent inset.translateMM(float, boolean, com.codename1.ui.Container)public LayeredLayout.LayeredLayoutConstraint.Inset translateMM(float delta, boolean preferMM, Container parent)
delta - Pixels to translate this inset by.preferMM - If this is a flexible inset, then translating it will require changing it to fixed. true to use millimetres. false to use pixels.parent - The parent container used for calculating equivalent percent if this is a percent inset.