Example usage for com.google.gwt.event.dom.client KeyCodes KEY_PAGEUP

List of usage examples for com.google.gwt.event.dom.client KeyCodes KEY_PAGEUP

Introduction

In this page you can find the example usage for com.google.gwt.event.dom.client KeyCodes KEY_PAGEUP.

Prototype

int KEY_PAGEUP

To view the source code for com.google.gwt.event.dom.client KeyCodes KEY_PAGEUP.

Click Source Link

Document

Page up key code.

Usage

From source file:cc.kune.common.client.actions.KeyStroke.java

License:Open Source License

/**
 * Gets the key text./*from   www .j  ava  2  s  .co m*/
 *
 * @return the key text
 */
@SuppressWarnings("deprecation")
public String getKeyText() {
    switch (keyCode) {
    case KeyCodes.KEY_BACKSPACE:
        return translateKey("Backspace");
    // case KeyCodes.KEY_DELETE:
    // return translateKey("Delete");
    case KeyCodes.KEY_DOWN:
        return translateKey("Down");
    case KeyCodes.KEY_END:
        return translateKey("End");
    case KeyCodes.KEY_ENTER:
        return translateKey("Enter");
    case KeyCodes.KEY_ESCAPE:
        return translateKey("Escape");
    case KeyCodes.KEY_HOME:
        return translateKey("Home");
    case KeyCodes.KEY_LEFT:
        return translateKey("Left");
    case KeyCodes.KEY_PAGEDOWN:
        return translateKey("Page Down");
    case KeyCodes.KEY_PAGEUP:
        return translateKey("Page Up");
    case KeyCodes.KEY_RIGHT:
        return translateKey("Right");
    case KeyCodes.KEY_TAB:
        return translateKey("Tab");
    case KeyCodes.KEY_UP:
        return translateKey("Up");
    case Keyboard.KEY_SPACE:
        return translateKey("Space");
    case Keyboard.KEY_F1:
    case Keyboard.KEY_F2:
    case Keyboard.KEY_F3:
    case Keyboard.KEY_F4:
    case Keyboard.KEY_F5:
    case Keyboard.KEY_F6:
    case Keyboard.KEY_F7:
    case Keyboard.KEY_F8:
    case Keyboard.KEY_F9:
    case Keyboard.KEY_F10:
    case Keyboard.KEY_F11:
    case Keyboard.KEY_F12:
        return translateKey("F" + (keyCode - (Keyboard.KEY_F1 - 1)));
    case Keyboard.KEY_COMMA:
    case Keyboard.KEY_PERIOD:
    case Keyboard.KEY_SLASH:
    case Keyboard.KEY_0:
    case Keyboard.KEY_1:
    case Keyboard.KEY_2:
    case Keyboard.KEY_3:
    case Keyboard.KEY_4:
    case Keyboard.KEY_5:
    case Keyboard.KEY_6:
    case Keyboard.KEY_7:
    case Keyboard.KEY_8:
    case Keyboard.KEY_9:
    case Keyboard.KEY_SEMICOLON:
    case Keyboard.KEY_EQUALS:
    case Keyboard.KEY_A:
    case Keyboard.KEY_B:
    case Keyboard.KEY_C:
    case Keyboard.KEY_D:
    case Keyboard.KEY_E:
    case Keyboard.KEY_F:
    case Keyboard.KEY_G:
    case Keyboard.KEY_H:
    case Keyboard.KEY_I:
    case Keyboard.KEY_J:
    case Keyboard.KEY_K:
    case Keyboard.KEY_L:
    case Keyboard.KEY_M:
    case Keyboard.KEY_N:
    case Keyboard.KEY_O:
    case Keyboard.KEY_P:
    case Keyboard.KEY_Q:
    case Keyboard.KEY_R:
    case Keyboard.KEY_S:
    case Keyboard.KEY_T:
    case Keyboard.KEY_U:
    case Keyboard.KEY_V:
    case Keyboard.KEY_W:
    case Keyboard.KEY_X:
    case Keyboard.KEY_Y:
    case Keyboard.KEY_Z:
    case Keyboard.KEY_OPEN_BRACKET:
    case Keyboard.KEY_BACK_SLASH:
    case Keyboard.KEY_CLOSE_BRACKET:
        return String.valueOf(keyCode).toUpperCase();
    default:
        final String charS = String.valueOf(keyChar);
        if (charS == null) {
            return "Unknown keyCode: 0x" + (keyCode < 0 ? "-" : "") + Integer.toHexString(Math.abs(keyCode));
        } else {
            if (" ".equals(charS)) {
                return translateKey("Space");
            } else {
                return charS;
            }
        }
    }
}

