com.vaadin.client.widget.grid
Class DefaultEditorEventHandler<T>

java.lang.Object
  extended by com.vaadin.client.widget.grid.DefaultEditorEventHandler<T>
All Implemented Interfaces:
Grid.Editor.EventHandler<T>

public class DefaultEditorEventHandler<T>
extends java.lang.Object
implements Grid.Editor.EventHandler<T>

The default handler for Grid editor events. Offers several overridable protected methods for easier customization.

Since:
7.6
Author:
Vaadin Ltd

Field Summary
static int KEYCODE_BUFFERED_SAVE
           
static int KEYCODE_CLOSE
           
static int KEYCODE_MOVE_HORIZONTAL
           
static int KEYCODE_MOVE_VERTICAL
           
static int KEYCODE_OPEN
           
 
Constructor Summary
DefaultEditorEventHandler()
           
 
Method Summary
protected  void editRow(Grid.EditorDomEvent<T> event, int rowIndex, int colIndex)
           
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 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYCODE_OPEN

public static final int KEYCODE_OPEN

KEYCODE_MOVE_VERTICAL

public static final int KEYCODE_MOVE_VERTICAL

KEYCODE_CLOSE

public static final int KEYCODE_CLOSE

KEYCODE_MOVE_HORIZONTAL

public static final int KEYCODE_MOVE_HORIZONTAL

KEYCODE_BUFFERED_SAVE

public static final int KEYCODE_BUFFERED_SAVE
Constructor Detail

DefaultEditorEventHandler

public DefaultEditorEventHandler()
Method Detail

isTouchOpenEvent

protected boolean isTouchOpenEvent(Grid.EditorDomEvent<T> event)
Returns whether the given event is a touch event that should open the editor.

Parameters:
event - the received event
Returns:
whether the event is a touch open event

isOpenEvent

protected boolean isOpenEvent(Grid.EditorDomEvent<T> event)
Returns whether the given event should open the editor. The default implementation returns true if and only if the event is a doubleclick or if it is a keydown event and the keycode is KEYCODE_OPEN.

Parameters:
event - the received event
Returns:
true if the event is an open event, false otherwise

handleOpenEvent

protected boolean handleOpenEvent(Grid.EditorDomEvent<T> event)
Opens the editor on the appropriate row if the received event is an open event. The default implementation uses isOpenEvent.

Parameters:
event - the received event
Returns:
true if this method handled the event and nothing else should be done, false otherwise

handleMoveEvent

protected boolean handleMoveEvent(Grid.EditorDomEvent<T> event)
Moves the editor to another row or another column if the received event is a move event. The default implementation moves the editor to the clicked row if the event is a click; otherwise, if the event is a keydown and the keycode is 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.

Parameters:
event - the received event
Returns:
true if this method handled the event and nothing else should be done, false otherwise

handleBufferedMoveEvent

protected boolean handleBufferedMoveEvent(Grid.EditorDomEvent<T> event)
Moves the editor to another column if the received event is a move event. By default the editor is moved on a keydown event with keycode KEYCODE_MOVE_HORIZONTAL. This moves the editor left or right if shift key is pressed or not, respectively.

Parameters:
event - the received event
Returns:
true if this method handled the event and nothing else should be done, false otherwise

isCloseEvent

protected boolean isCloseEvent(Grid.EditorDomEvent<T> event)
Returns whether the given event should close the editor. The default implementation returns true if and only if the event is a keydown event and the keycode is KEYCODE_CLOSE.

Parameters:
event - the received event
Returns:
true if the event is a close event, false otherwise

handleCloseEvent

protected boolean handleCloseEvent(Grid.EditorDomEvent<T> event)
Closes the editor if the received event is a close event. The default implementation uses isCloseEvent.

Parameters:
event - the received event
Returns:
true if this method handled the event and nothing else should be done, false otherwise

editRow

protected void editRow(Grid.EditorDomEvent<T> event,
                       int rowIndex,
                       int colIndex)

handleEvent

public boolean handleEvent(Grid.EditorDomEvent<T> event)
Description copied from interface: Grid.Editor.EventHandler
Handles editor-related events in an appropriate way. Opens, moves, or closes the editor based on the given event.

Specified by:
handleEvent in interface Grid.Editor.EventHandler<T>
Parameters:
event - the received event
Returns:
true if the event was handled and nothing else should be done, false otherwise


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.