diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2016-08-02 12:07:22 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-01-03 09:47:18 +0200 |
commit | 16220d8e6735f77cb8165e1a4d8d46c1a1be07d3 (patch) | |
tree | 58277b3b0c68d3f018eb15e03b7f4f06f13fc5bc /client | |
parent | 21e8f88ec9e5aa14bc4ab09e09723b614edae173 (diff) | |
download | vaadin-framework-16220d8e6735f77cb8165e1a4d8d46c1a1be07d3.tar.gz vaadin-framework-16220d8e6735f77cb8165e1a4d8d46c1a1be07d3.zip |
Start client-side Grid DOM event handling refactor
Change-Id: I67dad4cfbd6e9e355c48703253ff3d6da00e4eef
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/widgets/Grid.java | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java index 2cac853ea1..c663b7af50 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -7316,31 +7316,34 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, eventCell.set(cell, getSectionFromContainer(container)); // Editor can steal focus from Grid and is still handled - if (isEditorEnabled() && handleEditorEvent(event, container)) { + if (handleEditorEvent(event, container)) { return; } // Fire GridKeyEvents and GridClickEvents. Pass the event to escalator. - super.onBrowserEvent(event); + if (handleSuperEvent(event, container)) { + return; + } - if (!isElementInChildWidget(e)) { + if (handleChildWidgetEvent(event, container)) { + return; + } - if (handleHeaderCellDragStartEvent(event, container)) { - return; - } + if (handleHeaderCellDragStartEvent(event, container)) { + return; + } - // Sorting through header Click / KeyUp - if (handleHeaderDefaultRowEvent(event, container)) { - return; - } + // Sorting through header Click / KeyUp + if (handleHeaderDefaultRowEvent(event, container)) { + return; + } - if (handleRendererEvent(event, container)) { - return; - } + if (handleRendererEvent(event, container)) { + return; + } - if (handleCellFocusEvent(event, container)) { - return; - } + if (handleCellFocusEvent(event, container)) { + return; } } @@ -7394,6 +7397,10 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, } private boolean handleEditorEvent(Event event, RowContainer container) { + if (!isEditorEnabled()) { + return false; + } + Widget w; if (editor.focusedColumnIndex < 0) { w = null; @@ -7407,6 +7414,16 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, return getEditor().getEventHandler().handleEvent(editorEvent); } + private boolean handleSuperEvent(Event event, RowContainer container) { + super.onBrowserEvent(event); + return false; + } + + private boolean handleChildWidgetEvent(Event event, + RowContainer container) { + return isElementInChildWidget(Element.as(event.getEventTarget())); + } + private boolean handleRendererEvent(Event event, RowContainer container) { if (container == escalator.getBody()) { |