From source file:com.badlogic.gdx.backends.gwt.GwtInput.java

License:Apache License

/** borrowed from PlayN, thanks guys **/
private static int keyForCode(int keyCode) {
    switch (keyCode) {
    case KeyCodes.KEY_ALT:
        return Keys.ALT_LEFT;
    case KeyCodes.KEY_BACKSPACE:
        return Keys.BACKSPACE;
    case KeyCodes.KEY_CTRL:
        return Keys.CONTROL_LEFT;
    case KeyCodes.KEY_DELETE:
        return Keys.DEL;
    case KeyCodes.KEY_DOWN:
        return Keys.DOWN;
    case KeyCodes.KEY_END:
        return Keys.END;
    case KeyCodes.KEY_ENTER:
        return Keys.ENTER;
    case KeyCodes.KEY_ESCAPE:
        return Keys.ESCAPE;
    case KeyCodes.KEY_HOME:
        return Keys.HOME;
    case KeyCodes.KEY_LEFT:
        return Keys.LEFT;
    case KeyCodes.KEY_PAGEDOWN:
        return Keys.PAGE_DOWN;
    case KeyCodes.KEY_PAGEUP:
        return Keys.PAGE_UP;
    case KeyCodes.KEY_RIGHT:
        return Keys.RIGHT;
    case KeyCodes.KEY_SHIFT:
        return Keys.SHIFT_LEFT;
    case KeyCodes.KEY_TAB:
        return Keys.TAB;
    case KeyCodes.KEY_UP:
        return Keys.UP;

    case KEY_PAUSE:
        return Keys.UNKNOWN; // FIXME
    case KEY_CAPS_LOCK:
        return Keys.UNKNOWN; // FIXME
    case KEY_SPACE:
        return Keys.SPACE;
    case KEY_INSERT:
        return Keys.INSERT;
    case KEY_0://from   www  .j  a v  a  2 s  .c  o  m
        return Keys.NUM_0;
    case KEY_1:
        return Keys.NUM_1;
    case KEY_2:
        return Keys.NUM_2;
    case KEY_3:
        return Keys.NUM_3;
    case KEY_4:
        return Keys.NUM_4;
    case KEY_5:
        return Keys.NUM_5;
    case KEY_6:
        return Keys.NUM_6;
    case KEY_7:
        return Keys.NUM_7;
    case KEY_8:
        return Keys.NUM_8;
    case KEY_9:
        return Keys.NUM_9;
    case KEY_A:
        return Keys.A;
    case KEY_B:
        return Keys.B;
    case KEY_C:
        return Keys.C;
    case KEY_D:
        return Keys.D;
    case KEY_E:
        return Keys.E;
    case KEY_F:
        return Keys.F;
    case KEY_G:
        return Keys.G;
    case KEY_H:
        return Keys.H;
    case KEY_I:
        return Keys.I;
    case KEY_J:
        return Keys.J;
    case KEY_K:
        return Keys.K;
    case KEY_L:
        return Keys.L;
    case KEY_M:
        return Keys.M;
    case KEY_N:
        return Keys.N;
    case KEY_O:
        return Keys.O;
    case KEY_P:
        return Keys.P;
    case KEY_Q:
        return Keys.Q;
    case KEY_R:
        return Keys.R;
    case KEY_S:
        return Keys.S;
    case KEY_T:
        return Keys.T;
    case KEY_U:
        return Keys.U;
    case KEY_V:
        return Keys.V;
    case KEY_W:
        return Keys.W;
    case KEY_X:
        return Keys.X;
    case KEY_Y:
        return Keys.Y;
    case KEY_Z:
        return Keys.Z;
    case KEY_LEFT_WINDOW_KEY:
        return Keys.UNKNOWN; // FIXME
    case KEY_RIGHT_WINDOW_KEY:
        return Keys.UNKNOWN; // FIXME
    // case KEY_SELECT_KEY: return Keys.SELECT_KEY;
    case KEY_NUMPAD0:
        return Keys.NUMPAD_0;
    case KEY_NUMPAD1:
        return Keys.NUMPAD_1;
    case KEY_NUMPAD2:
        return Keys.NUMPAD_2;
    case KEY_NUMPAD3:
        return Keys.NUMPAD_3;
    case KEY_NUMPAD4:
        return Keys.NUMPAD_4;
    case KEY_NUMPAD5:
        return Keys.NUMPAD_5;
    case KEY_NUMPAD6:
        return Keys.NUMPAD_6;
    case KEY_NUMPAD7:
        return Keys.NUMPAD_7;
    case KEY_NUMPAD8:
        return Keys.NUMPAD_8;
    case KEY_NUMPAD9:
        return Keys.NUMPAD_9;
    case KEY_MULTIPLY:
        return Keys.UNKNOWN; // FIXME
    case KEY_ADD:
        return Keys.PLUS;
    case KEY_SUBTRACT:
        return Keys.MINUS;
    case KEY_DECIMAL_POINT_KEY:
        return Keys.PERIOD;
    case KEY_DIVIDE:
        return Keys.UNKNOWN; // FIXME
    case KEY_F1:
        return Keys.F1;
    case KEY_F2:
        return Keys.F2;
    case KEY_F3:
        return Keys.F3;
    case KEY_F4:
        return Keys.F4;
    case KEY_F5:
        return Keys.F5;
    case KEY_F6:
        return Keys.F6;
    case KEY_F7:
        return Keys.F7;
    case KEY_F8:
        return Keys.F8;
    case KEY_F9:
        return Keys.F9;
    case KEY_F10:
        return Keys.F10;
    case KEY_F11:
        return Keys.F11;
    case KEY_F12:
        return Keys.F12;
    case KEY_NUM_LOCK:
        return Keys.NUM;
    case KEY_SCROLL_LOCK:
        return Keys.UNKNOWN; // FIXME
    case KEY_SEMICOLON:
        return Keys.SEMICOLON;
    case KEY_EQUALS:
        return Keys.EQUALS;
    case KEY_COMMA:
        return Keys.COMMA;
    case KEY_DASH:
        return Keys.MINUS;
    case KEY_PERIOD:
        return Keys.PERIOD;
    case KEY_FORWARD_SLASH:
        return Keys.SLASH;
    case KEY_GRAVE_ACCENT:
        return Keys.UNKNOWN; // FIXME
    case KEY_OPEN_BRACKET:
        return Keys.LEFT_BRACKET;
    case KEY_BACKSLASH:
        return Keys.BACKSLASH;
    case KEY_CLOSE_BRACKET:
        return Keys.RIGHT_BRACKET;
    case KEY_SINGLE_QUOTE:
        return Keys.APOSTROPHE;
    default:
        return Keys.UNKNOWN;
    }
}

