From d2e24feb09ccba7f3a2f253687488774af2bc340 Mon Sep 17 00:00:00 2001 From: Jonatan Kronqvist Date: Tue, 8 Apr 2014 15:02:58 +0300 Subject: Update some APIs based on the 7.2 API review comments * NotificationConfiguration "helpers" removed from Notification * NotificationConfiguration methods accept Type instead of style (String) * Tab.setIconAltText -> Tab.setIconAlternateText * Remove the two new TabSheet.addTab() methods * UI.reinit() -> UI.refresh() Change-Id: I97488e7c6de8cfacc591450d69c821b2973b8707 --- .../notification/NotificationsWaiAria.java | 19 +++++---- .../tests/components/tabsheet/TabSheetIcons.java | 2 +- .../com/vaadin/tests/components/ui/UIRefresh.java | 49 ++++++++++++++++++++++ .../vaadin/tests/components/ui/UIRefreshTest.java | 39 +++++++++++++++++ .../com/vaadin/tests/components/ui/UIReinit.java | 49 ---------------------- .../vaadin/tests/components/ui/UIReinitTest.java | 39 ----------------- .../components/window/ExtraWindowShownWaiAria.java | 2 +- 7 files changed, 102 insertions(+), 97 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/ui/UIRefresh.java create mode 100644 uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java delete mode 100644 uitest/src/com/vaadin/tests/components/ui/UIReinit.java delete mode 100644 uitest/src/com/vaadin/tests/components/ui/UIReinitTest.java (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java b/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java index 27af49a397..ecf704835f 100644 --- a/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java +++ b/uitest/src/com/vaadin/tests/components/notification/NotificationsWaiAria.java @@ -2,7 +2,7 @@ package com.vaadin.tests.components.notification; import com.vaadin.data.Item; import com.vaadin.server.Page; -import com.vaadin.shared.ui.ui.NotificationConfigurationBean.Role; +import com.vaadin.shared.ui.ui.NotificationRole; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; @@ -11,8 +11,10 @@ import com.vaadin.ui.ComboBox; import com.vaadin.ui.NativeSelect; import com.vaadin.ui.Notification; import com.vaadin.ui.Notification.Type; +import com.vaadin.ui.NotificationConfiguration; import com.vaadin.ui.TextArea; import com.vaadin.ui.TextField; +import com.vaadin.ui.UI; public class NotificationsWaiAria extends TestBase { @@ -36,9 +38,9 @@ public class NotificationsWaiAria extends TestBase { " - closes automatically after 10 seconds"); addComponent(postfix); - role = new NativeSelect("Role"); - role.addItem(Role.ALERT); - role.addItem(Role.STATUS); + role = new NativeSelect("NotificationRole"); + role.addItem(NotificationRole.ALERT); + role.addItem(NotificationRole.STATUS); role.setValue(role.getItemIds().iterator().next()); addComponent(role); @@ -96,9 +98,12 @@ public class NotificationsWaiAria extends TestBase { Notification n = new Notification(tf.getValue(), typeValue); n.setHtmlContentAllowed(true); - n.setAssistivePrefixForType(typeValue, prefix.getValue()); - n.setAssistivePostfixForType(typeValue, postfix.getValue()); - n.setAssistiveRoleForType(typeValue, (Role) role.getValue()); + NotificationConfiguration notificationConf = UI.getCurrent() + .getNotificationConfiguration(); + notificationConf.setAssistivePrefix(typeValue, prefix.getValue()); + notificationConf.setAssistivePostfix(typeValue, postfix.getValue()); + notificationConf + .setAssistiveRole(typeValue, (NotificationRole) role.getValue()); n.show(Page.getCurrent()); } diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java index ccdc4ecb38..c5e01969a1 100644 --- a/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java +++ b/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetIcons.java @@ -46,7 +46,7 @@ public class TabSheetIcons extends TestBase { for (Component c : tab) { tabsheet.addTab(c); - tabsheet.getTab(c).setIconAltText( + tabsheet.getTab(c).setIconAlternateText( "iconalt" + tabsheet.getComponentCount()); } diff --git a/uitest/src/com/vaadin/tests/components/ui/UIRefresh.java b/uitest/src/com/vaadin/tests/components/ui/UIRefresh.java new file mode 100644 index 0000000000..b61e32c984 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UIRefresh.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.tests.components.ui; + +import com.vaadin.annotations.PreserveOnRefresh; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Label; + +@PreserveOnRefresh +public class UIRefresh extends AbstractTestUI { + + public static final String REINIT_ID = "reinit"; + + @Override + protected void setup(VaadinRequest request) { + } + + @Override + protected void refresh(VaadinRequest request) { + Label l = new Label("Reinit!"); + l.setId(REINIT_ID); + addComponent(l); + } + + @Override + public String getTestDescription() { + return "UI reinit after refresh"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(12191); + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java b/uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java new file mode 100644 index 0000000000..974c4bfe5a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/ui/UIRefreshTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.tests.components.ui; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.testbench.By; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class UIRefreshTest extends MultiBrowserTest { + + @Test + public void testUIRefresh() { + openTestURL(); + Assert.assertFalse(reinitLabelExists()); + // Reload the page; UI.refresh should be invoked + openTestURL(); + Assert.assertTrue(reinitLabelExists()); + } + + private boolean reinitLabelExists() { + return !getDriver().findElements(By.id(UIRefresh.REINIT_ID)).isEmpty(); + } +} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIReinit.java b/uitest/src/com/vaadin/tests/components/ui/UIReinit.java deleted file mode 100644 index bef7a5a6d1..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIReinit.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.tests.components.ui; - -import com.vaadin.annotations.PreserveOnRefresh; -import com.vaadin.server.VaadinRequest; -import com.vaadin.tests.components.AbstractTestUI; -import com.vaadin.ui.Label; - -@PreserveOnRefresh -public class UIReinit extends AbstractTestUI { - - public static final String REINIT_ID = "reinit"; - - @Override - protected void setup(VaadinRequest request) { - } - - @Override - protected void reinit(VaadinRequest request) { - Label l = new Label("Reinit!"); - l.setId(REINIT_ID); - addComponent(l); - } - - @Override - public String getTestDescription() { - return "UI reinit after refresh"; - } - - @Override - protected Integer getTicketNumber() { - return Integer.valueOf(12191); - } -} diff --git a/uitest/src/com/vaadin/tests/components/ui/UIReinitTest.java b/uitest/src/com/vaadin/tests/components/ui/UIReinitTest.java deleted file mode 100644 index 82132d3c65..0000000000 --- a/uitest/src/com/vaadin/tests/components/ui/UIReinitTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2013 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.vaadin.tests.components.ui; - -import org.junit.Assert; -import org.junit.Test; - -import com.vaadin.testbench.By; -import com.vaadin.tests.tb3.MultiBrowserTest; - -public class UIReinitTest extends MultiBrowserTest { - - @Test - public void testUIReinit() { - openTestURL(); - Assert.assertFalse(reinitLabelExists()); - // Reload the page; UI.reinit should be invoked - openTestURL(); - Assert.assertTrue(reinitLabelExists()); - } - - private boolean reinitLabelExists() { - return !getDriver().findElements(By.id(UIReinit.REINIT_ID)).isEmpty(); - } -} diff --git a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.java b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.java index 39989926e7..c7379f666b 100644 --- a/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.java +++ b/uitest/src/com/vaadin/tests/components/window/ExtraWindowShownWaiAria.java @@ -2,7 +2,7 @@ package com.vaadin.tests.components.window; import com.vaadin.server.ThemeResource; import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.window.WindowState.WindowRole; +import com.vaadin.shared.ui.window.WindowRole; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; -- cgit v1.2.3