diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2012-06-19 13:46:38 +0300 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2012-06-19 13:46:38 +0300 |
commit | d3a13928a8f856ae3bff668db7f13d6f60f7a358 (patch) | |
tree | 3018f9bc5251958d1ac92735f52420448ae26796 /tests | |
parent | 66e9b8cec5bd22672b8498716015ec3e2dc748aa (diff) | |
parent | 10237a5329d87c44e5d6d0ccd4a19231549f0a2d (diff) | |
download | vaadin-framework-d3a13928a8f856ae3bff668db7f13d6f60f7a358.tar.gz vaadin-framework-d3a13928a8f856ae3bff668db7f13d6f60f7a358.zip |
Merge remote-tracking branch 'origin/master'
Conflicts:
tests/testbench/com/vaadin/tests/integration/EmbedSizeTest.java
Diffstat (limited to 'tests')
36 files changed, 120 insertions, 148 deletions
diff --git a/tests/server-side/com/vaadin/tests/server/navigator/NavigatorTest.java b/tests/server-side/com/vaadin/tests/server/navigator/NavigatorTest.java index ab983b4022..03f49d4ab6 100644 --- a/tests/server-side/com/vaadin/tests/server/navigator/NavigatorTest.java +++ b/tests/server-side/com/vaadin/tests/server/navigator/NavigatorTest.java @@ -19,9 +19,9 @@ import com.vaadin.navigator.ViewChangeListener; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; import com.vaadin.navigator.ViewDisplay; import com.vaadin.navigator.ViewProvider; +import com.vaadin.terminal.Page; import com.vaadin.tests.server.navigator.ClassBasedViewProviderTest.TestView; import com.vaadin.tests.server.navigator.ClassBasedViewProviderTest.TestView2; -import com.vaadin.ui.Root; public class NavigatorTest extends TestCase { @@ -366,9 +366,9 @@ public class NavigatorTest extends TestCase { public void testDefaultDisplayType() { IMocksControl control = EasyMock.createControl(); - Root root = control.createMock(Root.class); + Page page = control.createMock(Page.class); - Navigator navigator = new Navigator(root); + Navigator navigator = new Navigator(page); assertEquals("Default display should be a SimpleViewDisplay", SimpleViewDisplay.class, navigator.getDisplay().getClass()); diff --git a/tests/server-side/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java b/tests/server-side/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java index cfbf50f256..65294b2913 100644 --- a/tests/server-side/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java +++ b/tests/server-side/com/vaadin/tests/server/navigator/UriFragmentManagerTest.java @@ -11,20 +11,20 @@ import org.easymock.IMocksControl; import com.vaadin.navigator.Navigator; import com.vaadin.navigator.Navigator.UriFragmentManager; -import com.vaadin.ui.Root; -import com.vaadin.ui.Root.FragmentChangedEvent; +import com.vaadin.terminal.Page; +import com.vaadin.terminal.Page.FragmentChangedEvent; public class UriFragmentManagerTest extends TestCase { public void testGetSetFragment() { - Root root = EasyMock.createMock(Root.class); - UriFragmentManager manager = new UriFragmentManager(root, null); + Page page = EasyMock.createMock(Page.class); + UriFragmentManager manager = new UriFragmentManager(page, null); // prepare mock - EasyMock.expect(root.getFragment()).andReturn(""); - root.setFragment("test"); - EasyMock.expect(root.getFragment()).andReturn("test"); - EasyMock.replay(root); + EasyMock.expect(page.getFragment()).andReturn(""); + page.setFragment("test"); + EasyMock.expect(page.getFragment()).andReturn("test"); + EasyMock.replay(page); // test manager using the mock assertEquals("Incorrect fragment value", "", manager.getFragment()); @@ -36,15 +36,15 @@ public class UriFragmentManagerTest extends TestCase { // create mocks IMocksControl control = EasyMock.createControl(); Navigator navigator = control.createMock(Navigator.class); - Root root = control.createMock(Root.class); + Page page = control.createMock(Page.class); - UriFragmentManager manager = new UriFragmentManager(root, navigator); + UriFragmentManager manager = new UriFragmentManager(page, navigator); - EasyMock.expect(root.getFragment()).andReturn("test"); + EasyMock.expect(page.getFragment()).andReturn("test"); navigator.navigateTo("test"); control.replay(); - FragmentChangedEvent event = root.new FragmentChangedEvent(root, + FragmentChangedEvent event = page.new FragmentChangedEvent(page, "oldtest"); manager.fragmentChanged(event); } diff --git a/tests/testbench/com/vaadin/tests/TestBench.java b/tests/testbench/com/vaadin/tests/TestBench.java index c3bb24cbef..1ac497e574 100644 --- a/tests/testbench/com/vaadin/tests/TestBench.java +++ b/tests/testbench/com/vaadin/tests/TestBench.java @@ -16,6 +16,8 @@ import com.vaadin.Application; import com.vaadin.data.Property; import com.vaadin.data.util.HierarchicalContainer; import com.vaadin.terminal.ExternalResource; +import com.vaadin.terminal.Page; +import com.vaadin.terminal.Page.FragmentChangedEvent; import com.vaadin.ui.Component; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.HorizontalSplitPanel; @@ -23,8 +25,6 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Layout; import com.vaadin.ui.Link; import com.vaadin.ui.Panel; -import com.vaadin.ui.Root; -import com.vaadin.ui.Root.FragmentChangedEvent; import com.vaadin.ui.Root.LegacyWindow; import com.vaadin.ui.Tree; import com.vaadin.ui.VerticalLayout; @@ -119,7 +119,7 @@ public class TestBench extends com.vaadin.Application.LegacyApplication VerticalLayout lo = new VerticalLayout(); lo.addComponent(menu); - mainWindow.addListener(new Root.FragmentChangedListener() { + mainWindow.getPage().addListener(new Page.FragmentChangedListener() { public void fragmentChanged(FragmentChangedEvent source) { String fragment = source.getFragment(); if (fragment != null && !"".equals(fragment)) { diff --git a/tests/testbench/com/vaadin/tests/TestComponentAddAndRecursion.java b/tests/testbench/com/vaadin/tests/TestComponentAddAndRecursion.java index 48eff0336e..c63c0caf16 100644 --- a/tests/testbench/com/vaadin/tests/TestComponentAddAndRecursion.java +++ b/tests/testbench/com/vaadin/tests/TestComponentAddAndRecursion.java @@ -10,7 +10,6 @@ import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Notification; import com.vaadin.ui.Panel; -import com.vaadin.ui.Root; import com.vaadin.ui.VerticalLayout; /** @@ -92,12 +91,10 @@ public class TestComponentAddAndRecursion extends CustomComponent { public void buttonClick(ClickEvent event) { try { p3.addComponent(p2); - Root.getCurrentRoot().showNotification("ERROR", - "This should have failed", + Notification.show("ERROR", "This should have failed", Notification.TYPE_ERROR_MESSAGE); } catch (Exception e) { - Root.getCurrentRoot().showNotification("OK", - "threw, as expected", + Notification.show("OK", "threw, as expected", Notification.TYPE_ERROR_MESSAGE); } } @@ -111,12 +108,10 @@ public class TestComponentAddAndRecursion extends CustomComponent { p.addComponent(p2); try { p3.addComponent(p); - Root.getCurrentRoot().showNotification("ERROR", - "This should have failed", + Notification.show("ERROR", "This should have failed", Notification.TYPE_ERROR_MESSAGE); } catch (Exception e) { - Root.getCurrentRoot().showNotification("OK", - "threw, as expected", + Notification.show("OK", "threw, as expected", Notification.TYPE_ERROR_MESSAGE); } } diff --git a/tests/testbench/com/vaadin/tests/TestForWindowOpen.java b/tests/testbench/com/vaadin/tests/TestForWindowOpen.java index c9dbf8dabe..76154f2419 100644 --- a/tests/testbench/com/vaadin/tests/TestForWindowOpen.java +++ b/tests/testbench/com/vaadin/tests/TestForWindowOpen.java @@ -24,7 +24,7 @@ public class TestForWindowOpen extends CustomComponent { public void buttonClick(ClickEvent event) { final ExternalResource r = new ExternalResource( "http://www.google.com"); - Root.getCurrentRoot().open(r); + Root.getCurrentRoot().getPage().open(r); } @@ -36,7 +36,7 @@ public class TestForWindowOpen extends CustomComponent { public void buttonClick(ClickEvent event) { final ExternalResource r = new ExternalResource( "http://www.google.com"); - Root.getCurrentRoot().open(r, "mytarget"); + Root.getCurrentRoot().getPage().open(r, "mytarget"); } @@ -48,7 +48,7 @@ public class TestForWindowOpen extends CustomComponent { public void buttonClick(ClickEvent event) { final ExternalResource r = new ExternalResource( "http://www.google.com"); - Root.getCurrentRoot().open(r, "secondtarget"); + Root.getCurrentRoot().getPage().open(r, "secondtarget"); } diff --git a/tests/testbench/com/vaadin/tests/appengine/GAESyncTest.java b/tests/testbench/com/vaadin/tests/appengine/GAESyncTest.java index 7d5e298286..58faec35f0 100644 --- a/tests/testbench/com/vaadin/tests/appengine/GAESyncTest.java +++ b/tests/testbench/com/vaadin/tests/appengine/GAESyncTest.java @@ -91,7 +91,8 @@ public class GAESyncTest extends Application.LegacyApplication { public void buttonClick(ClickEvent event) { if (getRoot() == getMainWindow()) { - getRoot().showNotification("main"); + getRoot().getPage().showNotification( + new Notification("main")); try { Thread.sleep((5000)); } catch (InterruptedException e) { diff --git a/tests/testbench/com/vaadin/tests/components/AbstractTestRoot.java b/tests/testbench/com/vaadin/tests/components/AbstractTestRoot.java index fd90cf2d6e..72cbcd386e 100644 --- a/tests/testbench/com/vaadin/tests/components/AbstractTestRoot.java +++ b/tests/testbench/com/vaadin/tests/components/AbstractTestRoot.java @@ -15,7 +15,7 @@ public abstract class AbstractTestRoot extends Root { @Override public void init(WrappedRequest request) { - setCaption(getClass().getName()); + getPage().setTitle(getClass().getName()); Label label = new Label(getTestDescription(), ContentMode.XHTML); label.setWidth("100%"); diff --git a/tests/testbench/com/vaadin/tests/components/TouchScrollables.java b/tests/testbench/com/vaadin/tests/components/TouchScrollables.java index 053691e738..8ad12da85f 100644 --- a/tests/testbench/com/vaadin/tests/components/TouchScrollables.java +++ b/tests/testbench/com/vaadin/tests/components/TouchScrollables.java @@ -24,6 +24,7 @@ import com.vaadin.ui.CssLayout; import com.vaadin.ui.HorizontalSplitPanel; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; +import com.vaadin.ui.Notification; import com.vaadin.ui.Panel; import com.vaadin.ui.TabSheet; import com.vaadin.ui.Table; @@ -189,7 +190,7 @@ public class TouchScrollables extends TestBase { } public void handleAction(Action action, Object sender, Object target) { - getLayout().getRoot().showNotification(action.getCaption()); + Notification.show(action.getCaption()); } }); diff --git a/tests/testbench/com/vaadin/tests/components/customfield/AddressFormExample.java b/tests/testbench/com/vaadin/tests/components/customfield/AddressFormExample.java index 55e61e3980..02c080e8fd 100644 --- a/tests/testbench/com/vaadin/tests/components/customfield/AddressFormExample.java +++ b/tests/testbench/com/vaadin/tests/components/customfield/AddressFormExample.java @@ -4,6 +4,7 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Address; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Notification; /** * Demonstrate a custom field which is a form, and contains another custom field @@ -23,10 +24,9 @@ public class AddressFormExample extends TestBase { public void buttonClick(ClickEvent event) { field.commit(); Address address = field.getValue(); - field.getRoot().showNotification( - "Address saved: " + address.getStreetAddress() + ", " - + address.getPostalCode() + ", " - + address.getCity()); + Notification.show("Address saved: " + + address.getStreetAddress() + ", " + + address.getPostalCode() + ", " + address.getCity()); } }); addComponent(commitButton); diff --git a/tests/testbench/com/vaadin/tests/components/customfield/BooleanFieldExample.java b/tests/testbench/com/vaadin/tests/components/customfield/BooleanFieldExample.java index 2f9720a1c1..694c5b54f9 100644 --- a/tests/testbench/com/vaadin/tests/components/customfield/BooleanFieldExample.java +++ b/tests/testbench/com/vaadin/tests/components/customfield/BooleanFieldExample.java @@ -10,6 +10,7 @@ import com.vaadin.ui.Component; import com.vaadin.ui.DefaultFieldFactory; import com.vaadin.ui.Field; import com.vaadin.ui.Form; +import com.vaadin.ui.Notification; import com.vaadin.ui.VerticalLayout; public class BooleanFieldExample extends TestBase { @@ -62,13 +63,10 @@ public class BooleanFieldExample extends TestBase { Button submit = new Button("Submit", new ClickListener() { public void buttonClick(ClickEvent event) { form.commit(); - layout.getRoot() - .showNotification( - "The custom boolean field value is " - + data.isCustom() - + ".<br>" - + "The checkbox (default boolean field) value is " - + data.isNormal() + "."); + Notification.show("The custom boolean field value is " + + data.isCustom() + ".<br>" + + "The checkbox (default boolean field) value is " + + data.isNormal() + "."); } }); layout.addComponent(submit); diff --git a/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java b/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java index 6519e4ae74..5f2f945c8b 100644 --- a/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java +++ b/tests/testbench/com/vaadin/tests/components/javascriptcomponent/BasicJavaScriptComponent.java @@ -15,7 +15,7 @@ import com.vaadin.terminal.gwt.client.ui.JavaScriptComponentState; import com.vaadin.tests.components.AbstractTestRoot; import com.vaadin.ui.AbstractJavaScriptComponent; import com.vaadin.ui.JavaScriptCallback; -import com.vaadin.ui.Root; +import com.vaadin.ui.Notification; @LoadScripts({ "/statictestfiles/jsconnector.js" }) public class BasicJavaScriptComponent extends AbstractTestRoot { @@ -40,14 +40,13 @@ public class BasicJavaScriptComponent extends AbstractTestRoot { public ExampleWidget() { registerRpc(new ExampleClickRpc() { public void onClick(String message) { - Root.getCurrentRoot().showNotification( - "Got a click: " + message); + Notification.show("Got a click: " + message); } }); registerCallback("onclick", new JavaScriptCallback() { public void call(JSONArray arguments) throws JSONException { - Root.getCurrentRoot().showNotification( - "Got a callback: " + arguments.getString(0)); + Notification.show("Got a callback: " + + arguments.getString(0)); } }); getState().setData(Arrays.asList("a", "b", "c")); diff --git a/tests/testbench/com/vaadin/tests/components/notification/Notifications.java b/tests/testbench/com/vaadin/tests/components/notification/Notifications.java index 27aef918d1..a36fbe3121 100644 --- a/tests/testbench/com/vaadin/tests/components/notification/Notifications.java +++ b/tests/testbench/com/vaadin/tests/components/notification/Notifications.java @@ -6,7 +6,6 @@ import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.Notification; -import com.vaadin.ui.Root; import com.vaadin.ui.TextArea; public class Notifications extends TestBase implements ClickListener { @@ -53,7 +52,6 @@ public class Notifications extends TestBase implements ClickListener { public void buttonClick(ClickEvent event) { Notification n = new Notification(tf.getValue(), (Integer) type.getValue()); - Root.getCurrentRoot().showNotification(n); - + n.show(); } } diff --git a/tests/testbench/com/vaadin/tests/components/notification/NotificationsHtmlAllowed.java b/tests/testbench/com/vaadin/tests/components/notification/NotificationsHtmlAllowed.java index 152688d109..a16b8edcde 100644 --- a/tests/testbench/com/vaadin/tests/components/notification/NotificationsHtmlAllowed.java +++ b/tests/testbench/com/vaadin/tests/components/notification/NotificationsHtmlAllowed.java @@ -6,7 +6,6 @@ import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Notification; -import com.vaadin.ui.Root; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; @@ -46,15 +45,13 @@ public class NotificationsHtmlAllowed extends TestBase implements ClickListener public void buttonClick(ClickEvent event) { Notification n = makeNotification(); - Root.getCurrentRoot().showNotification(n); - + n.show(); } private Notification makeNotification() { - Notification n = new Notification((String) captionField.getValue(), - (String) messageField.getValue(), - Notification.TYPE_HUMANIZED_MESSAGE, - (Boolean) htmlAllowedBox.getValue()); + Notification n = new Notification(captionField.getValue(), + messageField.getValue(), Notification.TYPE_HUMANIZED_MESSAGE, + htmlAllowedBox.getValue()); return n; } } diff --git a/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java b/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java index 95691ef9d7..98f31cd68c 100644 --- a/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java +++ b/tests/testbench/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java @@ -6,6 +6,7 @@ import com.vaadin.event.ShortcutAction; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.AbstractField; import com.vaadin.ui.Component; +import com.vaadin.ui.Notification; import com.vaadin.ui.Panel; import com.vaadin.ui.RichTextArea; import com.vaadin.ui.Window; @@ -30,7 +31,7 @@ public class RichTextAreaWithKeyboardShortcuts extends TestBase { String string = f.getValue().toString(); msg += " Value: " + string; - f.getRoot().showNotification(msg); + Notification.show(msg); } diff --git a/tests/testbench/com/vaadin/tests/components/root/UriFragmentTest.java b/tests/testbench/com/vaadin/tests/components/root/UriFragmentTest.java index 6078161996..251672fb9a 100644 --- a/tests/testbench/com/vaadin/tests/components/root/UriFragmentTest.java +++ b/tests/testbench/com/vaadin/tests/components/root/UriFragmentTest.java @@ -1,5 +1,7 @@ package com.vaadin.tests.components.root; +import com.vaadin.terminal.Page; +import com.vaadin.terminal.Page.FragmentChangedEvent; import com.vaadin.terminal.WrappedRequest; import com.vaadin.tests.components.AbstractTestRoot; import com.vaadin.ui.Button; @@ -14,7 +16,7 @@ public class UriFragmentTest extends AbstractTestRoot { protected void setup(WrappedRequest request) { addComponent(fragmentLabel); updateLabel(); - addListener(new FragmentChangedListener() { + getPage().addListener(new Page.FragmentChangedListener() { public void fragmentChanged(FragmentChangedEvent event) { updateLabel(); } @@ -22,13 +24,13 @@ public class UriFragmentTest extends AbstractTestRoot { addComponent(new Button("Navigate to #test", new Button.ClickListener() { public void buttonClick(ClickEvent event) { - setFragment("test"); + getPage().setFragment("test"); } })); } private void updateLabel() { - String fragment = getFragment(); + String fragment = getPage().getFragment(); if (fragment == null) { fragmentLabel.setValue("No URI fragment set"); } else { diff --git a/tests/testbench/com/vaadin/tests/components/table/MultiSelectWithNotIdentityEqualIds.java b/tests/testbench/com/vaadin/tests/components/table/MultiSelectWithNotIdentityEqualIds.java index 9178b284f3..6773f0a96c 100644 --- a/tests/testbench/com/vaadin/tests/components/table/MultiSelectWithNotIdentityEqualIds.java +++ b/tests/testbench/com/vaadin/tests/components/table/MultiSelectWithNotIdentityEqualIds.java @@ -5,6 +5,7 @@ import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.util.IndexedContainer; import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Notification; import com.vaadin.ui.Table; @SuppressWarnings("serial") @@ -20,8 +21,7 @@ public class MultiSelectWithNotIdentityEqualIds extends TestBase { t.setImmediate(true); t.addListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { - t.getRoot() - .showNotification("Selected: " + event.getProperty()); + Notification.show("Selected: " + event.getProperty()); } }); diff --git a/tests/testbench/com/vaadin/tests/components/table/TableContextMenu.java b/tests/testbench/com/vaadin/tests/components/table/TableContextMenu.java index 16323e5024..06afd406ef 100644 --- a/tests/testbench/com/vaadin/tests/components/table/TableContextMenu.java +++ b/tests/testbench/com/vaadin/tests/components/table/TableContextMenu.java @@ -2,6 +2,7 @@ package com.vaadin.tests.components.table; import com.vaadin.event.Action; import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Notification; import com.vaadin.ui.Table; public class TableContextMenu extends TestBase { @@ -16,7 +17,7 @@ public class TableContextMenu extends TestBase { table.addActionHandler(new Action.Handler() { public void handleAction(Action action, Object sender, Object target) { - getLayout().getRoot().showNotification("Done that :-)"); + Notification.show("Done that :-)"); } public Action[] getActions(Object target, Object sender) { diff --git a/tests/testbench/com/vaadin/tests/components/table/TableShouldNotEatValueChanges.java b/tests/testbench/com/vaadin/tests/components/table/TableShouldNotEatValueChanges.java index a1686dee3f..d64bc0035d 100644 --- a/tests/testbench/com/vaadin/tests/components/table/TableShouldNotEatValueChanges.java +++ b/tests/testbench/com/vaadin/tests/components/table/TableShouldNotEatValueChanges.java @@ -27,10 +27,8 @@ public class TableShouldNotEatValueChanges extends TestBase { ItemClickListener l = new ItemClickListener() { public void itemClick(ItemClickEvent event) { - tf.getRoot().showNotification( - "TF Value on the server:" + tf.getValue(), + Notification.show("TF Value on the server:" + tf.getValue(), Notification.TYPE_WARNING_MESSAGE); - } }; t.addListener(l); diff --git a/tests/testbench/com/vaadin/tests/components/treetable/ProgrammaticCollapse.java b/tests/testbench/com/vaadin/tests/components/treetable/ProgrammaticCollapse.java index 2f84c8a68d..447ce6c465 100644 --- a/tests/testbench/com/vaadin/tests/components/treetable/ProgrammaticCollapse.java +++ b/tests/testbench/com/vaadin/tests/components/treetable/ProgrammaticCollapse.java @@ -4,6 +4,7 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Notification; import com.vaadin.ui.TreeTable; import com.vaadin.ui.VerticalLayout; @@ -31,8 +32,7 @@ public class ProgrammaticCollapse extends TestBase { new ClickListener() { public void buttonClick(ClickEvent event) { boolean collapsed = !table.isCollapsed(1); - table.getRoot().showNotification( - "set collapsed: " + collapsed); + Notification.show("set collapsed: " + collapsed); table.setCollapsed(1, collapsed); } })); @@ -40,8 +40,7 @@ public class ProgrammaticCollapse extends TestBase { new ClickListener() { public void buttonClick(ClickEvent event) { boolean collapsed = !table.isCollapsed(100); - table.getRoot().showNotification( - "set collapsed: " + collapsed); + Notification.show("set collapsed: " + collapsed); table.setCollapsed(100, collapsed); } })); @@ -51,8 +50,7 @@ public class ProgrammaticCollapse extends TestBase { public void buttonClick(ClickEvent event) { collapsed = !collapsed; - table.getRoot().showNotification( - "set collapsed: " + collapsed); + Notification.show("set collapsed: " + collapsed); for (int i = 0; i < 50; ++i) { table.setCollapsed(i * 2, collapsed); } diff --git a/tests/testbench/com/vaadin/tests/components/window/LazyWindowResize.java b/tests/testbench/com/vaadin/tests/components/window/LazyWindowResize.java index 49da6758ea..9eaabf7340 100644 --- a/tests/testbench/com/vaadin/tests/components/window/LazyWindowResize.java +++ b/tests/testbench/com/vaadin/tests/components/window/LazyWindowResize.java @@ -2,14 +2,14 @@ package com.vaadin.tests.components.window; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.terminal.Page.BrowserWindowResizeEvent; +import com.vaadin.terminal.Page.BrowserWindowResizeListener; import com.vaadin.terminal.gwt.client.ui.label.ContentMode; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.tests.util.Log; import com.vaadin.tests.util.LoremIpsum; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Label; -import com.vaadin.ui.Root.BrowserWindowResizeEvent; -import com.vaadin.ui.Root.BrowserWindowResizeListener; import com.vaadin.ui.Root.LegacyWindow; import com.vaadin.ui.Window; import com.vaadin.ui.Window.ResizeEvent; diff --git a/tests/testbench/com/vaadin/tests/components/window/SubWindowFocusAndBlurListeners.java b/tests/testbench/com/vaadin/tests/components/window/SubWindowFocusAndBlurListeners.java index 988d47e29f..1e342abe01 100644 --- a/tests/testbench/com/vaadin/tests/components/window/SubWindowFocusAndBlurListeners.java +++ b/tests/testbench/com/vaadin/tests/components/window/SubWindowFocusAndBlurListeners.java @@ -10,6 +10,7 @@ import com.vaadin.event.ShortcutAction; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Notification; import com.vaadin.ui.Root; import com.vaadin.ui.TextField; import com.vaadin.ui.Window; @@ -36,15 +37,13 @@ public class SubWindowFocusAndBlurListeners extends TestBase { window.addComponent(new TextField()); window.addListener(new FocusListener() { public void focus(FocusEvent event) { - event.getComponent().getRoot() - .showNotification("Focused window"); + Notification.show("Focused window"); } }); window.addListener(new BlurListener() { public void blur(BlurEvent event) { - event.getComponent().getRoot() - .showNotification("Blurred window"); + Notification.show("Blurred window"); } }); @@ -57,7 +56,7 @@ public class SubWindowFocusAndBlurListeners extends TestBase { } public void handleAction(Action action, Object sender, Object target) { - window.getRoot().showNotification("Action!"); + Notification.show("Action!"); } }); diff --git a/tests/testbench/com/vaadin/tests/components/window/WindowResizeListener.java b/tests/testbench/com/vaadin/tests/components/window/WindowResizeListener.java index c6563f200f..ac6c313d29 100644 --- a/tests/testbench/com/vaadin/tests/components/window/WindowResizeListener.java +++ b/tests/testbench/com/vaadin/tests/components/window/WindowResizeListener.java @@ -2,13 +2,13 @@ package com.vaadin.tests.components.window; import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.terminal.Page; +import com.vaadin.terminal.Page.BrowserWindowResizeEvent; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Label; import com.vaadin.ui.Layout; -import com.vaadin.ui.Root; -import com.vaadin.ui.Root.BrowserWindowResizeEvent; import com.vaadin.ui.Window; public class WindowResizeListener extends TestBase { @@ -33,7 +33,7 @@ public class WindowResizeListener extends TestBase { final Label l = new Label(); getLayout().addComponent(l); - getMainWindow().addListener(new Root.BrowserWindowResizeListener() { + getMainWindow().addListener(new Page.BrowserWindowResizeListener() { public void browserWindowResized(BrowserWindowResizeEvent event) { l.setValue("Current browser window size: " + getMainWindow().getBrowserWindowWidth() + " x " diff --git a/tests/testbench/com/vaadin/tests/extensions/SimpleJavaScriptExtensionTest.java b/tests/testbench/com/vaadin/tests/extensions/SimpleJavaScriptExtensionTest.java index 8bcf873cd5..bbfe3f0f46 100644 --- a/tests/testbench/com/vaadin/tests/extensions/SimpleJavaScriptExtensionTest.java +++ b/tests/testbench/com/vaadin/tests/extensions/SimpleJavaScriptExtensionTest.java @@ -16,7 +16,7 @@ import com.vaadin.tests.components.AbstractTestRoot; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.JavaScriptCallback; -import com.vaadin.ui.Root; +import com.vaadin.ui.Notification; @LoadScripts({ "/statictestfiles/jsextension.js" }) public class SimpleJavaScriptExtensionTest extends AbstractTestRoot { @@ -50,14 +50,13 @@ public class SimpleJavaScriptExtensionTest extends AbstractTestRoot { public SimpleJavascriptExtension() { registerRpc(new SimpleJavaScriptExtensionServerRpc() { public void greet(String message) { - Root.getCurrentRoot().showNotification( - getState().getPrefix() + message); + Notification.show(getState().getPrefix() + message); } }); registerCallback("greetToServer", new JavaScriptCallback() { public void call(JSONArray arguments) throws JSONException { - Root.getCurrentRoot().showNotification( - getState().getPrefix() + arguments.getString(0)); + Notification.show(getState().getPrefix() + + arguments.getString(0)); } }); } diff --git a/tests/testbench/com/vaadin/tests/fieldgroup/AbstractBeanFieldGroupTest.java b/tests/testbench/com/vaadin/tests/fieldgroup/AbstractBeanFieldGroupTest.java index 584ce0ec36..b73a29efea 100644 --- a/tests/testbench/com/vaadin/tests/fieldgroup/AbstractBeanFieldGroupTest.java +++ b/tests/testbench/com/vaadin/tests/fieldgroup/AbstractBeanFieldGroupTest.java @@ -7,7 +7,7 @@ import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; -import com.vaadin.ui.Root; +import com.vaadin.ui.Notification; public abstract class AbstractBeanFieldGroupTest extends TestBase { @@ -64,7 +64,7 @@ public abstract class AbstractBeanFieldGroupTest extends TestBase { } catch (CommitException e) { msg = "Commit failed: " + e.getMessage(); } - Root.getCurrentRoot().showNotification(msg); + Notification.show(msg); log.log(msg); } diff --git a/tests/testbench/com/vaadin/tests/fieldgroup/BasicPersonForm.java b/tests/testbench/com/vaadin/tests/fieldgroup/BasicPersonForm.java index f95c172348..c86cb6f5e8 100644 --- a/tests/testbench/com/vaadin/tests/fieldgroup/BasicPersonForm.java +++ b/tests/testbench/com/vaadin/tests/fieldgroup/BasicPersonForm.java @@ -18,8 +18,8 @@ import com.vaadin.tests.data.bean.Sex; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Notification; import com.vaadin.ui.Panel; -import com.vaadin.ui.Root; import com.vaadin.ui.Table; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; @@ -125,7 +125,7 @@ public class BasicPersonForm extends TestBase { } catch (CommitException e) { msg = "Commit failed: " + e.getMessage(); } - Root.getCurrentRoot().showNotification(msg); + Notification.show(msg); log.log(msg); } diff --git a/tests/testbench/com/vaadin/tests/fieldgroup/FieldBinderWithBeanValidation.java b/tests/testbench/com/vaadin/tests/fieldgroup/FieldBinderWithBeanValidation.java index 9ff553ce61..6c6cd8024b 100644 --- a/tests/testbench/com/vaadin/tests/fieldgroup/FieldBinderWithBeanValidation.java +++ b/tests/testbench/com/vaadin/tests/fieldgroup/FieldBinderWithBeanValidation.java @@ -13,7 +13,7 @@ import com.vaadin.tests.data.bean.Sex; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Root; +import com.vaadin.ui.Notification; import com.vaadin.ui.Table; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; @@ -52,7 +52,7 @@ public class FieldBinderWithBeanValidation extends TestBase { } catch (CommitException e) { msg = "Commit failed: " + e.getMessage(); } - Root.getCurrentRoot().showNotification(msg); + Notification.show(msg); log.log(msg); } diff --git a/tests/testbench/com/vaadin/tests/integration/EmbedSizeTest.java b/tests/testbench/com/vaadin/tests/integration/EmbedSizeTest.java index 7ca73ef63d..0b62cd94d5 100644 --- a/tests/testbench/com/vaadin/tests/integration/EmbedSizeTest.java +++ b/tests/testbench/com/vaadin/tests/integration/EmbedSizeTest.java @@ -2,11 +2,12 @@ package com.vaadin.tests.integration; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; +import com.vaadin.terminal.Page; +import com.vaadin.terminal.Page.BrowserWindowResizeEvent; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; import com.vaadin.ui.CheckBox; -import com.vaadin.ui.Root; -import com.vaadin.ui.Root.BrowserWindowResizeEvent; +import com.vaadin.ui.Root.LegacyWindow; public class EmbedSizeTest extends TestBase { @@ -14,7 +15,7 @@ public class EmbedSizeTest extends TestBase { @Override protected void setup() { - Root mainWindow = getMainWindow(); + LegacyWindow mainWindow = getMainWindow(); mainWindow.setSizeUndefined(); mainWindow.getContent().setSizeUndefined(); mainWindow.setImmediate(true); @@ -35,8 +36,7 @@ public class EmbedSizeTest extends TestBase { addComponent(lazyCheckBox); addComponent(log); - - mainWindow.addListener(new Root.BrowserWindowResizeListener() { + mainWindow.addListener(new Page.BrowserWindowResizeListener() { @Override public void browserWindowResized(BrowserWindowResizeEvent event) { log.log("Resize event: " + event.getWidth() + " x " diff --git a/tests/testbench/com/vaadin/tests/integration/JSR286PortletRoot.java b/tests/testbench/com/vaadin/tests/integration/JSR286PortletRoot.java index e022a8bf30..913ce8f54c 100644 --- a/tests/testbench/com/vaadin/tests/integration/JSR286PortletRoot.java +++ b/tests/testbench/com/vaadin/tests/integration/JSR286PortletRoot.java @@ -86,7 +86,7 @@ public class JSR286PortletRoot extends Root { .getContext(); ctx.addPortletListener(getApplication(), new DemoPortletListener()); } else { - showNotification("Not inited via Portal!", + Notification.show("Not inited via Portal!", Notification.TYPE_ERROR_MESSAGE); } @@ -109,7 +109,7 @@ public class JSR286PortletRoot extends Root { tf.setEnabled((request.getPortletMode() == PortletMode.EDIT)); // Show notification about current mode and state - showNotification( + Notification.show( "Portlet status", "Mode: " + request.getPortletMode() + " State: " + request.getWindowState(), diff --git a/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java b/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java index 0250658bc9..8b7f498b0e 100644 --- a/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java +++ b/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java @@ -595,10 +595,7 @@ public class LiferayThemeDemo extends Application.LegacyApplication { Button show = new Button("Humanized Notification", new Button.ClickListener() { public void buttonClick(ClickEvent event) { - event.getButton() - .getRoot() - .showNotification(title.getValue(), - message.getValue()); + Notification.show(title.getValue(), message.getValue()); } }); @@ -607,10 +604,8 @@ public class LiferayThemeDemo extends Application.LegacyApplication { l.addComponent(new Label("Warning", ContentMode.XHTML)); show = new Button("Warning Notification", new Button.ClickListener() { public void buttonClick(ClickEvent event) { - event.getButton() - .getRoot() - .showNotification(title.getValue(), message.getValue(), - Notification.TYPE_WARNING_MESSAGE); + Notification.show(title.getValue(), message.getValue(), + Notification.TYPE_WARNING_MESSAGE); } }); @@ -619,10 +614,8 @@ public class LiferayThemeDemo extends Application.LegacyApplication { l.addComponent(new Label("Error", ContentMode.XHTML)); show = new Button("Error Notification", new Button.ClickListener() { public void buttonClick(ClickEvent event) { - event.getButton() - .getRoot() - .showNotification(title.getValue(), message.getValue(), - Notification.TYPE_ERROR_MESSAGE); + Notification.show(title.getValue(), message.getValue(), + Notification.TYPE_ERROR_MESSAGE); } }); @@ -631,10 +624,8 @@ public class LiferayThemeDemo extends Application.LegacyApplication { l.addComponent(new Label("Tray", ContentMode.XHTML)); show = new Button("Tray Notification", new Button.ClickListener() { public void buttonClick(ClickEvent event) { - event.getButton() - .getRoot() - .showNotification(title.getValue(), message.getValue(), - Notification.TYPE_TRAY_NOTIFICATION); + Notification.show(title.getValue(), message.getValue(), + Notification.TYPE_TRAY_NOTIFICATION); } }); diff --git a/tests/testbench/com/vaadin/tests/minitutorials/IntegerTextFieldDataSource.java b/tests/testbench/com/vaadin/tests/minitutorials/IntegerTextFieldDataSource.java index 5c0efea3ea..96b10d0415 100644 --- a/tests/testbench/com/vaadin/tests/minitutorials/IntegerTextFieldDataSource.java +++ b/tests/testbench/com/vaadin/tests/minitutorials/IntegerTextFieldDataSource.java @@ -8,7 +8,7 @@ import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Label; -import com.vaadin.ui.Root; +import com.vaadin.ui.Notification; import com.vaadin.ui.TextField; public class IntegerTextFieldDataSource extends AbstractTestRoot { @@ -40,12 +40,9 @@ public class IntegerTextFieldDataSource extends AbstractTestRoot { Integer propertyValue = integerProperty.getValue(); int dataModelValue = myBean.getValue(); - Root.getCurrentRoot().showNotification( - "UI value (String): " + uiValue - + "<br />Property value (Integer): " - + propertyValue - + "<br />Data model value (int): " - + dataModelValue); + Notification.show("UI value (String): " + uiValue + + "<br />Property value (Integer): " + propertyValue + + "<br />Data model value (int): " + dataModelValue); } }); diff --git a/tests/testbench/com/vaadin/tests/minitutorials/IntegerTextFieldStandalone.java b/tests/testbench/com/vaadin/tests/minitutorials/IntegerTextFieldStandalone.java index 45bc49ba72..5a47bd7fb8 100644 --- a/tests/testbench/com/vaadin/tests/minitutorials/IntegerTextFieldStandalone.java +++ b/tests/testbench/com/vaadin/tests/minitutorials/IntegerTextFieldStandalone.java @@ -8,7 +8,7 @@ import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Label; -import com.vaadin.ui.Root; +import com.vaadin.ui.Notification; import com.vaadin.ui.TextField; public class IntegerTextFieldStandalone extends AbstractTestRoot { @@ -24,14 +24,12 @@ public class IntegerTextFieldStandalone extends AbstractTestRoot { try { Integer convertedValue = (Integer) textField .getConvertedValue(); - Root.getCurrentRoot().showNotification( - "UI value (String): " + uiValue - + "<br />Converted value (Integer): " - + convertedValue); + Notification.show("UI value (String): " + uiValue + + "<br />Converted value (Integer): " + + convertedValue); } catch (ConversionException e) { e.printStackTrace(); - Root.getCurrentRoot().showNotification( - "Could not convert value: " + uiValue); + Notification.show("Could not convert value: " + uiValue); } } }); diff --git a/tests/testbench/com/vaadin/tests/minitutorials/StringMyTypeConverter.java b/tests/testbench/com/vaadin/tests/minitutorials/StringMyTypeConverter.java index e28788f743..33602ce4d5 100644 --- a/tests/testbench/com/vaadin/tests/minitutorials/StringMyTypeConverter.java +++ b/tests/testbench/com/vaadin/tests/minitutorials/StringMyTypeConverter.java @@ -9,6 +9,7 @@ import com.vaadin.tests.components.AbstractTestRoot; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Notification; import com.vaadin.ui.TextField; public class StringMyTypeConverter extends AbstractTestRoot { @@ -26,12 +27,11 @@ public class StringMyTypeConverter extends AbstractTestRoot { public void buttonClick(ClickEvent event) { try { Name name = (Name) textField.getConvertedValue(); - getRoot().showNotification( - "First name: " + name.getFirstName() - + "<br />Last name: " + name.getLastName()); + Notification.show("First name: " + name.getFirstName() + + "<br />Last name: " + name.getLastName()); } catch (ConversionException e) { e.printStackTrace(); - getRoot().showNotification(e.getCause().getMessage()); + Notification.show(e.getCause().getMessage()); } } })); diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1465ModalNotification.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1465ModalNotification.java index 9459c7cc85..9a777d655c 100644 --- a/tests/testbench/com/vaadin/tests/tickets/Ticket1465ModalNotification.java +++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1465ModalNotification.java @@ -5,7 +5,6 @@ import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; import com.vaadin.ui.Notification; -import com.vaadin.ui.Root; import com.vaadin.ui.Root.LegacyWindow; import com.vaadin.ui.Window; @@ -25,7 +24,7 @@ public class Ticket1465ModalNotification extends Application.LegacyApplication { new Button.ClickListener() { public void buttonClick(ClickEvent event) { - Root.getCurrentRoot().showNotification( + Notification.show( "Try clicking the button in main window!", Notification.TYPE_ERROR_MESSAGE); @@ -37,7 +36,7 @@ public class Ticket1465ModalNotification extends Application.LegacyApplication { new Button.ClickListener() { public void buttonClick(ClickEvent event) { - Root.getCurrentRoot().showNotification( + Notification.show( "Try clicking the button in main window!", Notification.TYPE_WARNING_MESSAGE); } @@ -48,7 +47,7 @@ public class Ticket1465ModalNotification extends Application.LegacyApplication { new Button.ClickListener() { public void buttonClick(ClickEvent event) { - Root.getCurrentRoot().showNotification( + Notification.show( "Try clicking the button in main window!", Notification.TYPE_HUMANIZED_MESSAGE); } diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket2998.java b/tests/testbench/com/vaadin/tests/tickets/Ticket2998.java index 6cf5c8f754..a3ff6808dc 100644 --- a/tests/testbench/com/vaadin/tests/tickets/Ticket2998.java +++ b/tests/testbench/com/vaadin/tests/tickets/Ticket2998.java @@ -20,6 +20,7 @@ import com.vaadin.ui.Field; import com.vaadin.ui.FormLayout; import com.vaadin.ui.Layout; import com.vaadin.ui.ListSelect; +import com.vaadin.ui.Notification; import com.vaadin.ui.Panel; import com.vaadin.ui.Root.LegacyWindow; import com.vaadin.ui.Table; @@ -181,8 +182,7 @@ public class Ticket2998 extends Application.LegacyApplication { @SuppressWarnings("unused") float f = Float.parseFloat((String) value); } catch (Exception e) { - f.getRoot() - .showNotification("Bad number value"); + Notification.show("Bad number value"); f.setValue(0); } } diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket34.java b/tests/testbench/com/vaadin/tests/tickets/Ticket34.java index 1c55bcbe7d..f6fbe05e38 100644 --- a/tests/testbench/com/vaadin/tests/tickets/Ticket34.java +++ b/tests/testbench/com/vaadin/tests/tickets/Ticket34.java @@ -4,13 +4,13 @@ import java.util.HashMap; import java.util.Map; import com.vaadin.Application; +import com.vaadin.terminal.Page; +import com.vaadin.terminal.Page.FragmentChangedEvent; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Component; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; -import com.vaadin.ui.Root; -import com.vaadin.ui.Root.FragmentChangedEvent; import com.vaadin.ui.Root.LegacyWindow; import com.vaadin.ui.TextField; import com.vaadin.ui.VerticalLayout; @@ -32,7 +32,7 @@ public class Ticket34 extends Application.LegacyApplication { "Test app for URI fragment management/reading", mainLayout); setMainWindow(mainWin); - mainWin.addListener(new Root.FragmentChangedListener() { + mainWin.getPage().addListener(new Page.FragmentChangedListener() { public void fragmentChanged(FragmentChangedEvent event) { getMainWindow().showNotification( @@ -93,7 +93,7 @@ public class Ticket34 extends Application.LegacyApplication { public void buttonClick(ClickEvent event) { String viewName = tf.getValue().toString(); // fragmentChangedListener will change the view if possible - event.getButton().getRoot().setFragment(viewName); + event.getButton().getRoot().getPage().setFragment(viewName); } }); diff --git a/tests/testbench/com/vaadin/tests/util/TestUtils.java b/tests/testbench/com/vaadin/tests/util/TestUtils.java index 551e7a7ed8..a9e1518c54 100644 --- a/tests/testbench/com/vaadin/tests/util/TestUtils.java +++ b/tests/testbench/com/vaadin/tests/util/TestUtils.java @@ -112,7 +112,7 @@ public class TestUtils { + "document.body.style.WebkitAppearance=='string') /* webkit only */ ? 'innerText' " + ": 'innerHTML'] = '" + cssString + "';}"; - w.executeJavaScript(script); + w.getPage().getJavaScript().execute(script); } public static IndexedContainer getISO3166Container() { |