public class Grid
extends ej.mwt.Container
All the children are laid out in a grid, which has a fixed number of columns if the grid is horizontal, or a fixed number of rows if the grid is vertical.
In a grid, all children have the same width and the same height, regardless of their optimal size.
Horizontal:
Vertical:
Constructor and Description |
---|
Grid(boolean orientation,
int count)
Creates a grid specifying its orientation and the number of widgets per row/column (depending on the orientation
chosen via the horizontal parameter).
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(ej.mwt.Widget child) |
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 |
getCount()
Gets the number of widgets per row/column (depending on the grid orientation).
|
boolean |
getOrientation()
Gets the orientation of this grid.
|
void |
insertChild(ej.mwt.Widget child,
int index) |
protected void |
layOutChildren(int contentWidth,
int contentHeight) |
void |
removeAllChildren() |
void |
removeChild(ej.mwt.Widget child) |
void |
replaceChild(int index,
ej.mwt.Widget child) |
void |
setCount(int count)
Sets the number of widgets per row/column (depending on the grid orientation).
|
void |
setOrientation(boolean orientation)
Sets the orientation of this grid.
|
changeChildIndex, computeChildOptimalSize, getChild, getChildIndex, getChildren, getChildrenCount, getContentBounds, getContentHeight, getContentWidth, getContentX, getContentY, getWidgetAt, layOutChild, renderChild, renderContent, setHiddenChild, setHiddenChildren, setShownChild, setShownChildren, updateStyle
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
public Grid(boolean orientation, int count)
orientation
- the orientation of the grid (see LayoutOrientation
).count
- the number of widgets per row/column to set.java.lang.IllegalArgumentException
- if the count is negative or zero.public void setOrientation(boolean orientation)
orientation
- the orientation to set (see LayoutOrientation
).public boolean getOrientation()
LayoutOrientation
).public void setCount(int count)
count
- the number of widgets per row/column to set.java.lang.IllegalArgumentException
- if the count is negative or zero.public int getCount()
public ej.mwt.Widget getCellChild(int column, int row)
column
- the column of the widget to return.row
- the row of the widget to return.java.lang.IndexOutOfBoundsException
- if the cell referenced by the given coordinates is out of range.public void addChild(ej.mwt.Widget child)
addChild
in class ej.mwt.Container
public void removeChild(ej.mwt.Widget child)
removeChild
in class ej.mwt.Container
public void insertChild(ej.mwt.Widget child, int index)
insertChild
in class ej.mwt.Container
public void replaceChild(int index, ej.mwt.Widget child)
replaceChild
in class ej.mwt.Container
public void removeAllChildren()
removeAllChildren
in class ej.mwt.Container
protected void computeContentOptimalSize(ej.mwt.util.Size size)
computeContentOptimalSize
in class ej.mwt.Widget
protected void layOutChildren(int contentWidth, int contentHeight)
layOutChildren
in class ej.mwt.Container