From 2e6313e12b7c11706d154befd0cdf3a665f46365 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Mon, 13 Aug 2012 15:26:17 +0300 Subject: Rename VaadinContext -> AddonContext (#9273) --- ...vaadin.terminal.gwt.server.AddonContextListener | 1 + ...aadin.terminal.gwt.server.VaadinContextListener | 1 - .../vaadincontext/TestAddonContextListener.java | 54 ++++++++++++++++++++++ .../vaadincontext/TestVaadinContextListener.java | 54 ---------------------- 4 files changed, 55 insertions(+), 55 deletions(-) create mode 100644 tests/testbench/META-INF/services/com.vaadin.terminal.gwt.server.AddonContextListener delete mode 100644 tests/testbench/META-INF/services/com.vaadin.terminal.gwt.server.VaadinContextListener create mode 100644 tests/testbench/com/vaadin/tests/vaadincontext/TestAddonContextListener.java delete mode 100644 tests/testbench/com/vaadin/tests/vaadincontext/TestVaadinContextListener.java (limited to 'tests') diff --git a/tests/testbench/META-INF/services/com.vaadin.terminal.gwt.server.AddonContextListener b/tests/testbench/META-INF/services/com.vaadin.terminal.gwt.server.AddonContextListener new file mode 100644 index 0000000000..9b3d9eb082 --- /dev/null +++ b/tests/testbench/META-INF/services/com.vaadin.terminal.gwt.server.AddonContextListener @@ -0,0 +1 @@ +com.vaadin.tests.vaadincontext.TestAddonContextListener \ No newline at end of file diff --git a/tests/testbench/META-INF/services/com.vaadin.terminal.gwt.server.VaadinContextListener b/tests/testbench/META-INF/services/com.vaadin.terminal.gwt.server.VaadinContextListener deleted file mode 100644 index fd5ebaa53e..0000000000 --- a/tests/testbench/META-INF/services/com.vaadin.terminal.gwt.server.VaadinContextListener +++ /dev/null @@ -1 +0,0 @@ -com.vaadin.tests.vaadincontext.TestVaadinContextListener \ No newline at end of file diff --git a/tests/testbench/com/vaadin/tests/vaadincontext/TestAddonContextListener.java b/tests/testbench/com/vaadin/tests/vaadincontext/TestAddonContextListener.java new file mode 100644 index 0000000000..08db5c72ec --- /dev/null +++ b/tests/testbench/com/vaadin/tests/vaadincontext/TestAddonContextListener.java @@ -0,0 +1,54 @@ +/* +@VaadinApache2LicenseForJavaFiles@ + */ + +package com.vaadin.tests.vaadincontext; + +import org.jsoup.nodes.Element; +import org.jsoup.parser.Tag; + +import com.vaadin.terminal.gwt.server.BootstrapFragmentResponse; +import com.vaadin.terminal.gwt.server.BootstrapListener; +import com.vaadin.terminal.gwt.server.BootstrapPageResponse; +import com.vaadin.terminal.gwt.server.BootstrapResponse; +import com.vaadin.terminal.gwt.server.AddonContextEvent; +import com.vaadin.terminal.gwt.server.AddonContextListener; +import com.vaadin.ui.Root; + +public class TestAddonContextListener implements AddonContextListener { + @Override + public void contextCreated(AddonContextEvent event) { + event.getAddonContext().addBootstrapListener(new BootstrapListener() { + @Override + public void modifyBootstrapFragment( + BootstrapFragmentResponse response) { + if (shouldModify(response)) { + Element heading = new Element(Tag.valueOf("div"), "") + .text("Added by modifyBootstrapFragment"); + response.getFragmentNodes().add(0, heading); + } + } + + private boolean shouldModify(BootstrapResponse response) { + Root root = response.getRoot(); + boolean shouldModify = root != null + && root.getClass() == BoostrapModifyRoot.class; + return shouldModify; + } + + @Override + public void modifyBootstrapPage(BootstrapPageResponse response) { + if (shouldModify(response)) { + response.getDocument().body().child(0) + .before("
Added by modifyBootstrapPage
"); + } + } + }); + } + + @Override + public void contextDestoryed(AddonContextEvent event) { + // Nothing to do + } + +} diff --git a/tests/testbench/com/vaadin/tests/vaadincontext/TestVaadinContextListener.java b/tests/testbench/com/vaadin/tests/vaadincontext/TestVaadinContextListener.java deleted file mode 100644 index 9d1fc6b6c3..0000000000 --- a/tests/testbench/com/vaadin/tests/vaadincontext/TestVaadinContextListener.java +++ /dev/null @@ -1,54 +0,0 @@ -/* -@VaadinApache2LicenseForJavaFiles@ - */ - -package com.vaadin.tests.vaadincontext; - -import org.jsoup.nodes.Element; -import org.jsoup.parser.Tag; - -import com.vaadin.terminal.gwt.server.BootstrapFragmentResponse; -import com.vaadin.terminal.gwt.server.BootstrapListener; -import com.vaadin.terminal.gwt.server.BootstrapPageResponse; -import com.vaadin.terminal.gwt.server.BootstrapResponse; -import com.vaadin.terminal.gwt.server.VaadinContextEvent; -import com.vaadin.terminal.gwt.server.VaadinContextListener; -import com.vaadin.ui.Root; - -public class TestVaadinContextListener implements VaadinContextListener { - @Override - public void contextCreated(VaadinContextEvent event) { - event.getVaadinContext().addBootstrapListener(new BootstrapListener() { - @Override - public void modifyBootstrapFragment( - BootstrapFragmentResponse response) { - if (shouldModify(response)) { - Element heading = new Element(Tag.valueOf("div"), "") - .text("Added by modifyBootstrapFragment"); - response.getFragmentNodes().add(0, heading); - } - } - - private boolean shouldModify(BootstrapResponse response) { - Root root = response.getRoot(); - boolean shouldModify = root != null - && root.getClass() == BoostrapModifyRoot.class; - return shouldModify; - } - - @Override - public void modifyBootstrapPage(BootstrapPageResponse response) { - if (shouldModify(response)) { - response.getDocument().body().child(0) - .before("
Added by modifyBootstrapPage
"); - } - } - }); - } - - @Override - public void contextDestoryed(VaadinContextEvent event) { - // Nothing to do - } - -} -- cgit v1.2.3