Class DefaultEditorEventHandler<T>

  • All Implemented Interfaces:
    Grid.Editor.EventHandler<T>

    public class DefaultEditorEventHandler<T>
    extends 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
    • 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
      • 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