diff options
author | Denis Anisimov <denis@vaadin.com> | 2014-09-20 12:48:50 +0300 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2015-01-20 09:30:02 +0200 |
commit | e4bcd53d8c08542981afd645a4be7f0ef3f726ef (patch) | |
tree | f8f7d900768f9e32ab305432f20ddad673c785b6 /client | |
parent | 63d5819f76d44d794c1f1399086edf7afb2a176a (diff) | |
download | vaadin-framework-e4bcd53d8c08542981afd645a4be7f0ef3f726ef.tar.gz vaadin-framework-e4bcd53d8c08542981afd645a4be7f0ef3f726ef.zip |
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
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/ui/VNotification.java | 15 |
1 files changed, 15 insertions, 0 deletions
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; @@ -389,6 +390,20 @@ public class VNotification extends VOverlay { } @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); // "modal" |