diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-09-07 16:31:16 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-09-07 17:12:24 +0300 |
commit | 1fb7d999a09bea25256eef0e9837523c7c81841f (patch) | |
tree | 62e239d911bdc064a07621a4b4203c54c7c11349 /server/src/com/vaadin/ui/CssLayout.java | |
parent | 544152d1adc3a098445f7b11b4651fcc3c2f13bc (diff) | |
download | vaadin-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/CssLayout.java')
-rw-r--r-- | server/src/com/vaadin/ui/CssLayout.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/server/src/com/vaadin/ui/CssLayout.java b/server/src/com/vaadin/ui/CssLayout.java index 9ac29c4deb..401eafe6e9 100644 --- a/server/src/com/vaadin/ui/CssLayout.java +++ b/server/src/com/vaadin/ui/CssLayout.java @@ -84,13 +84,29 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { */ protected LinkedList<Component> components = new LinkedList<Component>(); + /** + * Constructs an empty CssLayout. + */ public CssLayout() { registerRpc(rpc); } /** + * Constructs a CssLayout with the given components in the given order. + * + * @see #addComponents(Component...) + * + * @param children + * Components to add to the container. + */ + public CssLayout(Component... children) { + this(); + addComponents(children); + } + + /** * Add a component into this container. The component is added to the right - * or under the previous component. + * or below the previous component. * * @param c * the component to be added. @@ -110,6 +126,19 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { } /** + * Adds the given components into this container. Each component is added to + * the right or below the previous component. + * + * @param components + * The components to add. + */ + public void addComponents(Component... components) { + for (Component c : components) { + addComponent(c); + } + } + + /** * Adds a component into this container. The component is added to the left * or on top of the other components. * |