From source file:com.codenvy.ide.texteditor.codeassistant.AutocompleteUiController.java

License:Open Source License

@Override
public boolean consumeKeySignal(SignalEventEssence signal) {
    Assert.isTrue(isShowing());//from w w  w  .j  a  v a2  s  .  co m
    Assert.isNotNull(delegate);

    if ((signal.keyCode == KeyCodes.KEY_TAB) || (signal.keyCode == KeyCodes.KEY_ENTER)) {
        delegate.onSelect(list.getSelectionModel().getSelectedItem());
        return true;
    }

    if (signal.keyCode == KeyCodes.KEY_ESCAPE) {
        delegate.onCancel();
        return true;
    }

    if (signal.type != SignalEvent.KeySignalType.NAVIGATION) {
        return false;
    }

    if ((signal.keyCode == KeyCodes.KEY_DOWN)) {
        if (list.getSelectionModel().getSelectedIndex() == list.getSelectionModel().size() - 1) {
            list.getSelectionModel().setSelectedItem(0);
        } else {
            list.getSelectionModel().selectNext();
        }
        infoTimer.cancel();
        infoTimer.schedule(DELAY_MILLIS);
        return true;
    }

    if (signal.keyCode == KeyCodes.KEY_UP) {
        if (list.getSelectionModel().getSelectedIndex() == 0) {
            list.getSelectionModel().setSelectedItem(list.getSelectionModel().size() - 1);
        } else {
            list.getSelectionModel().selectPrevious();
        }
        infoTimer.cancel();
        infoTimer.schedule(DELAY_MILLIS);
        return true;
    }

    if ((signal.keyCode == KeyCodes.KEY_LEFT) || (signal.keyCode == KeyCodes.KEY_RIGHT)) {
        delegate.onCancel();
        return true;
    }

    if (signal.keyCode == KeyCodes.KEY_PAGEUP) {
        list.getSelectionModel().selectPreviousPage();
        infoTimer.cancel();
        infoTimer.schedule(DELAY_MILLIS);
        return true;
    }

    if (signal.keyCode == KeyCodes.KEY_PAGEDOWN) {
        list.getSelectionModel().selectNextPage();
        infoTimer.cancel();
        infoTimer.schedule(DELAY_MILLIS);
        return true;
    }

    return false;
}

