]> source.dussan.org Git - vaadin-framework.git/commitdiff
Prevent empty tooltips from appearing (#14015)
authorJuuso Valli <juuso@vaadin.com>
Fri, 13 Jun 2014 08:08:13 +0000 (11:08 +0300)
committerJohn Ahlroos <john@vaadin.com>
Wed, 18 Jun 2014 06:08:01 +0000 (06:08 +0000)
Change-Id: Iee9d5be9208ff54cd0e4a58c19daaa3a917f9b9d

client/src/com/vaadin/client/VTooltip.java
server/src/com/vaadin/server/AbstractErrorMessage.java

index 1385a5246909337d5c16e5f600661c1b1c855855..4db4477caac4cb2d13d459995021a3fb42522e1b 100644 (file)
@@ -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();
index c733cc493ef0a86c106233b02e679c98a31f0f36..b56521993ab528ea4990d42f059a6b156e51eaa9 100644 (file)
@@ -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");