Class BoundSize

java.lang.Object
com.codename1.ui.layouts.mig.BoundSize

public class BoundSize extends Object

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)

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final BoundSize
     
    static final BoundSize
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    BoundSize(UnitValue min, UnitValue preferred, UnitValue max, boolean gapPush, String createString)
    Constructor.
    BoundSize(UnitValue min, UnitValue preferred, UnitValue max, String createString)
    Constructor.
    BoundSize(UnitValue minMaxPref, String createString)
    Constructor that use the same value for min/preferred/max size.
  • Method Summary

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

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
     
    boolean
    Indicates whether some other object is "equal to" this one.
    final Class
    Returns the runtime class of an object.
    int
    Returns a hash code value for the object.
    final void
    Wakes up a single thread that is waiting on this object's monitor.
    final void
    Wakes up all threads that are waiting on this object's monitor.
    Returns a string representation of the object.
    final void
    Causes current thread to wait until another thread invokes the method or the method for this object.
    final void
    wait(long timeout)
    Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.
    final void
    wait(long timeout, int nanos)
    Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
  • 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: The value to use for min/preferred/max size.

      • createString: 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: The minimum size. May be null.

      • preferred: The preferred size. May be null.

      • max: The maximum size. May be null.

      • createString: 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: The minimum size. May be null.

      • preferred: The preferred size. May be null.

      • max: The maximum size. May be null.

      • gapPush: If the size should be hinted as "pushing" and thus want to occupy free space if no one else is claiming it.

      • createString: 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: The size to constrain.

      • refValue: The reference to use for relative sizes.

      • parent: The parent container.

      Returns

      The size, constrained within min and max.