From source file:com.conx.logistics.kernel.ui.common.gwt.client.ui.VConXQuickLaunchBox.java

License:Apache License

/**
 * Triggered when a key is pressed in the text box
 * /*  w w w  . j  a  v a  2  s  . c  om*/
 * @param event
 *            The KeyDownEvent
 */
private void inputFieldKeyDown(KeyDownEvent event) {
    switch (event.getNativeKeyCode()) {
    case KeyCodes.KEY_DOWN:
    case KeyCodes.KEY_UP:
    case KeyCodes.KEY_PAGEDOWN:
    case KeyCodes.KEY_PAGEUP:
        // open popup as from gadget
        filterOptions(-1, "");
        lastFilter = "";
        tb.selectAll();
        break;
    case KeyCodes.KEY_ENTER:
        /*
         * This only handles the case when new items is allowed, a text is
         * entered, the popup opener button is clicked to close the popup
         * and enter is then pressed (see #7560).
         */
        if (!allowNewItem) {
            return;
        }

        if (currentSuggestion != null && tb.getText().equals(currentSuggestion.getReplacementString())) {
            // Retain behavior from #6686 by returning without stopping
            // propagation if there's nothing to do
            return;
        }
        suggestionPopup.menu.doSelectedItemAction();

        event.stopPropagation();
        break;
    }

}

From source file:com.conx.logistics.kernel.ui.common.gwt.client.ui.VConXQuickLaunchBox.java

License:Apache License

/**
 * Triggered when a key was pressed in the suggestion popup.
 * /*from w w w . ja v  a2  s. c o m*/
 * @param event
 *            The KeyDownEvent of the key
 */
