aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/GridLayout.java
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2012-09-07 16:31:16 +0300
committerJohannes Dahlström <johannesd@vaadin.com>2012-09-07 17:12:24 +0300
commit1fb7d999a09bea25256eef0e9837523c7c81841f (patch)
tree62e239d911bdc064a07621a4b4203c54c7c11349 /server/src/com/vaadin/ui/GridLayout.java
parent544152d1adc3a098445f7b11b4651fcc3c2f13bc (diff)
downloadvaadin-framework-1fb7d999a09bea25256eef0e9837523c7c81841f.tar.gz
vaadin-framework-1fb7d999a09bea25256eef0e9837523c7c81841f.zip
Commit Pekka's patch for #8030 ((Component...) constructor for layouts) and #5422 (addComponents(Component...) for layouts) with minor formatting/javadoc changes
Diffstat (limited to 'server/src/com/vaadin/ui/GridLayout.java')
-rw-r--r--server/src/com/vaadin/ui/GridLayout.java31
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.
*