From 586230afd94f314ec4476b82e3da88cb38ce9211 Mon Sep 17 00:00:00 2001 From: Marc Englund Date: Tue, 1 Jul 2008 08:12:26 +0000 Subject: [PATCH] For #1859 "error messages overflow popup"; made tooltip maxwidth wider, overflow:auto, and added the possibility to mouseover the tooltip in order to scroll or cut&paste. svn changeset:4991/svn branch:trunk --- .../ITMILL/themes/default/caption/caption.css | 3 ++- WebContent/ITMILL/themes/default/styles.css | 1 + .../toolkit/terminal/gwt/client/Tooltip.java | 26 ++++++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/WebContent/ITMILL/themes/default/caption/caption.css b/WebContent/ITMILL/themes/default/caption/caption.css index be808b3fc2..9ab7505c2b 100644 --- a/WebContent/ITMILL/themes/default/caption/caption.css +++ b/WebContent/ITMILL/themes/default/caption/caption.css @@ -35,4 +35,5 @@ padding: 7px; background-color: #FFE0E0; border: 1px solid #FFB0B0; -} \ No newline at end of file + overflow: auto; +} diff --git a/WebContent/ITMILL/themes/default/styles.css b/WebContent/ITMILL/themes/default/styles.css index be65f2a6e5..0ad6b4849f 100644 --- a/WebContent/ITMILL/themes/default/styles.css +++ b/WebContent/ITMILL/themes/default/styles.css @@ -99,6 +99,7 @@ padding: 7px; background-color: #FFE0E0; border: 1px solid #FFB0B0; + overflow: auto; } /* body tag created by servlet */ .i-generated-body { diff --git a/src/com/itmill/toolkit/terminal/gwt/client/Tooltip.java b/src/com/itmill/toolkit/terminal/gwt/client/Tooltip.java index 93f6f3be79..cf1d6bd280 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/Tooltip.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/Tooltip.java @@ -20,12 +20,12 @@ public class Tooltip extends ToolkitOverlay { public static final int TOOLTIP_EVENTS = Event.ONKEYDOWN | Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONMOUSEMOVE | Event.ONCLICK; - protected static final int MAX_WIDTH = 280; + protected static final int MAX_WIDTH = 500; ErrorMessage em = new ErrorMessage(); Element description = DOM.createDiv(); private Paintable tooltipOwner; - private boolean closing; - private boolean opening; + private boolean closing = false; + private boolean opening = false; private ApplicationConnection ac; public Tooltip(ApplicationConnection client) { @@ -79,6 +79,7 @@ public class Tooltip extends ToolkitOverlay { } setPopupPosition(x, y); + sinkEvents(Event.ONMOUSEOVER | Event.ONMOUSEOUT); } }); } else { @@ -135,6 +136,7 @@ public class Tooltip extends ToolkitOverlay { return; } closeTimer.schedule(300); + closing = true; } private int tooltipEventMouseX; @@ -162,4 +164,22 @@ public class Tooltip extends ToolkitOverlay { } } + public void onBrowserEvent(Event event) { + final int type = DOM.eventGetType(event); + // cancel closing event if tooltip is mouseovered; the user might want + // to scroll of cut&paste + + switch (type) { + case Event.ONMOUSEOVER: + closeTimer.cancel(); + closing = false; + break; + case Event.ONMOUSEOUT: + hideTooltip(); + break; + default: + // NOP + } + } + } -- 2.39.5