Reviewers: ecc, Description: The new NativePreviewEvent and NativePreviewHandler replaces the old EventPreview system. Instead of firing only one EventPreview at the top of the stack, we now fire all NativePreventHandlers. The PopupPanel, DialogBox, MenuBar, and code museum code has been updated to use the new NativePreviewHandler.
NativePreviewEvent has three booleans: isNativeEventCanceled, isNativeEventConsumed, and isNativeEventBlocked. Here is a description: isNativeEventCanceled - the most obvious of them, canceling a native event prevents it from firing to the widgets. This is a replacement for the return value of EventPreview.onPreviewEvent. isNativeEventConsumed - a NativePreviewHandler can consume an event so that other handlers cannot cancel it. This is necessary because handlers that are lower on the stack may want to cancel an event, but the handler at the top of the stack has priority. For example, the popup at the top of the stack may want to use an event, but another popup might want to cancel the event because its modal. The popup at the top of the stack gets to choose. isNativeEventBlocked - blocking a native event lets other handlers know that the native event will not reach them. For example, a modal PopupPanel will block the native event so that PopupPanels below it cannot act on the event. However, we need to keep working through the NativePreviewHandler stack so that all handlers can preview the event, even if it is blocked. The handlers should respect the fact that the native event was blocked, but they still get a change to preview what they missed. This covers the use case where you want to know that an event occured, but don't care if it was canceled or not. I added extensive unit tests and some additional visual tests. Please review this at http://gwt-code-reviews.appspot.com/805 Affected files: reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/Issue1932.java reference/code-museum/src/com/google/gwt/museum/client/defaultmuseum/VisualsForDialogBox.java user/src/com/google/gwt/event/dom/client/DomEvent.java user/src/com/google/gwt/event/logical/shared/HasNativeEvent.java user/src/com/google/gwt/event/shared/GwtEvent.java user/src/com/google/gwt/event/shared/HandlerManager.java user/src/com/google/gwt/user/client/DOM.java user/src/com/google/gwt/user/client/Event.java user/src/com/google/gwt/user/client/EventPreview.java user/src/com/google/gwt/user/client/ui/DialogBox.java user/src/com/google/gwt/user/client/ui/MenuBar.java user/src/com/google/gwt/user/client/ui/PopupPanel.java user/test/com/google/gwt/user/UISuite.java user/test/com/google/gwt/user/client/EventTest.java --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---