diff options
author | Artur Signell <artur@vaadin.com> | 2012-03-13 11:29:43 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-03-14 16:00:37 +0200 |
commit | 751d60aaf6b5dec813f5f7fe3d46717a0b1ca2ef (patch) | |
tree | 1e95a9de64853687c2f441a14f5e877ca9503e7b /src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java | |
parent | e248adc283ccc79ef89f3f752cd0f516e09f8a2c (diff) | |
download | vaadin-framework-751d60aaf6b5dec813f5f7fe3d46717a0b1ca2ef.tar.gz vaadin-framework-751d60aaf6b5dec813f5f7fe3d46717a0b1ca2ef.zip |
#8500, #3557 Added HasComponents (Iterable<Component>) that must be
implemented by all components containing components.
This might still change when #2924/#2527 is fixed
Diffstat (limited to 'src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java')
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java index 66e692694f..04f64ecaea 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractCommunicationManager.java @@ -68,7 +68,7 @@ import com.vaadin.terminal.gwt.server.ComponentSizeValidator.InvalidLayout; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.AbstractField; import com.vaadin.ui.Component; -import com.vaadin.ui.ComponentContainer; +import com.vaadin.ui.HasComponents; import com.vaadin.ui.Panel; import com.vaadin.ui.Root; @@ -945,14 +945,12 @@ public abstract class AbstractCommunicationManager implements JSONObject hierarchyInfo = new JSONObject(); for (Paintable p : hierarchyPendingQueue) { - if (p instanceof ComponentContainer) { - ComponentContainer cc = (ComponentContainer) p; + if (p instanceof HasComponents) { + HasComponents cc = (HasComponents) p; String connectorId = paintableIdMap.get(cc); JSONArray children = new JSONArray(); - Iterator<Component> iterator = getChildComponentIterator(cc); - while (iterator.hasNext()) { - Component child = iterator.next(); + for (Component child : getChildComponents(cc)) { if (child.getState().isVisible()) { String childConnectorId = getPaintableId(child); children.put(childConnectorId); @@ -1177,17 +1175,17 @@ public abstract class AbstractCommunicationManager implements } - private Iterator<Component> getChildComponentIterator(ComponentContainer cc) { + private Iterable<Component> getChildComponents(HasComponents cc) { if (cc instanceof Panel) { // This is so wrong.. (#2924) if (((Panel) cc).getContent() == null) { - return new NullIterator<Component>(); + return Collections.emptyList(); } else { - return Collections.singleton( - (Component) ((Panel) cc).getContent()).iterator(); + return Collections.singleton((Component) ((Panel) cc) + .getContent()); } } - return cc.getComponentIterator(); + return cc; } /** |