Class Grid

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

public final class Grid extends Object
Holds components in a grid. Does most of the logic behind the layout manager.
  • Field Summary

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

    Constructors
    Constructor
    Description
    Grid(ContainerWrapper container, LC lc, AC rowConstr, AC colConstr, Map<? extends ComponentWrapper, CC> ccMap, ArrayList<LayoutCallback> callbackList)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    int[]
     
    int[]
    getHeight(int refWidth)
     
    int[]
     
    int[]
    getWidth(int refHeight)
     
    void
    If the container (parent) that this grid is laying out has changed its bounds, call this method to clear any cached values min/pref/max sizes of the components and rows/columns.
    boolean
    layout(int[] bounds, UnitValue alignX, UnitValue alignY, boolean debug)
    Does the actual layout.
    boolean
    layout(int[] bounds, UnitValue alignX, UnitValue alignY, boolean debug, boolean notUsed)
    Deprecated
    void
     

    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

  • Constructor Details

    • Grid

      public Grid(ContainerWrapper container, LC lc, AC rowConstr, AC colConstr, Map<? extends ComponentWrapper, CC> ccMap, ArrayList<LayoutCallback> callbackList)

      Constructor.

      Parameters
      • container: The container that will be laid out.

      • lc: The form flow constraints.

      • rowConstr: @param rowConstr The rows specifications. If more cell rows are required, the last element will be used for when there is no corresponding element in this array.

      • colConstr: @param colConstr The columns specifications. If more cell rows are required, the last element will be used for when there is no corresponding element in this array.

      • ccMap: @param ccMap The map containing the parsed constraints for each child component of parent. Will not be altered. Can have null CC which will use a common cached one.

      • callbackList: @param callbackList A list of callbacks or null if none. Will not be altered.

  • Method Details

    • invalidateContainerSize

      public void invalidateContainerSize()

      If the container (parent) that this grid is laying out has changed its bounds, call this method to clear any cached values min/pref/max sizes of the components and rows/columns.

      If any component can have changed cell the grid needs to be recreated.

    • layout

      public boolean layout(int[] bounds, UnitValue alignX, UnitValue alignY, boolean debug, boolean notUsed)
      Deprecated
    • layout

      public boolean layout(int[] bounds, UnitValue alignX, UnitValue alignY, boolean debug)

      Does the actual layout. Uses many values calculated in the constructor.

      Parameters
      • bounds: @param bounds The bounds to layout against. Normally that of the parent. [x, y, width, height].

      • alignX: The alignment for the x-axis. Can be null.

      • alignY: The alignment for the y-axis. Can be null.

      • debug: If debug information should be saved in #debugRects.

      Returns
      Returns:

      If the layout has changed the preferred size and there is need for a new layout. This can happen if one or more components in the grid has a content bias according to net.miginfocom.layout.ComponentWrapper#getContentBias().

      Since

      5.0

    • paintDebug

      public void paintDebug()
    • getContainer

      public ContainerWrapper getContainer()
    • getWidth

      public int[] getWidth()
    • getWidth

      public int[] getWidth(int refHeight)
    • getHeight

      public int[] getHeight()
    • getHeight

      public int[] getHeight(int refWidth)