From: Juuso Valli Date: Fri, 13 Jun 2014 08:08:13 +0000 (+0300) Subject: Prevent empty tooltips from appearing (#14015) X-Git-Tag: 7.3.0.beta1~2^2~39 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3200aecd5d7c55aadc3142025221b4cc87bd2e22;p=vaadin-framework.git Prevent empty tooltips from appearing (#14015) Change-Id: Iee9d5be9208ff54cd0e4a58c19daaa3a917f9b9d --- 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("
"); sb.append(childMessage); sb.append("
\n");