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

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

Introduction

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

Prototype

int KEY_SHIFT

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

Click Source Link

Document

Shift key code.

Usage

From source file:ch.amaba.client.ui.LoginPageView.java

License:Open Source License

@UiHandler("jourTextBox")
void handle(KeyUpEvent e) {
    if ((e.getNativeKeyCode() != KeyCodes.KEY_TAB) && (e.getNativeKeyCode() != KeyCodes.KEY_SHIFT)
            && (e.getNativeKeyCode() != KeyCodes.KEY_LEFT) && (e.getNativeKeyCode() != KeyCodes.KEY_RIGHT)) {
        moisTextBox.setFocus(jourTextBox.getText().length() == 2);
    }//  ww w.  j a v a2 s.c  om
}

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   w w  w.  j av  a2  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.conx.logistics.kernel.ui.common.gwt.client.ui.VConXQuickLaunchBox.java

License:Apache License

/**
 * Triggered when a key was depressed//from w ww . jav  a 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.ephesoft.gxt.rv.client.widget.RVConfirmationDialog.java

License:Open Source License

@Override
protected void onKeyPress(final Event event) {
    final int keyCode = event.getKeyCode();
    switch (keyCode) {
    case KeyCodes.KEY_SHIFT:
        responseRecordingCheckbox.setValue(!responseRecordingCheckbox.getValue());
        event.stopPropagation();/*w  ww  . j av  a 2  s.c  om*/
        event.preventDefault();
        break;

    case KeyCodes.KEY_TAB:
        break;
    // case KeyCodes.KEY_TAB:
    // if (currentButton == PredefinedButton.OK) {
    // final TextButton cancelButton = getButton(PredefinedButton.CANCEL);
    // cancelButton.focus();
    // currentButton = PredefinedButton.CANCEL;
    // } else {
    // final TextButton okButton = getButton(PredefinedButton.OK);
    // okButton.focus();
    // currentButton = PredefinedButton.OK;
    // }
    // break;

    default:
        super.onKeyPress(event);
        event.stopPropagation();
        event.preventDefault();
        break;
    }
}

From source file:com.extjs.gxt.ui.client.event.DomEvent.java

License:sencha.com license

/**
 * Returns true if the key is a "special" key.
 * /*from ww w  . j a va  2 s .  c o m*/
 * @param k the key code
 * @return the special state
 */
public boolean isSpecialKey(int k) {
    return isNavKeyPress(k) || k == KeyCodes.KEY_BACKSPACE || k == KeyCodes.KEY_CTRL || k == KeyCodes.KEY_SHIFT
            || k == KeyCodes.KEY_ALT || (k >= 19 && k <= 20) || (k >= 45 && k <= 46);
}

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   ww w  . jav  a  2s .  com*/
        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.google.gerrit.client.ui.TextSaveButtonListener.java

License:Apache License

@Override
public void onKeyPress(final KeyPressEvent e) {
    if (descAction.isEnabled()) {
        // Do nothing, its already enabled.
    } else if (e.isControlKeyDown() || e.isAltKeyDown() || e.isMetaKeyDown()) {
        switch (e.getCharCode()) {
        case 'v':
        case 'x':
            on(e);//w ww  .  j a v a 2s  . co  m
            break;
        }
    } else {
        switch (e.getCharCode()) {
        case KeyCodes.KEY_UP:
        case KeyCodes.KEY_DOWN:
        case KeyCodes.KEY_LEFT:
        case KeyCodes.KEY_RIGHT:
        case KeyCodes.KEY_HOME:
        case KeyCodes.KEY_END:
        case KeyCodes.KEY_PAGEUP:
        case KeyCodes.KEY_PAGEDOWN:
        case KeyCodes.KEY_ALT:
        case KeyCodes.KEY_CTRL:
        case KeyCodes.KEY_SHIFT:
            break;
        default:
            on(e);
            break;
        }
    }
}

From source file:com.googlecode.gwtquake.client.GwtKBD.java

License:Apache License

