From c19b1fee143f8dfeb681ba5c58d582c607ee48a6 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Thu, 22 Nov 2012 12:29:49 +0200 Subject: [PATCH] Added ComponentContainer.addComponents (#10245) Change-Id: Ie859d194456466424c55ef5e1c2a330f0172e5de --- .../com/vaadin/ui/AbstractComponentContainer.java | 13 +++++++++++++ .../src/com/vaadin/ui/AbstractOrderedLayout.java | 12 ------------ server/src/com/vaadin/ui/ComponentContainer.java | 14 +++++++++++--- server/src/com/vaadin/ui/CssLayout.java | 13 ------------- server/src/com/vaadin/ui/GridLayout.java | 13 ------------- 5 files changed, 24 insertions(+), 41 deletions(-) diff --git a/server/src/com/vaadin/ui/AbstractComponentContainer.java b/server/src/com/vaadin/ui/AbstractComponentContainer.java index b5cc3da861..135194f12c 100644 --- a/server/src/com/vaadin/ui/AbstractComponentContainer.java +++ b/server/src/com/vaadin/ui/AbstractComponentContainer.java @@ -43,6 +43,19 @@ public abstract class AbstractComponentContainer extends AbstractComponent super(); } + /* + * (non-Javadoc) + * + * @see + * com.vaadin.ui.ComponentContainer#addComponents(com.vaadin.ui.Component[]) + */ + @Override + public void addComponents(Component... components) { + for (Component c : components) { + addComponent(c); + } + } + /** * Removes all components from the container. This should probably be * re-implemented in extending classes for a more powerful implementation. diff --git a/server/src/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/com/vaadin/ui/AbstractOrderedLayout.java index 729862a93e..5f5768a237 100644 --- a/server/src/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/com/vaadin/ui/AbstractOrderedLayout.java @@ -112,18 +112,6 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements } - /** - * Adds the given components in the given order to the container. - * - * @param components - * The components to add. - */ - public void addComponents(Component... components) { - for (Component c : components) { - addComponent(c); - } - } - /** * Adds a component into indexed position in this container. * diff --git a/server/src/com/vaadin/ui/ComponentContainer.java b/server/src/com/vaadin/ui/ComponentContainer.java index 5ef41d7cbf..5c544ceffb 100644 --- a/server/src/com/vaadin/ui/ComponentContainer.java +++ b/server/src/com/vaadin/ui/ComponentContainer.java @@ -21,9 +21,9 @@ import java.util.Iterator; import com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier; /** - * Extension to the {@link Component} interface which adds to it the capacity to - * contain other components. All UI elements that can have child elements - * implement this interface. + * A special type of parent which allows the user to add and remove components + * to it. Typically does not have any restrictions on the number of children it + * can contain. * * @author Vaadin Ltd. * @since 3.0 @@ -39,6 +39,14 @@ public interface ComponentContainer extends HasComponents, */ public void addComponent(Component c); + /** + * Adds the components in the given order to this component container. + * + * @param components + * The components to add. + */ + public void addComponents(Component... components); + /** * Removes the component from this container. * diff --git a/server/src/com/vaadin/ui/CssLayout.java b/server/src/com/vaadin/ui/CssLayout.java index aa072df946..228624769f 100644 --- a/server/src/com/vaadin/ui/CssLayout.java +++ b/server/src/com/vaadin/ui/CssLayout.java @@ -125,19 +125,6 @@ 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. diff --git a/server/src/com/vaadin/ui/GridLayout.java b/server/src/com/vaadin/ui/GridLayout.java index 8fda05baf1..2504592058 100644 --- a/server/src/com/vaadin/ui/GridLayout.java +++ b/server/src/com/vaadin/ui/GridLayout.java @@ -274,19 +274,6 @@ public class GridLayout extends AbstractLayout implements markAsDirty(); } - /** - * 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. -- 2.39.5