diff options
Diffstat (limited to 'server/src/com/vaadin/ui/GridLayout.java')
-rw-r--r-- | server/src/com/vaadin/ui/GridLayout.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/GridLayout.java b/server/src/com/vaadin/ui/GridLayout.java index de167962e7..566bd812a3 100644 --- a/server/src/com/vaadin/ui/GridLayout.java +++ b/server/src/com/vaadin/ui/GridLayout.java @@ -140,6 +140,24 @@ public class GridLayout extends AbstractLayout implements this(1, 1); } + /** + * Constructs a GridLayout of given size (number of columns and rows) and + * adds the given components in order to the grid. + * + * @see #addComponents(Component...) + * + * @param columns + * Number of columns in the grid. + * @param rows + * Number of rows in the grid. + * @param children + * Components to add to the grid. + */ + public GridLayout(int columns, int rows, Component... children) { + this(columns, rows); + addComponents(children); + } + @Override protected GridLayoutState getState() { return (GridLayoutState) super.getState(); @@ -258,6 +276,19 @@ public class GridLayout extends AbstractLayout implements } /** + * Adds the given components to the grid starting from the current cursor + * position. + * + * @param components + * Components to add. + */ + public void addComponents(Component... components) { + for (Component c : components) { + this.addComponent(c); + } + } + + /** * Tests if the given area overlaps with any of the items already on the * grid. * |