List of usage examples for com.google.gwt.event.dom.client KeyCodes KEY_ALT
int KEY_ALT
To view the source code for com.google.gwt.event.dom.client KeyCodes KEY_ALT.
Click Source Link
From source file:at.ait.dme.yuma.client.map.tagcloud.TagCloud.java
License:EUPL
public TagCloud(int width, int height, Element parentNode, TagSelectionListener listener) { this.domNode = DOM.createDiv(); parentNode.appendChild(domNode);/*w ww .ja v a 2 s . co m*/ _init(domNode); paper = Raphael.create(domNode, width, height); this.halfWidth = width / 2; this.halfHeight = height / 2; quadrants = new TagCloudQuadrant[] { new TagCloudQuadrant(halfWidth - TAG_BUFFER_X / 2, halfHeight - TAG_BUFFER_Y / 2 - 1, halfWidth - TAG_BUFFER_X / 2, "end", "bottom", paper, listener), // top left new TagCloudQuadrant(halfWidth + TAG_BUFFER_X / 2, halfHeight - TAG_BUFFER_Y / 2 - 1, halfWidth - TAG_BUFFER_X / 2, "start", "bottom", paper, listener), // top right new TagCloudQuadrant(halfWidth - TAG_BUFFER_X / 2, halfHeight + TAG_BUFFER_Y / 2, halfWidth - TAG_BUFFER_X / 2, "end", "top", paper, listener), // bottom left new TagCloudQuadrant(halfWidth + TAG_BUFFER_X / 2, halfHeight + TAG_BUFFER_Y / 2, halfWidth - TAG_BUFFER_X / 2, "start", "top", paper, listener) // bottom right }; Event.addNativePreviewHandler(new NativePreviewHandler() { private boolean keyIsUp = true; @Override public void onPreviewNativeEvent(NativePreviewEvent event) { if (event.getTypeInt() == Event.ONKEYDOWN) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ALT) { if (keyIsUp) { // Prevent re-firing of event on pressed keys keyIsUp = false; InfoPanel.show("Tag Cloud Hidden", "Release ALT key to show the tag cloud again."); _hide(domNode); } } } else if (event.getTypeInt() == Event.ONKEYUP) { if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ALT) { _show(domNode); keyIsUp = true; } } } }); }
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:/*ww w. ja va 2s . com*/ 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/* ww w . j a v a 2s .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.event.DomEvent.java
License:sencha.com license
/** * Returns true if the key is a "special" key. * /*from w ww. ja v a2 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; }//w ww.j a v a 2s . 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.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);/*from www . j av a2 s.c o 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.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 ww w .jav a 2 s .c om*/ // 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(); }// w w w . j a v a2 s. com 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(); } }
From source file:com.openkm.frontend.client.util.EventUtils.java
License:Open Source License
public static boolean isModifierKey(int keyCode) { if (KeyCodes.KEY_SHIFT == keyCode || KeyCodes.KEY_ALT == keyCode || KeyCodes.KEY_CTRL == keyCode || KeyCodes.KEY_DOWN == keyCode) { return true; } else {//from w w w . j a v a2 s .co m return false; } }
From source file:com.qualogy.qafe.gwt.client.ui.renderer.events.KeyBoardHelper.java
License:Apache License
public static boolean isValidKeyInput(NativeEvent keyEvent) { if (keyEvent == null) { return false; }//from w ww . j ava 2s . c o m int keyCode = keyEvent.getKeyCode(); switch (keyCode) { case KeyCodes.KEY_ALT: case KeyCodes.KEY_CTRL: case KeyCodes.KEY_SHIFT: case KeyCodes.KEY_UP: case KeyCodes.KEY_DOWN: case KeyCodes.KEY_LEFT: case KeyCodes.KEY_RIGHT: case KeyCodes.KEY_TAB: case KeyCodes.KEY_ENTER: case KeyCodes.KEY_ESCAPE: case KEY_CAPSLOCK: case KEY_INSERT: case KeyCodes.KEY_HOME: case KeyCodes.KEY_END: case KeyCodes.KEY_PAGEUP: case KeyCodes.KEY_PAGEDOWN: case KEY_F1: case KEY_F2: case KEY_F3: case KEY_F4: case KEY_F5: case KEY_F6: case KEY_F7: case KEY_F8: case KEY_F9: case KEY_F10: case KEY_F11: case KEY_F12: case KEY_NUM_LOCK: { return false; } } return true; }