diff options
author | Jonatan Kronqvist <jonatan@vaadin.com> | 2014-04-08 15:02:58 +0300 |
---|---|---|
committer | Jonatan Kronqvist <jonatan@vaadin.com> | 2014-04-14 11:43:18 +0300 |
commit | d2e24feb09ccba7f3a2f253687488774af2bc340 (patch) | |
tree | f66161d98c5c1638741569c45712a6f06e7fd756 /client | |
parent | 51c2e93172b0132ead54573c74117efac29c1cec (diff) | |
download | vaadin-framework-d2e24feb09ccba7f3a2f253687488774af2bc340.tar.gz vaadin-framework-d2e24feb09ccba7f3a2f253687488774af2bc340.zip |
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
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VNotification.java | 45 | ||||
-rw-r--r-- | client/src/com/vaadin/client/ui/VWindow.java | 2 |
2 files changed, 27 insertions, 20 deletions
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 = "<span class='" + assistiveDeviceOnlyStyle + "'>" - + styleSetup.getAssistivePrefix() + "</span>"; + + styleSetup.prefix + "</span>"; } - if (styleSetup != null && styleSetup.hasAssistivePostfix()) { + if (hasPostfix(styleSetup)) { usage = "<span class='" + assistiveDeviceOnlyStyle + "'>" - + styleSetup.getAssistivePostfix() + "</span>"; + + styleSetup.postfix + "</span>"; } 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. |