diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-09-17 11:52:10 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-09-17 09:59:48 +0000 |
commit | be5c159ee995ad619f5cdd68695db59ea3cd6fee (patch) | |
tree | c3db5391b64ebb77d31b10f020ffd3d8547b5493 | |
parent | a968da0682270ee5863240e1fc5782bbf749ce70 (diff) | |
download | vaadin-framework-be5c159ee995ad619f5cdd68695db59ea3cd6fee.tar.gz vaadin-framework-be5c159ee995ad619f5cdd68695db59ea3cd6fee.zip |
Fix Grid Editor handling to not track focus events from widgets (#18919)
Change-Id: Icfdc99c39e2a4ae5d1ee580bf0ca9b63a35ba256
-rw-r--r-- | client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java | 12 | ||||
-rw-r--r-- | client/src/com/vaadin/client/widgets/Grid.java | 24 |
2 files changed, 11 insertions, 25 deletions
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<T> implements Editor.EventHandler<T> { Event e = event.getDomEvent(); final EventCellReference<T> 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<T> 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); } |