diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/server/AbstractClientConnector.java | 4 | ||||
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java | 41 |
2 files changed, 29 insertions, 16 deletions
diff --git a/server/src/com/vaadin/server/AbstractClientConnector.java b/server/src/com/vaadin/server/AbstractClientConnector.java index b6bcebd167..fa2b741ddd 100644 --- a/server/src/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/com/vaadin/server/AbstractClientConnector.java @@ -610,11 +610,11 @@ public abstract class AbstractClientConnector implements ClientConnector, getUI().getConnectorTracker().registerConnector(this); - fireEvent(new AttachEvent(this)); - for (ClientConnector connector : getAllChildrenIterable(this)) { connector.attach(); } + + fireEvent(new AttachEvent(this)); } /** diff --git a/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java b/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java index 68964dbfd1..28c5be29cb 100644 --- a/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java +++ b/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListenersTest.java @@ -58,7 +58,15 @@ public class AttachDetachListenersTest { @Test public void attachListeners_setSessionLast() { - setupAttachListeners(); + attachListener.attach(eventEquals(new AttachEvent(component))); + attachListener.attach(eventEquals(new AttachEvent(content))); + attachListener.attach(eventEquals(new AttachEvent(ui))); + + control.replay(); + + ui.addAttachListener(attachListener); + content.addAttachListener(attachListener); + component.addAttachListener(attachListener); ui.setContent(content); content.addComponent(component); @@ -69,7 +77,15 @@ public class AttachDetachListenersTest { @Test public void attachListeners_setSessionFirst() { - setupAttachListeners(); + attachListener.attach(eventEquals(new AttachEvent(ui))); + attachListener.attach(eventEquals(new AttachEvent(content))); + attachListener.attach(eventEquals(new AttachEvent(component))); + + control.replay(); + + ui.addAttachListener(attachListener); + content.addAttachListener(attachListener); + component.addAttachListener(attachListener); ui.setSession(session); ui.setContent(content); @@ -80,7 +96,15 @@ public class AttachDetachListenersTest { @Test public void attachListeners_setSessionBetween() { - setupAttachListeners(); + attachListener.attach(eventEquals(new AttachEvent(content))); + attachListener.attach(eventEquals(new AttachEvent(ui))); + attachListener.attach(eventEquals(new AttachEvent(component))); + + control.replay(); + + ui.addAttachListener(attachListener); + content.addAttachListener(attachListener); + component.addAttachListener(attachListener); ui.setContent(content); ui.setSession(session); @@ -168,15 +192,4 @@ public class AttachDetachListenersTest { ui.setSession(session); } - private void setupAttachListeners() { - attachListener.attach(eventEquals(new AttachEvent(ui))); - attachListener.attach(eventEquals(new AttachEvent(content))); - attachListener.attach(eventEquals(new AttachEvent(component))); - - control.replay(); - - ui.addAttachListener(attachListener); - content.addAttachListener(attachListener); - component.addAttachListener(attachListener); - } } |