From 3200aecd5d7c55aadc3142025221b4cc87bd2e22 Mon Sep 17 00:00:00 2001 From: Juuso Valli Date: Fri, 13 Jun 2014 11:08:13 +0300 Subject: Prevent empty tooltips from appearing (#14015) Change-Id: Iee9d5be9208ff54cd0e4a58c19daaa3a917f9b9d --- client/src/com/vaadin/client/VTooltip.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'client') 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(); -- cgit v1.2.3