private void popupKeyDown(KeyDownEvent event) {
    // Propagation of handled events is stopped so other handlers such as
    // shortcut key handlers do not also handle the same events.
    switch (event.getNativeKeyCode()) {
    case KeyCodes.KEY_DOWN:
        suggestionPopup.selectNextItem();
        suggestionPopup.menu.setKeyboardSelectedItem(suggestionPopup.menu.getSelectedItem());
        DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
        event.stopPropagation();
        break;
    case KeyCodes.KEY_UP:
        suggestionPopup.selectPrevItem();
        suggestionPopup.menu.setKeyboardSelectedItem(suggestionPopup.menu.getSelectedItem());
        DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
        event.stopPropagation();
        break;
    case KeyCodes.KEY_PAGEDOWN:
        if (hasNextPage()) {
            filterOptions(currentPage + 1, lastFilter);
        }
        event.stopPropagation();
        break;
    case KeyCodes.KEY_PAGEUP:
        if (currentPage > 0) {
            filterOptions(currentPage - 1, lastFilter);
        }
        event.stopPropagation();
        break;
    case KeyCodes.KEY_TAB:
        tabPressedWhenPopupOpen = true;
        filterOptions(currentPage);
        // onBlur() takes care of the rest
        break;
    case KeyCodes.KEY_ESCAPE:
        reset();
        event.stopPropagation();
        break;
    case KeyCodes.KEY_ENTER:
        if (suggestionPopup.menu.getKeyboardSelectedItem() == null) {
            /*
             * Nothing selected using up/down. Happens e.g. when entering a
             * text (causes popup to open) and then pressing enter.
             */
            if (!allowNewItem) {
                /*
                 * New items are not allowed: If there is only one
                 * suggestion, select that. Otherwise do nothing.
                 */
                if (currentSuggestions.size() == 1) {
                    onSuggestionSelected(currentSuggestions.get(0));
                }
            } else {
                // Handle addition of new items.
                suggestionPopup.menu.doSelectedItemAction();
            }
        } else {
            /*
             * Get the suggestion that was navigated to using up/down.
             */
            currentSuggestion = ((FilterSelectSuggestion) suggestionPopup.menu.getKeyboardSelectedItem()
                    .getCommand());
            onSuggestionSelected(currentSuggestion);
        }

        event.stopPropagation();
        break;
    }

}

From source file:com.conx.logistics.kernel.ui.common.gwt.client.ui.VConXQuickLaunchBox.java

License:Apache License

/**
 * Triggered when a key was depressed/*from  www.  java  2  s.c om*/
 * 
 * @param event
 *            The KeyUpEvent of the key depressed
 */
public void onKeyUp(KeyUpEvent event) {
    if (enabled && !readonly) {
        switch (event.getNativeKeyCode()) {
        case KeyCodes.KEY_ENTER:
        case KeyCodes.KEY_TAB:
        case KeyCodes.KEY_SHIFT:
        case KeyCodes.KEY_CTRL:
        case KeyCodes.KEY_ALT:
        case KeyCodes.KEY_DOWN:
        case KeyCodes.KEY_UP:
        case KeyCodes.KEY_PAGEDOWN:
        case KeyCodes.KEY_PAGEUP:
        case KeyCodes.KEY_ESCAPE:
            ; // NOP
            break;
        default:
            if (textInputEnabled) {
                filterOptions(currentPage);
            }
            break;
        }
    }
}

From source file:com.extjs.gxt.ui.client.util.KeyNav.java

License:sencha.com license

@SuppressWarnings("unchecked")
public void handleEvent(ComponentEvent ce) {
    if (ce.getType() == keyEvent) {
        if (component.getElement() != (Element) ce.getEvent().getCurrentEventTarget().cast()) {
            return;
        }//from  w w w  . j a  v a 2 s  .c o  m
        if (cancelBubble) {
            ce.cancelBubble();
        }
        if (preventDefault) {
            ce.preventDefault();
        }

        int code = ce.getKeyCode();

        E e = (E) ce;

        onKeyPress(e);

        switch (code) {
        case KeyCodes.KEY_ALT:
            onAlt(e);
            break;
        case KeyCodes.KEY_BACKSPACE:
            onBackspace(e);
            break;
        case KeyCodes.KEY_CTRL:
            onControl(e);
            break;
        case KeyCodes.KEY_DELETE:
            onDelete(e);
            break;
        case KeyCodes.KEY_DOWN:
            onDown(e);
            break;
        case KeyCodes.KEY_END:
            onEnd(e);
            break;
        case KeyCodes.KEY_ENTER:
            onEnter(e);
            break;
        case KeyCodes.KEY_ESCAPE:
            onEsc(e);
            break;
        case KeyCodes.KEY_HOME:
            onHome(e);
            break;
        case KeyCodes.KEY_LEFT:
            onLeft(e);
            break;
        case KeyCodes.KEY_PAGEDOWN:
            onPageDown(e);
            break;
        case KeyCodes.KEY_PAGEUP:
            onPageUp(e);
            break;
        case KeyCodes.KEY_SHIFT:
            onShift(e);
            break;
        case KeyCodes.KEY_TAB:
            onTab(e);
            break;
        case KeyCodes.KEY_RIGHT:
            onRight(e);
            break;
        case KeyCodes.KEY_UP:
            onUp(e);
            break;
        }

        fireEvent(new EventType(code), e);
    }
}

