aboutsummaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2014-11-09 16:24:06 +0200
committerVaadin Code Review <review@vaadin.com>2015-05-11 07:41:18 +0000
commit244faff333b77dca3fadfe964b646ff7d0eceb2f (patch)
tree6554bfe9d0c7404117b2845bc9f93f5fbd624f27 /client/src
parent4eb495cac3f006b9f1aa525f04025401734a3550 (diff)
downloadvaadin-framework-244faff333b77dca3fadfe964b646ff7d0eceb2f.tar.gz
vaadin-framework-244faff333b77dca3fadfe964b646ff7d0eceb2f.zip
Notification styles should be scoped more eagerly (#14872)
Change-Id: Ifb648b8913c9999d3c0c855f05f79c8356577887
Diffstat (limited to 'client/src')
-rw-r--r--client/src/com/vaadin/client/ui/VNotification.java25
1 files changed, 19 insertions, 6 deletions
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", "<br />");
}
- html += "<h1>" + caption + "</h1>";
+ html += "<h1 class='" + getDependentStyle(client, CAPTION) + "'>"
+ + caption + "</h1>";
}
if (notification
.hasAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_MESSAGE)) {
@@ -511,7 +513,8 @@ public class VNotification extends VOverlay {
message = WidgetUtil.escapeHTML(message);
message = message.replaceAll("\\n", "<br />");
}
- html += "<p>" + message + "</p>";
+ html += "<p class='" + getDependentStyle(client, DESCRIPTION)
+ + "'>" + message + "</p>";
}
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);