From 244faff333b77dca3fadfe964b646ff7d0eceb2f Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Sun, 9 Nov 2014 16:24:06 +0200 Subject: Notification styles should be scoped more eagerly (#14872) Change-Id: Ifb648b8913c9999d3c0c855f05f79c8356577887 --- client/src/com/vaadin/client/ui/VNotification.java | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'client/src') diff --git a/client/src/com/vaadin/client/ui/VNotification.java b/client/src/com/vaadin/client/ui/VNotification.java index eee0f459a6..2892d4e3ac 100644 --- a/client/src/com/vaadin/client/ui/VNotification.java +++ b/client/src/com/vaadin/client/ui/VNotification.java @@ -63,6 +63,9 @@ public class VNotification extends VOverlay { private static final String STYLENAME_POSITION_CENTER = "v-position-center"; private static final String STYLENAME_POSITION_ASSISTIVE = "v-position-assistive"; + private static final String CAPTION = "caption"; + private static final String DESCRIPTION = "description"; + /** * Position that is only accessible for assistive devices, invisible for * visual users. @@ -256,11 +259,9 @@ public class VNotification extends VOverlay { positionOrSizeUpdated(); /** * Android 4 fails to render notifications correctly without a little - * nudge (#8551) - * Chrome 41 now requires this too (#17252) + * nudge (#8551) Chrome 41 now requires this too (#17252) */ - if (BrowserInfo.get().isAndroid() - || isChrome41OrHigher()) { + if (BrowserInfo.get().isAndroid() || isChrome41OrHigher()) { WidgetUtil.setStyleTemporarily(getElement(), "display", "none"); } } @@ -501,7 +502,8 @@ public class VNotification extends VOverlay { caption = WidgetUtil.escapeHTML(caption); caption = caption.replaceAll("\\n", "
"); } - html += "

" + caption + "

"; + html += "

" + + caption + "

"; } if (notification .hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_MESSAGE)) { @@ -511,7 +513,8 @@ public class VNotification extends VOverlay { message = WidgetUtil.escapeHTML(message); message = message.replaceAll("\\n", "
"); } - html += "

" + message + "

"; + html += "

" + message + "

"; } final String style = notification @@ -529,6 +532,16 @@ public class VNotification extends VOverlay { html, position, style); } + private static String getDependentStyle(ApplicationConnection client, + String style) { + VNotification notification = createNotification(-1, client + .getUIConnector().getWidget()); + String styleName = notification.getStyleName(); + notification.addStyleDependentName(style); + String extendedStyle = notification.getStyleName(); + return extendedStyle.substring(styleName.length()).trim(); + } + public static VNotification createNotification(int delayMsec, Widget owner) { final VNotification notification = GWT.create(VNotification.class); notification.setWaiAriaRole(null); -- cgit v1.2.3