A container that consists of components with certain coordinates on a grid. It also maintains cursor for adding component in left to right, top to bottom order.
Each component in a
GridLayout
uses a certain
area
(x1,y1,x2,y2) from the grid. One should not
add components that would overlap with the existing components because in
such case an
com.itmill.toolkit.ui.GridLayout.OverlapsException
is thrown. Adding component with
cursor automatically extends the grid by increasing the grid height.
3.0
Inheritance Path. java.lang.Object-> com.itmill.toolkit.ui.AbstractComponent -> com.itmill.toolkit.ui.AbstractComponentContainer -> com.itmill.toolkit.ui.GridLayout
Parameters
width
Width of the grid.
height
Height of the grid.
Constructor for grid of given size. Note that grid's final size depends on the items that are added into the grid. Grid grows if you add components outside the grid's area.
Parameters
c
The component to be added.
Add a component into this container to the cursor position. If the cursor position is already occupied, the cursor is moved forwards to find free position. If the cursor goes out from the bottom of the grid, the grid is automaticly extended.
Parameters
c
The component to be added.
x
X-coordinate
y
Y-coordinate
Add component into this container to coordinates x1,y1 (NortWest corner of the area.) End coordinates (SouthEast corner of the area) are the same as x1,y1. Component width and height is 1.
Parameters
c
The component to be added.
x1
The X-coordinate of the upper left corner of the area
c
is supposed to occupy
y1
The Y-coordinate of the upper left corner of the area
c
is supposed to occupy
x2
The X-coordinate of the lower right corner of the area
c
is supposed to occupy
y2
The Y-coordinate of the lower right corner of the area
c
is supposed to occupy
Exceptions
OverlapsException
if the new component overlaps with any of the components already in the grid
OutOfBoundsException
if the coordinates are outside of the grid area.
Adds a component with a specified area to the grid. The area the new component should take is defined by specifying the upper left corner (x1, y1) and the lower right corner (x2, y2) of the area.
If the new component overlaps with any of the existing components
already present in the grid the operation will fail and an
com.itmill.toolkit.ui.GridLayout.OverlapsException
is thrown.
Parameters
Iterator of the components inside the container.
Gets an Iterator to the component container contents. Using the Iterator it's possible to step through the contents of the container.
Parameters
Cursor x-coordinate.
Get the current cursor x-position. The cursor position points the position for the next component that is added without specifying its coordinates. When the cursor position is occupied, the next component will be added to first free position after the cursor.
Parameters
Cursor y-coordinate.
Get the current cursor y-position. The cursor position points the position for the next component that is added without specifying its coordinates. When the cursor position is occupied, the next component will be added to first free position after the cursor.
space()
Force the next component to be added to the beginning of the next line. By calling this function user can ensure that no more components are added to the right of the previous component.
Parameters
event
PaintEvent.
Exceptions
PaintException
The paint operation failed.
Paints the contents of this component.
Parameters
c
The component to be removed.
Removes the given component from this container.
Parameters
x
Component's top-left corner's X-coordinate
y
Component's top-left corner's Y-coordinate
Removes a component specified with it's top-left corner coordinates from this grid.
Parameters
Height
of the grid
Set the height of the grid. The width can not be reduced if there are any areas that would be outside of the shrunk grid.
Parameters
width
New width of the grid.
Exceptions
OutOfBoundsException
if the one of the areas would exceed the bounds of the grid after the modification of the grid size.
Set the width of the grid. The width can not be reduced if there are any areas that would be outside of the shrunk grid.
newLine()
Move cursor forwards by one. If the cursor goes out of the right grid border, move it to next line.