Class FixedGrid


  • public class FixedGrid
    extends ej.mwt.Container
    Lays out any number of children in a grid.

    All the children are laid out in a grid, which has a fixed number of columns and rows.

    In a grid, all children have the same width and the same height, regardless of their optimal size.

    • Field Summary

      • Fields inherited from class ej.mwt.Widget

        NO_CONSTRAINT
    • Constructor Summary

      Constructors 
      Constructor Description
      FixedGrid​(int columns, int rows)
      Creates a grid specifying its number of columns and rows.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChild​(ej.mwt.Widget child, int column, int row)
      Adds a widget at the specified column and row.
      protected void computeContentOptimalSize​(ej.mwt.util.Size size)  
      ej.mwt.Widget getCellChild​(int column, int row)
      Gets the widget at the specified column and row.
      int getColumns()
      Gets the number of columns.
      int getRows()
      Gets the number of rows.
      protected void layOutChildren​(int contentWidth, int contentHeight)  
      void removeAllChildren()  
      void removeChild​(int column, int row)
      Removes the widget at the specified column and row.
      • Methods inherited from class ej.mwt.Container

        addChild, changeChildIndex, computeChildOptimalSize, getChild, getChildIndex, getChildren, getChildrenCount, getContentBounds, getContentHeight, getContentWidth, getContentX, getContentY, getWidgetAt, insertChild, layOutAlignedChild, layOutChild, removeChild, renderChild, renderContent, replaceChild, setHiddenChild, setHiddenChildren, setShownChild, setShownChildren, updateStyle
      • Methods inherited from class ej.mwt.Widget

        addClassSelector, contains, containsWidget, getAbsoluteX, getAbsoluteY, getDesktop, getHeight, getParent, getStyle, getWidth, getX, getY, handleEvent, hasClassSelector, isAttached, isEnabled, isInState, isShown, isTransparent, onAttached, onDetached, onHidden, onLaidOut, onShown, removeAllClassSelectors, removeClassSelector, render, requestLayOut, requestRender, requestRender, setClassSelectors, setEnabled, setPosition, setStyle
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FixedGrid

        public FixedGrid​(int columns,
                         int rows)
        Creates a grid specifying its number of columns and rows.
        Parameters:
        columns - the number of columns
        rows - the number of rows
        Throws:
        java.lang.IllegalArgumentException - if one of the parameters is negative or zero
    • Method Detail

      • getColumns

        public int getColumns()
        Gets the number of columns.
        Returns:
        the number of columns.
      • getRows

        public int getRows()
        Gets the number of rows.
        Returns:
        the number of rows.
      • getCellChild

        @Nullable
        public ej.mwt.Widget getCellChild​(int column,
                                          int row)
        Gets the widget at the specified column and row.
        Parameters:
        column - the column of the widget to return
        row - the row of the widget to return
        Returns:
        the widget at the specified column and row
        Throws:
        java.lang.IndexOutOfBoundsException - if the cell referenced by the given coordinates is out of range
      • addChild

        public void addChild​(ej.mwt.Widget child,
                             int column,
                             int row)
        Adds a widget at the specified column and row.
        Parameters:
        child - the child to add
        column - the column of the widget
        row - the row of the widget
        Throws:
        java.lang.IndexOutOfBoundsException - if the cell referenced by the given coordinates is out of range
      • removeChild

        public void removeChild​(int column,
                                int row)
        Removes the widget at the specified column and row.
        Parameters:
        column - the column of the widget
        row - the row of the widget
        Throws:
        java.lang.IndexOutOfBoundsException - if the cell referenced by the given coordinates is out of range
      • removeAllChildren

        public void removeAllChildren()
        Overrides:
        removeAllChildren in class ej.mwt.Container
      • computeContentOptimalSize

        protected void computeContentOptimalSize​(ej.mwt.util.Size size)
        Specified by:
        computeContentOptimalSize in class ej.mwt.Widget
      • layOutChildren

        protected void layOutChildren​(int contentWidth,
                                      int contentHeight)
        Specified by:
        layOutChildren in class ej.mwt.Container