From e4bcd53d8c08542981afd645a4be7f0ef3f726ef Mon Sep 17 00:00:00 2001 From: Denis Anisimov Date: Sat, 20 Sep 2014 12:48:50 +0300 Subject: Notification should be closed after delay (#14689). onEventPreview() method is deprecated and it's called now only for the very first handler. We need it to work for any handler. So old onEventPreview() method is explicitly called with updated logic for the onPreviewNativeEvent(). Change-Id: I11d98ef0bbd284b74bbccb4f6ac2ab26de73f209 --- client/src/com/vaadin/client/ui/VNotification.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'client') diff --git a/client/src/com/vaadin/client/ui/VNotification.java b/client/src/com/vaadin/client/ui/VNotification.java index 1df58bb38f..5e1df67e18 100644 --- a/client/src/com/vaadin/client/ui/VNotification.java +++ b/client/src/com/vaadin/client/ui/VNotification.java @@ -27,6 +27,7 @@ import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.Event.NativePreviewEvent; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTML; @@ -388,6 +389,20 @@ public class VNotification extends VOverlay { hide(); } + @Override + /* + * Fix for #14689: {@link #onEventPreview(Event)} method is deprecated and + * it's called now only for the very first handler (see super impl). We need + * it to work for any handler. So let's call old {@link + * #onEventPreview(Event)} method explicitly with updated logic for {@link + * #onPreviewNativeEvent(Event)}. + */ + protected void onPreviewNativeEvent(NativePreviewEvent event) { + if (!onEventPreview(Event.as(event.getNativeEvent()))) { + event.cancel(); + } + } + @Override public boolean onEventPreview(Event event) { int type = DOM.eventGetType(event); -- cgit v1.2.3