diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-06-25 15:31:29 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-06-25 15:31:29 +0300 |
commit | fee6f306961ffff67809c33715c719075ba2c450 (patch) | |
tree | ba30d7ca2cd690b4af032f2062b7c260b9343989 /tests/testbench | |
parent | aa17a44582ade2a22578da1d3bde68a174102a4b (diff) | |
download | vaadin-framework-fee6f306961ffff67809c33715c719075ba2c450.tar.gz vaadin-framework-fee6f306961ffff67809c33715c719075ba2c450.zip |
Use Notification.show(Page) as the official entry point (#8907)
Also remove some static shorthands
Diffstat (limited to 'tests/testbench')
5 files changed, 32 insertions, 23 deletions
diff --git a/tests/testbench/com/vaadin/tests/TestComponentAddAndRecursion.java b/tests/testbench/com/vaadin/tests/TestComponentAddAndRecursion.java index c63c0caf16..3adaff93ea 100644 --- a/tests/testbench/com/vaadin/tests/TestComponentAddAndRecursion.java +++ b/tests/testbench/com/vaadin/tests/TestComponentAddAndRecursion.java @@ -3,6 +3,7 @@ */ package com.vaadin.tests; +import com.vaadin.terminal.Page; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CustomComponent; @@ -91,11 +92,13 @@ public class TestComponentAddAndRecursion extends CustomComponent { public void buttonClick(ClickEvent event) { try { p3.addComponent(p2); - Notification.show("ERROR", "This should have failed", - Notification.TYPE_ERROR_MESSAGE); + new Notification("ERROR", "This should have failed", + Notification.TYPE_ERROR_MESSAGE).show(Page + .getCurrent()); } catch (Exception e) { - Notification.show("OK", "threw, as expected", - Notification.TYPE_ERROR_MESSAGE); + new Notification("OK", "threw, as expected", + Notification.TYPE_ERROR_MESSAGE).show(Page + .getCurrent()); } } @@ -108,11 +111,13 @@ public class TestComponentAddAndRecursion extends CustomComponent { p.addComponent(p2); try { p3.addComponent(p); - Notification.show("ERROR", "This should have failed", - Notification.TYPE_ERROR_MESSAGE); + new Notification("ERROR", "This should have failed", + Notification.TYPE_ERROR_MESSAGE).show(Page + .getCurrent()); } catch (Exception e) { - Notification.show("OK", "threw, as expected", - Notification.TYPE_ERROR_MESSAGE); + new Notification("OK", "threw, as expected", + Notification.TYPE_ERROR_MESSAGE).show(Page + .getCurrent()); } } diff --git a/tests/testbench/com/vaadin/tests/components/notification/Notifications.java b/tests/testbench/com/vaadin/tests/components/notification/Notifications.java index a36fbe3121..5a158c8f03 100644 --- a/tests/testbench/com/vaadin/tests/components/notification/Notifications.java +++ b/tests/testbench/com/vaadin/tests/components/notification/Notifications.java @@ -1,5 +1,6 @@ package com.vaadin.tests.components.notification; +import com.vaadin.terminal.Page; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -52,6 +53,6 @@ public class Notifications extends TestBase implements ClickListener { public void buttonClick(ClickEvent event) { Notification n = new Notification(tf.getValue(), (Integer) type.getValue()); - n.show(); + n.show(Page.getCurrent()); } } diff --git a/tests/testbench/com/vaadin/tests/components/notification/NotificationsHtmlAllowed.java b/tests/testbench/com/vaadin/tests/components/notification/NotificationsHtmlAllowed.java index a16b8edcde..8e42db57f3 100644 --- a/tests/testbench/com/vaadin/tests/components/notification/NotificationsHtmlAllowed.java +++ b/tests/testbench/com/vaadin/tests/components/notification/NotificationsHtmlAllowed.java @@ -1,5 +1,6 @@ package com.vaadin.tests.components.notification; +import com.vaadin.terminal.Page; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -45,7 +46,7 @@ public class NotificationsHtmlAllowed extends TestBase implements ClickListener public void buttonClick(ClickEvent event) { Notification n = makeNotification(); - n.show(); + n.show(Page.getCurrent()); } private Notification makeNotification() { diff --git a/tests/testbench/com/vaadin/tests/integration/JSR286PortletRoot.java b/tests/testbench/com/vaadin/tests/integration/JSR286PortletRoot.java index 913ce8f54c..b4de4fd3da 100644 --- a/tests/testbench/com/vaadin/tests/integration/JSR286PortletRoot.java +++ b/tests/testbench/com/vaadin/tests/integration/JSR286PortletRoot.java @@ -109,11 +109,10 @@ public class JSR286PortletRoot extends Root { tf.setEnabled((request.getPortletMode() == PortletMode.EDIT)); // Show notification about current mode and state - Notification.show( - "Portlet status", - "Mode: " + request.getPortletMode() + " State: " - + request.getWindowState(), - Notification.TYPE_WARNING_MESSAGE); + new Notification("Portlet status", "Mode: " + + request.getPortletMode() + " State: " + + request.getWindowState(), + Notification.TYPE_WARNING_MESSAGE).show(getPage()); // Display current user info Map<?, ?> uinfo = (Map<?, ?>) request diff --git a/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java b/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java index 8b7f498b0e..9397206f1e 100644 --- a/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java +++ b/tests/testbench/com/vaadin/tests/integration/LiferayThemeDemo.java @@ -9,6 +9,7 @@ import com.vaadin.data.Property; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.event.Action; import com.vaadin.terminal.ExternalResource; +import com.vaadin.terminal.Page; import com.vaadin.terminal.Resource; import com.vaadin.terminal.ThemeResource; import com.vaadin.terminal.gwt.client.ui.label.ContentMode; @@ -595,8 +596,8 @@ public class LiferayThemeDemo extends Application.LegacyApplication { Button show = new Button("Humanized Notification", new Button.ClickListener() { public void buttonClick(ClickEvent event) { - Notification.show(title.getValue(), message.getValue()); - + new Notification(title.getValue(), message.getValue()) + .show(Page.getCurrent()); } }); l.addComponent(show); @@ -604,8 +605,9 @@ 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) { - Notification.show(title.getValue(), message.getValue(), - Notification.TYPE_WARNING_MESSAGE); + new Notification(title.getValue(), message.getValue(), + Notification.TYPE_WARNING_MESSAGE).show(Page + .getCurrent()); } }); @@ -614,8 +616,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) { - Notification.show(title.getValue(), message.getValue(), - Notification.TYPE_ERROR_MESSAGE); + new Notification(title.getValue(), message.getValue(), + Notification.TYPE_ERROR_MESSAGE).show(Page.getCurrent()); } }); @@ -624,8 +626,9 @@ 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) { - Notification.show(title.getValue(), message.getValue(), - Notification.TYPE_TRAY_NOTIFICATION); + new Notification(title.getValue(), message.getValue(), + Notification.TYPE_TRAY_NOTIFICATION).show(Page + .getCurrent()); } }); |