From 2364f3ec9fca600a5e926040ad3653de84bfed7d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Dahlstr=C3=B6m?= Date: Mon, 29 Oct 2012 15:43:31 +0200 Subject: [PATCH] Move deprecated getComponentIterator() from HasComponents to implementing classes (#10085) Change-Id: Iedcb7b51f6d2a095b402a7141dc906b112ee6fe7 --- server/src/com/vaadin/ui/ComponentContainer.java | 13 +++++++++++++ server/src/com/vaadin/ui/CustomField.java | 9 ++++++--- server/src/com/vaadin/ui/Form.java | 9 ++++++--- server/src/com/vaadin/ui/HasComponents.java | 6 ++---- server/src/com/vaadin/ui/Table.java | 14 ++++++++------ 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/server/src/com/vaadin/ui/ComponentContainer.java b/server/src/com/vaadin/ui/ComponentContainer.java index 50a6e7e148..3663134520 100644 --- a/server/src/com/vaadin/ui/ComponentContainer.java +++ b/server/src/com/vaadin/ui/ComponentContainer.java @@ -17,6 +17,7 @@ package com.vaadin.ui; import java.io.Serializable; +import java.util.Iterator; /** * Extension to the {@link Component} interface which adds to it the capacity to @@ -69,6 +70,18 @@ public interface ComponentContainer extends HasComponents { */ public void replaceComponent(Component oldComponent, Component newComponent); + /** + * Gets an iterator to the collection of contained components. Using this + * iterator it is possible to step through all components contained in this + * container. + * + * @return the component iterator. + * + * @deprecated As of 7.0, use {@link #iterator()} instead. + */ + @Deprecated + public Iterator getComponentIterator(); + /** * Gets the number of children this {@link ComponentContainer} has. This * must be symmetric with what {@link #getComponentIterator()} returns. diff --git a/server/src/com/vaadin/ui/CustomField.java b/server/src/com/vaadin/ui/CustomField.java index e782bd1783..67695fe54b 100644 --- a/server/src/com/vaadin/ui/CustomField.java +++ b/server/src/com/vaadin/ui/CustomField.java @@ -146,14 +146,17 @@ public abstract class CustomField extends AbstractField implements } } - @Override + /** + * @deprecated As of 7.0, use {@link #iterator()} instead. + */ + @Deprecated public Iterator getComponentIterator() { - return new ComponentIterator(); + return iterator(); } @Override public Iterator iterator() { - return getComponentIterator(); + return new ComponentIterator(); } @Override diff --git a/server/src/com/vaadin/ui/Form.java b/server/src/com/vaadin/ui/Form.java index 4b7782e0a9..46a335669e 100644 --- a/server/src/com/vaadin/ui/Form.java +++ b/server/src/com/vaadin/ui/Form.java @@ -1306,7 +1306,7 @@ public class Form extends AbstractField implements Item.Editor, @Override public Iterator iterator() { - return getComponentIterator(); + return new ComponentIterator(); } /** @@ -1355,9 +1355,12 @@ public class Form extends AbstractField implements Item.Editor, } } - @Override + /** + * @deprecated As of 7.0, use {@link #iterator()} instead. + */ + @Deprecated public Iterator getComponentIterator() { - return new ComponentIterator(); + return iterator(); } public int getComponentCount() { diff --git a/server/src/com/vaadin/ui/HasComponents.java b/server/src/com/vaadin/ui/HasComponents.java index 8f1dccc5c6..db0aa1ca8e 100644 --- a/server/src/com/vaadin/ui/HasComponents.java +++ b/server/src/com/vaadin/ui/HasComponents.java @@ -32,11 +32,9 @@ public interface HasComponents extends Component, Iterable { * container. * * @return the component iterator. - * - * @deprecated Use {@link #iterator()} instead. */ - @Deprecated - public Iterator getComponentIterator(); + @Override + public Iterator iterator(); /** * Checks if the child component is visible. This method allows hiding a diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java index 242593c20d..352b9212a7 100644 --- a/server/src/com/vaadin/ui/Table.java +++ b/server/src/com/vaadin/ui/Table.java @@ -5564,19 +5564,21 @@ public class Table extends AbstractSelect implements Action.Container, @Override public Iterator iterator() { - return getComponentIterator(); - } - - @Override - public Iterator getComponentIterator() { if (visibleComponents == null) { Collection empty = Collections.emptyList(); return empty.iterator(); } - return visibleComponents.iterator(); } + /** + * @deprecated As of 7.0, use {@link #iterator()} instead. + */ + @Deprecated + public Iterator getComponentIterator() { + return iterator(); + } + @Override public boolean isComponentVisible(Component childComponent) { return true; -- 2.39.5