T - The row type of the grid. The row type is the POJO type from where
the data is retrieved into the column cells.public class DefaultEditorEventHandler<T> extends Object implements Grid.Editor.EventHandler<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultEditorEventHandler.CursorMoveDelta
Specifies the direction at which the focus should move.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
KEYCODE_BUFFERED_SAVE
Default key code for triggering save in buffered mode.
|
static int |
KEYCODE_CLOSE
Default key code for hiding the editor.
|
static int |
KEYCODE_MOVE_HORIZONTAL
Default key code for moving cursor horizontally within the editor.
|
static int |
KEYCODE_MOVE_VERTICAL
Default key code for moving the editor up or down.
|
static int |
KEYCODE_OPEN
Default key code for showing the editor.
|
| Constructor and Description |
|---|
DefaultEditorEventHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
confirmValidity(boolean isValid)
Confirms the valid status of the binder so as to determine
whether to allow pending navigation action.
|
protected void |
editRow(Grid.EditorDomEvent<T> event,
int rowIndex,
int colIndex)
Opens the editor over the row with the given index and attempts to focus
the editor widget in the given column index.
|
protected int |
findNextEditableColumnIndex(Grid<T> grid,
int startingWith)
Finds index of the first editable column, starting at the specified
index.
|
protected int |
findPrevEditableColumnIndex(Grid<T> grid,
int startingWith)
Finds index of the last editable column, searching backwards starting at
the specified index.
|
protected DefaultEditorEventHandler.CursorMoveDelta |
getDeltaFromKeyDownEvent(Grid.EditorDomEvent<T> event)
Returns the direction to which the cursor should move.
|
protected boolean |
handleBufferedMoveEvent(Grid.EditorDomEvent<T> event)
Moves the editor to another column if the received event is a move event.
|
protected boolean |
handleCloseEvent(Grid.EditorDomEvent<T> event)
Closes the editor if the received event is a close event.
|
boolean |
handleEvent(Grid.EditorDomEvent<T> event)
Handles editor-related events in an appropriate way.
|
protected boolean |
handleMoveEvent(Grid.EditorDomEvent<T> event)
Moves the editor to another row or another column if the received event
is a move event.
|
protected boolean |
handleOpenEvent(Grid.EditorDomEvent<T> event)
Opens the editor on the appropriate row if the received event is an open
event.
|
protected boolean |
isCloseEvent(Grid.EditorDomEvent<T> event)
Returns whether the given event should close the editor.
|
protected boolean |
isEditable(Grid<T> grid,
Grid.Column<?,T> column)
Checks whether the field within the given editor column is editable.
|
protected boolean |
isOpenEvent(Grid.EditorDomEvent<T> event)
Returns whether the given event should open the editor.
|
protected boolean |
isTouchOpenEvent(Grid.EditorDomEvent<T> event)
Returns whether the given event is a touch event that should open the
editor.
|
public static final int KEYCODE_OPEN
public static final int KEYCODE_MOVE_VERTICAL
public static final int KEYCODE_CLOSE
public static final int KEYCODE_MOVE_HORIZONTAL
public static final int KEYCODE_BUFFERED_SAVE
protected boolean isTouchOpenEvent(Grid.EditorDomEvent<T> event)
event - the received eventprotected boolean isOpenEvent(Grid.EditorDomEvent<T> event)
KEYCODE_OPEN.event - the received eventprotected boolean handleOpenEvent(Grid.EditorDomEvent<T> event)
isOpenEvent.event - the received eventprotected DefaultEditorEventHandler.CursorMoveDelta getDeltaFromKeyDownEvent(Grid.EditorDomEvent<T> event)
event - the mouse event, not null.protected boolean handleMoveEvent(Grid.EditorDomEvent<T> event)
KEYCODE_MOVE_VERTICAL, moves the editor one
row up or down if the shift key is pressed or not, respectively. Keydown
event with keycode KEYCODE_MOVE_HORIZONTAL moves the editor left
or right if shift key is pressed or not, respectively.event - the received eventprotected int findNextEditableColumnIndex(Grid<T> grid, int startingWith)
grid - the current grid, not null.startingWith - start with this column. Index into the
Grid.getVisibleColumns().startingWith itself. Returns -1 if there is no such
column.protected boolean isEditable(Grid<T> grid, Grid.Column<?,T> column)
grid - the grid that is being editedcolumn - the column to investigatetrue if the field is editable, false otherwiseprotected int findPrevEditableColumnIndex(Grid<T> grid, int startingWith)
grid - the current grid, not null.startingWith - start with this column. Index into the
Grid.getVisibleColumns().startingWith itself. Returns -1 if there is no such
column.protected boolean handleBufferedMoveEvent(Grid.EditorDomEvent<T> event)
KEYCODE_MOVE_HORIZONTAL. This moves the editor left or right if
shift key is pressed or not, respectively.event - the received eventprotected boolean isCloseEvent(Grid.EditorDomEvent<T> event)
KEYCODE_CLOSE.event - the received eventprotected boolean handleCloseEvent(Grid.EditorDomEvent<T> event)
isCloseEvent.event - the received eventprotected void editRow(Grid.EditorDomEvent<T> event, int rowIndex, int colIndex)
event - the wrapped DOM eventrowIndex - index of the row to editcolIndex - index of the editor column to focuspublic boolean handleEvent(Grid.EditorDomEvent<T> event)
Grid.Editor.EventHandlerhandleEvent in interface Grid.Editor.EventHandler<T>event - the received eventpublic void confirmValidity(boolean isValid)
Grid.Editor.EventHandlerconfirmValidity in interface Grid.Editor.EventHandler<T>isValid - true if the binder value is validCopyright © 2023 Vaadin Ltd. All rights reserved.