public class Grid extends StyledComposite
All columns have the same width and all rows have the same height.
Horizontal:
Vertical:
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
Grid()
Creates a horizontal grid composite.
|
Grid(boolean horizontal,
int count)
Creates a grid composite specifying its orientation and number of widgets per line/column (depending on the
orientation chosen via the horizontal parameter).
|
Modifier and Type | Method and Description |
---|---|
void |
add(ej.mwt.Widget widget) |
void |
remove(ej.mwt.Widget widget) |
void |
removeAllWidgets() |
protected void |
setBoundsContent(Rectangle bounds)
Sets the bounds of this widget by taking into account the border, margin and padding specified in the style.
|
void |
setCount(int count)
Sets the number of widgets to set on a line or a column (for horizontal or vertical orientations respectively).
|
void |
setHorizontal(boolean horizontal)
Sets the composite orientation: horizontal or vertical.
|
Rectangle |
validateContent(Style style,
Rectangle bounds)
Gets the content size of the renderable without the border, margin and padding specified in the style.
|
addClassSelector, contains, gainFocus, getAttribute, getChild, getChildrenCount, getChildrenElements, getParentElement, getStyle, hasClassSelector, isInState, isTransparent, lostFocus, mergeStyle, removeAllClassSelectors, removeClassSelector, removeInstanceStyle, render, renderContent, setBounds, setClassSelectors, setEnabled, updateStyle, updateStyleOnly, validate
getFocus, getFocusIndex, getNext, getWidget, getWidgetAt, getWidgets, getWidgetsCount, handleEvent, hideNotify, iterator, requestFocus, requestFocus, requestFocusFrom, showNotify
getAbsoluteX, getAbsoluteX, getAbsoluteY, getAbsoluteY, getEventHandler, getHeight, getPanel, getParent, getPreferredHeight, getPreferredWidth, getRelativeX, getRelativeY, getWidth, getX, getY, hasFocus, invalidate, isEnabled, isShown, isValid, isVisible, repaint, repaint, revalidate, revalidateSubTree, setEventHandler, setLocation, setPreferredSize, setSize, setVisible
public Grid()
public Grid(boolean horizontal, int count)
horizontal
- true
to set the composite horizontal, false
to set the composite vertical.count
- the number of widgets to set.public void setHorizontal(boolean horizontal)
horizontal
- true
to set the composite horizontal, false
to set the composite vertical.public void setCount(int count)
count
- the number of widgets to set.public void add(ej.mwt.Widget widget) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
StyledComposite
If the given widget is not an Element
, an IllegalArgumentException
is thrown.
add
in class StyledComposite
java.lang.IllegalArgumentException
- if the given widget is not an element.java.lang.NullPointerException
Element
,
StyledWidget
,
StyledComposite
public void remove(ej.mwt.Widget widget) throws java.lang.NullPointerException
remove
in class ej.mwt.Composite
java.lang.NullPointerException
public void removeAllWidgets()
removeAllWidgets
in class ej.mwt.Composite
public Rectangle validateContent(Style style, Rectangle bounds)
StyledComposite
Lays out the children of this composite.
validateContent
in interface StyledRenderable
validateContent
in class StyledComposite
style
- the style to use.bounds
- the bounds available for the content. A width or a height equals to MWT.NONE
means no
constraint on this dimension.protected void setBoundsContent(Rectangle bounds)
StyledComposite
setBoundsContent
in class StyledComposite
bounds
- the bounds available for the content.