private int XLateKey(int key) {
    switch (key) {
    case KeyCodes.KEY_PAGEUP:
        key = Keys.K_PGUP;//from ww w. j  av  a2s. c  o m
        break;
    case KeyCodes.KEY_PAGEDOWN:
        key = Keys.K_PGDN;
        break;
    case KeyCodes.KEY_HOME:
        key = Keys.K_HOME;
        break;
    case KeyCodes.KEY_END:
        key = Keys.K_END;
        break;
    case KeyCodes.KEY_LEFT:
        key = Keys.K_LEFTARROW;
        break;
    case KeyCodes.KEY_RIGHT:
        key = Keys.K_RIGHTARROW;
        break;
    case KeyCodes.KEY_DOWN:
        key = Keys.K_DOWNARROW;
        break;
    case KeyCodes.KEY_UP:
        key = Keys.K_UPARROW;
        break;
    case KeyCodes.KEY_ESCAPE:
        key = Keys.K_ESCAPE;
        break;
    case KeyCodes.KEY_ENTER:
        key = Keys.K_ENTER;
        break;
    case KeyCodes.KEY_TAB:
        key = Keys.K_TAB;
        break;
    case KeyCodes.KEY_BACKSPACE:
        key = Keys.K_BACKSPACE;
        break;
    case KeyCodes.KEY_DELETE:
        key = Keys.K_DEL;
        break;
    case KeyCodes.KEY_SHIFT:
        key = Keys.K_SHIFT;
        break;
    case KeyCodes.KEY_CTRL:
        key = Keys.K_CTRL;
        break;

    // Safari on MAC (TODO(jgw): other browsers may need tweaking):
    case 112:
        key = Keys.K_F1;
        break;
    case 113:
        key = Keys.K_F2;
        break;
    case 114:
        key = Keys.K_F3;
        break;
    case 115:
        key = Keys.K_F4;
        break;
    case 116:
        key = Keys.K_F5;
        break;
    case 117:
        key = Keys.K_F6;
        break;
    case 118:
        key = Keys.K_F7;
        break;
    case 119:
        key = Keys.K_F8;
        break;
    case 120:
        key = Keys.K_F9;
        break;
    case 121:
        key = Keys.K_F10;
        break;
    case 122:
        key = Keys.K_F11;
        break;
    case 123:
        key = Keys.K_F12;
        break;

    case 186:
        key = ';';
        break;
    case 187:
        key = '=';
        break;
    case 188:
        key = ',';
        break;
    case 189:
        key = '-';
        break;
    case 190:
        key = '.';
        break;
    case 191:
        key = '/';
        break;
    case 192:
        key = '`';
        break;
    case 222:
        key = '\'';
        break;
    case 219:
        key = '[';
        break;
    case 220:
        key = '\\';
        break;
    case 221:
        key = ']';
        break;

    default:
        if (key < '0' || key > '9') {
            if (key >= 'A' && key <= 'Z') {
                key = Character.toLowerCase((char) key);
            }
        }

        // TODO(jgw): We probably need keycodes for these.
        //      case KeyCodes.KEY_PAUSE: key = Key.K_PAUSE; break; 
        //      case KeyCodes.KEY_MENU: key = Key.K_ALT; break;
        //      case KeyCodes.KEY_INSERT: key = Key.K_INS; break;
    }

    return key;
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.combobox.CubaComboBoxWidget.java

License:Apache License

@Override
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://from  www  .  ja v a 2  s  .  c o m
            // special case for "clear" shortcut action
            if (event.isShiftKeyDown() && event.getNativeKeyCode() == KeyCodes.KEY_DELETE) {
                suggestionPopup.hide();
            } else {
                // do not show options popup if we handle shortcut action
                if (!event.isControlKeyDown() && !event.isAltKeyDown()) {
                    super.onKeyUp(event);
                }
            }
            break;
        }
    }
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.searchselect.CubaSearchSelectWidget.java

License:Apache License

@Override
public void onKeyUp(KeyUpEvent event) {
    if (enabled && !readonly) {
        switch (event.getNativeKeyCode()) {
        case KeyCodes.KEY_ENTER:
            String tbText = tb.getText() == null ? "" : tb.getText();
            String currentText = currentSuggestion == null ? "" : currentSuggestion.getReplacementString();
            if (!this.preventFilterAfterSelect && !tbText.equals(currentText))
                filterOptions(currentPage);
            else {
                if (!event.isAnyModifierKeyDown())
                    event.stopPropagation();
            }/*from  w w w.java  2s. c om*/
            this.preventFilterAfterSelect = false;
            break;
        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:
            // NOP
            break;
        case KeyCodes.KEY_ESCAPE:
            reset();
            break;
        }

        updateEditState();
    }
}