From source file:com.extjs.gxt.ui.client.util.KeyNavListener.java

License:sencha.com license

public void handleEvent(ComponentEvent e) {
    EventType type = e.getType();//w w  w  .  j  av  a 2  s.co m
    switch (type.getEventCode()) {
    case KeyCodes.KEY_DELETE:
        onDelete(e);
        break;
    case KeyCodes.KEY_DOWN:
        onDown(e);
        break;
    case KeyCodes.KEY_END:
        onEnd(e);
        break;
    case KeyCodes.KEY_ENTER:
        onEnter(e);
        break;
    case KeyCodes.KEY_HOME:
        onHome(e);
        break;
    case KeyCodes.KEY_LEFT:
        onLeft(e);
        break;
    case KeyCodes.KEY_PAGEDOWN:
        onPageDown(e);
        break;
    case KeyCodes.KEY_PAGEUP:
        onPageUp(e);
        break;
    case KeyCodes.KEY_TAB:
        onTab(e);
        break;
    case KeyCodes.KEY_RIGHT:
        onRight(e);
        break;
    case KeyCodes.KEY_UP:
        onUp(e);
        break;
    }
}

From source file:com.extjs.gxt.ui.client.widget.grid.CellSelectionModel.java

License:sencha.com license

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override/* www .ja  v  a 2s .  c o m*/
protected void onKeyPress(GridEvent<M> e) {
    if (grid.editSupport != null) {
        // ignore events whose source is an input element
        String tag = e.getTarget().getTagName();
        if (tag.equals("INPUT") && !e.getTarget().getClassName().equals("_focus")) {
            return;
        }
    }
    if (GXT.isFocusManagerEnabled()) {
        int kc = e.getKeyCode();
        if (kc == KeyCodes.KEY_UP && selection != null && selection.row == 0) {
            int col = selection.cell;
            deselectAll();
            Head h = grid.getView().getHeader().getHead(col);
            selectedHeader = h;
            grid.getView().getHeader().selectHeader(col);
            return;
        }
        if (selectedHeader != null && (kc == KeyCodes.KEY_LEFT || kc == KeyCodes.KEY_RIGHT)) {
            return;
        } else if (selectedHeader != null && (kc == 32 || kc == KeyCodes.KEY_ENTER)) {
            grid.getView().onHeaderClick((Grid) grid, grid.getColumnModel().indexOf(selectedHeader.config));
            return;
        } else if (selectedHeader != null && kc == KeyCodes.KEY_DOWN) {
            selectedHeader.deactivate();
            int idx = selectedHeader.column;
            selectCell(0, idx);
            return;
        } else if (selectedHeader != null && kc == KeyCodes.KEY_UP) {
            return;
        }
    }
    if (selection == null) {
        e.stopEvent();
        Cell cell = grid.walkCells(0, 0, 1, callback, false);
        if (cell != null) {
            selectCell(cell.row, cell.cell);
        }
        return;
    }

    int r = selection.row;
    int c = selection.cell;

    Cell newCell = null;

    switch (e.getKeyCode()) {
    case KeyCodes.KEY_HOME:
        if (enableNavKeys) {
            newCell = grid.walkCells(selection.row, 0, 1, callback, false);
        }
        break;
    case KeyCodes.KEY_END:
        if (enableNavKeys) {
            newCell = grid.walkCells(selection.row, grid.getColumnModel().getColumnCount() - 1, -1, callback,
                    false);
        }
        break;
    case KeyCodes.KEY_PAGEUP:
        if (enableNavKeys) {
            newCell = grid.walkCells(0, 0, 1, callback, false);
        }
        break;
    case KeyCodes.KEY_PAGEDOWN:
        if (enableNavKeys) {
            int idx = listStore.indexOf(listStore.getAt(listStore.getCount() - 1));
            newCell = grid.walkCells(idx, 0, 1, callback, false);
        }
        break;
    case KeyCodes.KEY_TAB:
        if (e.isShiftKey()) {
            newCell = grid.walkCells(r, c - 1, -1, callback, false);
        } else {
            newCell = grid.walkCells(r, c + 1, 1, callback, false);
        }
        break;
    case KeyCodes.KEY_DOWN: {
        newCell = grid.walkCells(r + 1, c, 1, callback, false);
        break;
    }
    case KeyCodes.KEY_UP: {
        newCell = grid.walkCells(r - 1, c, -1, callback, false);
        break;
    }
    case KeyCodes.KEY_LEFT:
        newCell = grid.walkCells(r, c - 1, -1, callback, false);
        break;
    case KeyCodes.KEY_RIGHT:
        newCell = grid.walkCells(r, c + 1, 1, callback, false);
        break;
    case KeyCodes.KEY_ENTER:
        if (grid.editSupport != null) {
            if (!grid.editSupport.isEditing()) {
                grid.editSupport.startEditing(r, c);
                e.stopEvent();
                return;
            }
        }
        break;

    }
    if (newCell != null) {
        selectCell(newCell.row, newCell.cell);
        e.stopEvent();
    }
}

