summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuuso Valli <juuso@vaadin.com>2014-06-13 11:08:13 +0300
committerJohn Ahlroos <john@vaadin.com>2014-06-18 06:08:01 +0000
commit3200aecd5d7c55aadc3142025221b4cc87bd2e22 (patch)
tree735b0ad4cda264374a5323f2c100eef36c88a444
parentf28d710aee0279ee484acd5c645e9c425e6f4b3a (diff)
downloadvaadin-framework-3200aecd5d7c55aadc3142025221b4cc87bd2e22.tar.gz
vaadin-framework-3200aecd5d7c55aadc3142025221b4cc87bd2e22.zip
Prevent empty tooltips from appearing (#14015)
Change-Id: Iee9d5be9208ff54cd0e4a58c19daaa3a917f9b9d
-rw-r--r--client/src/com/vaadin/client/VTooltip.java13
-rw-r--r--server/src/com/vaadin/server/AbstractErrorMessage.java2
2 files changed, 4 insertions, 11 deletions
diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java
index 1385a52469..4db4477caa 100644
--- a/client/src/com/vaadin/client/VTooltip.java
+++ b/client/src/com/vaadin/client/VTooltip.java
@@ -109,13 +109,13 @@ public class VTooltip extends VWindowOverlay {
}
private void setTooltipText(TooltipInfo info) {
- if (info.getErrorMessage() != null) {
+ if (info.getErrorMessage() != null && !info.getErrorMessage().isEmpty()) {
em.setVisible(true);
em.updateMessage(info.getErrorMessage());
} else {
em.setVisible(false);
}
- if (info.getTitle() != null && !"".equals(info.getTitle())) {
+ if (info.getTitle() != null && !info.getTitle().isEmpty()) {
description.setInnerHTML(info.getTitle());
description.getStyle().clearDisplay();
} else {
@@ -130,13 +130,7 @@ public class VTooltip extends VWindowOverlay {
*
*/
private void showTooltip() {
- boolean hasContent = false;
- if (currentTooltipInfo.getErrorMessage() != null
- || (currentTooltipInfo.getTitle() != null && !""
- .equals(currentTooltipInfo.getTitle()))) {
- hasContent = true;
- }
- if (hasContent) {
+ if (currentTooltipInfo.hasMessage()) {
// Issue #8454: With IE7 the tooltips size is calculated based on
// the last tooltip's position, causing problems if the last one was
// in the right or bottom edge. For this reason the tooltip is moved
@@ -491,7 +485,6 @@ public class VTooltip extends VWindowOverlay {
handledByFocus = isFocused;
currentElement = element;
}
-
}
private final TooltipEventHandler tooltipEventHandler = new TooltipEventHandler();
diff --git a/server/src/com/vaadin/server/AbstractErrorMessage.java b/server/src/com/vaadin/server/AbstractErrorMessage.java
index c733cc493e..b56521993a 100644
--- a/server/src/com/vaadin/server/AbstractErrorMessage.java
+++ b/server/src/com/vaadin/server/AbstractErrorMessage.java
@@ -126,7 +126,7 @@ public abstract class AbstractErrorMessage implements ErrorMessage {
StringBuilder sb = new StringBuilder();
for (ErrorMessage cause : getCauses()) {
String childMessage = cause.getFormattedHtmlMessage();
- if (null != childMessage) {
+ if (null != childMessage && !childMessage.isEmpty()) {
sb.append("<div>");
sb.append(childMessage);
sb.append("</div>\n");