From be5c159ee995ad619f5cdd68695db59ea3cd6fee Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Thu, 17 Sep 2015 11:52:10 +0300 Subject: Fix Grid Editor handling to not track focus events from widgets (#18919) Change-Id: Icfdc99c39e2a4ae5d1ee580bf0ca9b63a35ba256 --- .../widget/grid/DefaultEditorEventHandler.java | 12 ++++++++++- client/src/com/vaadin/client/widgets/Grid.java | 24 ---------------------- 2 files changed, 11 insertions(+), 25 deletions(-) (limited to 'client') diff --git a/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java b/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java index da1380702c..cfe56c3775 100644 --- a/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java +++ b/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java @@ -214,7 +214,17 @@ public class DefaultEditorEventHandler implements Editor.EventHandler { Event e = event.getDomEvent(); final EventCellReference cell = event.getCell(); - if (e.getType().equals(BrowserEvents.KEYDOWN) + if (e.getType().equals(BrowserEvents.CLICK) + && event.getRowIndex() == event.getCell().getRowIndex()) { + editRow(event, event.getRowIndex(), event.getCell() + .getColumnIndexDOM()); + + // FIXME should be in editRow + event.getGrid().fireEvent(new EditorMoveEvent(cell)); + + return true; + + } else if (e.getType().equals(BrowserEvents.KEYDOWN) && e.getKeyCode() == KEYCODE_MOVE_HORIZONTAL) { editRow(event, event.getRowIndex(), event.getFocusedColumnIndex() diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index dbdcb2a07b..0cdd911883 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -49,9 +49,6 @@ import com.google.gwt.dom.client.TableSectionElement; import com.google.gwt.dom.client.Touch; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.FocusEvent; -import com.google.gwt.event.dom.client.FocusHandler; -import com.google.gwt.event.dom.client.HasFocusHandlers; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyDownEvent; import com.google.gwt.event.dom.client.KeyDownHandler; @@ -1799,27 +1796,6 @@ public class Grid extends ResizeComposite implements attachWidget(editor, cell); } - final int currentColumnIndex = i; - if (editor instanceof HasFocusHandlers) { - // Use a proper focus handler if available - focusHandlers.add(((HasFocusHandlers) editor) - .addFocusHandler(new FocusHandler() { - @Override - public void onFocus(FocusEvent event) { - focusedColumnIndex = currentColumnIndex; - } - })); - } else { - // Try sniffing for DOM focus events - focusHandlers.add(editor.addDomHandler( - new FocusHandler() { - @Override - public void onFocus(FocusEvent event) { - focusedColumnIndex = currentColumnIndex; - } - }, FocusEvent.getType())); - } - if (i == focusedColumnIndex) { focusColumn(focusedColumnIndex); } -- cgit v1.2.3