From source file:com.extjs.gxt.ui.client.widget.grid.GridSelectionModel.java

License:sencha.com license

@SuppressWarnings("unchecked")
protected void onKeyPress(GridEvent<M> e) {
    int kc = e.getKeyCode();
    if (GXT.isFocusManagerEnabled()) {
        if (selectedHeader != null) {
            if (kc == KeyCodes.KEY_ENTER) {
                grid.getView().onHeaderClick((Grid) grid, grid.getColumnModel().indexOf(selectedHeader.config));
                return;
            } else if (kc == 32) {
                ColumnHeader ch = grid.getView().getHeader();
                int idx = ch.indexOf(selectedHeader);
                String id = grid.getColumnModel().getColumnId(idx);
                if (id == null || !id.equals("checker")) {
                    grid.getView().getHeader().showColumnMenu(idx);
                }/* ww w .ja  v a  2s. com*/
                return;
            }
        }
    }
    if (lastSelected != null && enableNavKeys) {
        if (kc == KeyCodes.KEY_PAGEUP) {
            e.stopEvent();
            select(0, false);
            grid.getView().focusRow(0);
        } else if (kc == KeyCodes.KEY_PAGEDOWN) {
            e.stopEvent();
            int idx = listStore.indexOf(listStore.getAt(listStore.getCount() - 1));
            select(idx, false);
            grid.getView().focusRow(idx);
        }
    }
    // if space bar is pressed
    if (e.getKeyCode() == 32) {
        if (getLastFocused() != null) {
            if (e.isShiftKey() && lastSelected != null) {
                int last = listStore.indexOf(lastSelected);
                int i = listStore.indexOf(getLastFocused());
                select(last, i, e.isControlKey());
                grid.getView().focusCell(i, 0, false);
            } else {
                if (isSelected(getLastFocused())) {
                    deselect(getLastFocused());
                } else {
                    select(getLastFocused(), true);
                    grid.getView().focusCell(listStore.indexOf(getLastFocused()), 0, false);
                }
            }
        }
    }
}