Java Code Examples for com.google.gwt.dom.client.NativeEvent#getShiftKey()
The following examples show how to use
com.google.gwt.dom.client.NativeEvent#getShiftKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyEventUtils.java From putnami-web-toolkit with GNU Lesser General Public License v3.0 | 4 votes |
public static boolean isModifierKeyDown(NativeEvent currentEvent) { return currentEvent.getCtrlKey() || currentEvent.getShiftKey() || currentEvent.getMetaKey() || currentEvent.getAltKey(); }
Example 2
Source File: WidgetComboBox.java From consulo with Apache License 2.0 | 4 votes |
/** * See class docs */ @Override public void onPreviewNativeEvent(Event.NativePreviewEvent event) { NativeEvent nativeEvent = event.getNativeEvent(); EventTarget eventTarget = nativeEvent.getEventTarget(); if (!Element.is(eventTarget)) //chrome fix { return; } Element target = (Element)Element.as(eventTarget); int type = event.getTypeInt(); if (type == Event.ONKEYDOWN) { setKeyPressed(true); if (DOM.getCaptureElement() != null) return; boolean eventTargetsPopup = (target != null) && DOM.isOrHasChild(getElement(), target); int button = nativeEvent.getKeyCode(); boolean alt = nativeEvent.getAltKey(); boolean ctrl = nativeEvent.getCtrlKey(); boolean shift = nativeEvent.getShiftKey(); boolean hasModifiers = alt || ctrl || shift; if (eventTargetsPopup && isListPanelOpened()) { if (button == KeyCodes.KEY_UP && !hasModifiers) { moveCursor(-1); cancelAndPrevent(event); } else if (button == KeyCodes.KEY_DOWN && !hasModifiers) { moveCursor(1); cancelAndPrevent(event); } else if (button == KeyCodes.KEY_ENTER && !hasModifiers) { select(getHighlightRow()); getChoiceButton().setFocus(false); ChangeEvent changeEvent = new ComboBoxChangeEvent(getHighlightRow(), ComboBoxChangeEvent.ChangeEventInputDevice.KEYBOARD); fireEvent(changeEvent); setKeyPressed(false); } else if (button == KeyCodes.KEY_ESCAPE && !hasModifiers) { hideList(); setKeyPressed(false); } else if (button == KeyCodes.KEY_TAB && (!hasModifiers || !alt && !ctrl && shift)) { hideList(); setKeyPressed(false); } } else if (eventTargetsPopup && !hasModifiers && button == KeyCodes.KEY_ENTER && getModel().getCount() > 0) { showList(true); } } else if (type == Event.ONKEYUP) { setKeyPressed(false); } }
Example 3
Source File: VLayoutDragDropMouseHandler.java From cuba with Apache License 2.0 | 2 votes |
/** * Is the mouse down event a valid mouse drag event, i.e. left mouse button * is pressed without any modifier keys * * @param event * The mouse event * @return Is the mouse event a valid drag event */ private boolean isMouseDragEvent(NativeEvent event) { boolean hasModifierKey = event.getAltKey() || event.getCtrlKey() || event.getMetaKey() || event.getShiftKey(); return !(hasModifierKey || event.getButton() > NativeEvent.BUTTON_LEFT); }