From: Matti Tahvonen Date: Tue, 30 Dec 2008 17:29:11 +0000 (+0000) Subject: fixes #2410, converted IPanel to use the new tooltips (that handle errors also) X-Git-Tag: 6.7.0.beta1~3435 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0f03b38d97da5d1cd50f2271c6ca96de1cdab9c3;p=vaadin-framework.git fixes #2410, converted IPanel to use the new tooltips (that handle errors also) svn changeset:6372/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPanel.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPanel.java index 3bd5e963a5..d082b00f08 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPanel.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPanel.java @@ -16,7 +16,6 @@ import com.google.gwt.user.client.ui.Widget; import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection; import com.itmill.toolkit.terminal.gwt.client.BrowserInfo; import com.itmill.toolkit.terminal.gwt.client.Container; -import com.itmill.toolkit.terminal.gwt.client.IErrorMessage; import com.itmill.toolkit.terminal.gwt.client.Paintable; import com.itmill.toolkit.terminal.gwt.client.RenderInformation; import com.itmill.toolkit.terminal.gwt.client.RenderSpace; @@ -43,8 +42,6 @@ public class IPanel extends SimplePanel implements Container { private Element errorIndicatorElement; - private IErrorMessage errorMessage; - private String height; private Paintable layout; @@ -158,8 +155,6 @@ public class IPanel extends SimplePanel implements Container { setIconUri(uidl, client); - handleDescription(uidl); - handleError(uidl); // Render content @@ -207,7 +202,6 @@ public class IPanel extends SimplePanel implements Container { private void handleError(UIDL uidl) { if (uidl.hasAttribute("error")) { - final UIDL errorUidl = uidl.getErrors(); if (errorIndicatorElement == null) { errorIndicatorElement = DOM.createDiv(); DOM.setElementProperty(errorIndicatorElement, "className", @@ -216,23 +210,12 @@ public class IPanel extends SimplePanel implements Container { sinkEvents(Event.MOUSEEVENTS); } DOM.insertBefore(captionNode, errorIndicatorElement, captionText); - if (errorMessage == null) { - errorMessage = new IErrorMessage(); - } - errorMessage.updateFromUIDL(errorUidl); - } else if (errorIndicatorElement != null) { DOM.removeChild(captionNode, errorIndicatorElement); errorIndicatorElement = null; } } - private void handleDescription(UIDL uidl) { - DOM.setElementProperty(captionText, "title", uidl - .hasAttribute("description") ? uidl - .getStringAttribute("description") : ""); - } - private void setIconUri(UIDL uidl, ApplicationConnection client) { final String iconUri = uidl.hasAttribute("icon") ? uidl .getStringAttribute("icon") : null; @@ -268,7 +251,8 @@ public class IPanel extends SimplePanel implements Container { */ DOM.setStyleAttribute(captionNode, "width", "1px"); - int parentPadding = Util.measureHorizontalPaddingAndBorder(getElement(), 0); + int parentPadding = Util.measureHorizontalPaddingAndBorder( + getElement(), 0); int parentWidthExcludingPadding = getElement().getOffsetWidth() - parentPadding; @@ -357,25 +341,9 @@ public class IPanel extends SimplePanel implements Container { client.updateVariable(id, "scrollTop", scrollTop, false); client.updateVariable(id, "scrollLeft", scrollLeft, false); } - } else if (errorIndicatorElement != null - && target == errorIndicatorElement) { - switch (type) { - case Event.ONMOUSEOVER: - if (errorMessage != null) { - errorMessage.showAt(errorIndicatorElement); - } - break; - case Event.ONMOUSEOUT: - if (errorMessage != null) { - errorMessage.hide(); - } - break; - case Event.ONCLICK: - ApplicationConnection.getConsole().log( - DOM.getInnerHTML(errorMessage.getElement())); - return; - default: - break; + } else if (captionNode.isOrHasChild(target)) { + if (client != null) { + client.handleTooltipEvent(event, this); } } } @@ -465,8 +433,8 @@ public class IPanel extends SimplePanel implements Container { DOM.setStyleAttribute(contentNode, "overflow", "auto"); - captionPaddingHorizontal = Util.measureHorizontalPaddingAndBorder(captionNode, - 26); + captionPaddingHorizontal = Util.measureHorizontalPaddingAndBorder( + captionNode, 26); captionMarginLeft = Util.measureMarginLeft(captionNode); contentMarginLeft = Util.measureMarginLeft(contentNode);