@Override
        public void onCellPreview(CellPreviewEvent<T> event) {
            NativeEvent nativeEvent = event.getNativeEvent();
            String eventType = event.getNativeEvent().getType();
            if (BrowserEvents.KEYDOWN.equals(eventType) && !event.isCellEditing()) {
                /*
                 * Handle keyboard navigation, unless the cell is being edited. If the
                 * cell is being edited, we do not want to change rows.
                 *
                 * Prevent default on navigation events to prevent default scrollbar
                 * behavior.
                 */
                switch (nativeEvent.getKeyCode()) {
                    case KeyCodes.KEY_DOWN:
                        nextRow();
                        handledEvent(event);
                        return;
                    case KeyCodes.KEY_UP:
                        prevRow();
                        handledEvent(event);
                        return;
                    case KeyCodes.KEY_PAGEDOWN:
                        nextPage();
                        handledEvent(event);
                        return;
                    case KeyCodes.KEY_PAGEUP:
                        prevPage();
                        handledEvent(event);
                        return;
                    case KeyCodes.KEY_HOME:
                        home();
                        handledEvent(event);
                        return;
                    case KeyCodes.KEY_END:
                        end();
                        handledEvent(event);
                        return;
                    case 32:
                        // Prevent the list box from scrolling.
                        handledEvent(event);
                        return;
                }
            } else if (BrowserEvents.CLICK.equals(eventType)) {
                /*
                 * Move keyboard focus to the clicked row, even if the Cell is being
                 * edited. Unlike key events, we aren't moving the currently selected
                 * row, just updating it based on where the user clicked.
                 */
                int relRow = event.getIndex() - display.getPageStart();

                // If a natively focusable element was just clicked, then do not steal
                // focus.
                boolean isFocusable = false;
                Element target = Element.as(event.getNativeEvent().getEventTarget());
                isFocusable = CellBasedWidgetImpl.get().isFocusable(target);
                display.setKeyboardSelectedRow(relRow, !isFocusable);

                // Do not cancel the event as the click may have occurred on a Cell.
            } else if (BrowserEvents.FOCUS.equals(eventType)) {
                // Move keyboard focus to match the currently focused element.
                int relRow = event.getIndex() - display.getPageStart();
                if (display.getKeyboardSelectedRow() != relRow) {
                    // Do not steal focus as this was a focus event.
                    display.setKeyboardSelectedRow(relRow, false);

                    // Do not cancel the event as the click may have occurred on a Cell.
                    return;
                }
            }
        }
Construct a new keyboard selection handler for the specified view.

@param display the display being handled
stroom-core-client-widget/src/main/java/com/google/gwt/user/cellview/client/AbstractHasData.java