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 --- client/src/com/vaadin/client/ui/VNotification.java | 45 +++++++++++++--------- client/src/com/vaadin/client/ui/VWindow.java | 2 +- 2 files changed, 27 insertions(+), 20 deletions(-) (limited to 'client') diff --git a/client/src/com/vaadin/client/ui/VNotification.java b/client/src/com/vaadin/client/ui/VNotification.java index 3aa3fa847d..a43f508f6e 100644 --- a/client/src/com/vaadin/client/ui/VNotification.java +++ b/client/src/com/vaadin/client/ui/VNotification.java @@ -38,9 +38,9 @@ import com.vaadin.client.UIDL; import com.vaadin.client.Util; import com.vaadin.client.ui.aria.AriaHelper; import com.vaadin.shared.Position; -import com.vaadin.shared.ui.ui.NotificationConfigurationBean; -import com.vaadin.shared.ui.ui.NotificationConfigurationBean.Role; import com.vaadin.shared.ui.ui.UIConstants; +import com.vaadin.shared.ui.ui.UIState.NotificationTypeConfiguration; +import com.vaadin.shared.ui.ui.NotificationRole; public class VNotification extends VOverlay { @@ -161,20 +161,20 @@ public class VNotification extends VOverlay { } public void show(Widget widget, Position position, String style) { - NotificationConfigurationBean styleSetup = getUiState(style); + NotificationTypeConfiguration styleSetup = getUiState(style); setWaiAriaRole(styleSetup); FlowPanel panel = new FlowPanel(); - if (styleSetup.hasAssistivePrefix()) { - panel.add(new Label(styleSetup.getAssistivePrefix())); + if (hasPrefix(styleSetup)) { + panel.add(new Label(styleSetup.prefix)); AriaHelper.setVisibleForAssistiveDevicesOnly(panel.getElement(), true); } panel.add(widget); - if (styleSetup.hasAssistivePostfix()) { - panel.add(new Label(styleSetup.getAssistivePostfix())); + if (hasPostfix(styleSetup)) { + panel.add(new Label(styleSetup.postfix)); AriaHelper.setVisibleForAssistiveDevicesOnly(panel.getElement(), true); } @@ -182,8 +182,16 @@ public class VNotification extends VOverlay { show(position, style); } + private boolean hasPostfix(NotificationTypeConfiguration styleSetup) { + return styleSetup != null && styleSetup.postfix != null && !styleSetup.postfix.isEmpty(); + } + + private boolean hasPrefix(NotificationTypeConfiguration styleSetup) { + return styleSetup != null && styleSetup.prefix != null && !styleSetup.prefix.isEmpty(); + } + public void show(String html, Position position, String style) { - NotificationConfigurationBean styleSetup = getUiState(style); + NotificationTypeConfiguration styleSetup = getUiState(style); String assistiveDeviceOnlyStyle = AriaHelper.ASSISTIVE_DEVICE_ONLY_STYLE; setWaiAriaRole(styleSetup); @@ -191,32 +199,31 @@ public class VNotification extends VOverlay { String type = ""; String usage = ""; - if (styleSetup != null && styleSetup.hasAssistivePrefix()) { + if (hasPrefix(styleSetup)) { type = "" - + styleSetup.getAssistivePrefix() + ""; + + styleSetup.prefix + ""; } - if (styleSetup != null && styleSetup.hasAssistivePostfix()) { + if (hasPostfix(styleSetup)) { usage = "" - + styleSetup.getAssistivePostfix() + ""; + + styleSetup.postfix + ""; } setWidget(new HTML(type + html + usage)); show(position, style); } - private NotificationConfigurationBean getUiState(String style) { - NotificationConfigurationBean styleSetup = getApplicationConnection() - .getUIConnector().getState().notificationConfiguration.setup + private NotificationTypeConfiguration getUiState(String style) { + return getApplicationConnection() + .getUIConnector().getState().notificationConfigurations .get(style); - return styleSetup; } - private void setWaiAriaRole(NotificationConfigurationBean styleSetup) { + private void setWaiAriaRole(NotificationTypeConfiguration styleSetup) { Roles.getAlertRole().set(getElement()); - if (styleSetup != null && styleSetup.getAssistiveRole() != null) { - if (Role.STATUS == styleSetup.getAssistiveRole()) { + if (styleSetup != null && styleSetup.notificationRole != null) { + if (NotificationRole.STATUS == styleSetup.notificationRole) { Roles.getStatusRole().set(getElement()); } } diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java index 396fc76eb0..5b6595ea43 100644 --- a/client/src/com/vaadin/client/ui/VWindow.java +++ b/client/src/com/vaadin/client/ui/VWindow.java @@ -67,7 +67,7 @@ import com.vaadin.client.ui.window.WindowMoveHandler; import com.vaadin.shared.Connector; import com.vaadin.shared.EventId; import com.vaadin.shared.ui.window.WindowMode; -import com.vaadin.shared.ui.window.WindowState.WindowRole; +import com.vaadin.shared.ui.window.WindowRole; /** * "Sub window" component. -- cgit v1.2.3