Java Code Examples for com.google.gwt.dom.client.NativeEvent#getCtrlKey()
The following examples show how to use
com.google.gwt.dom.client.NativeEvent#getCtrlKey() .
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: CubaSingleSelectionModelConnector.java From cuba with Apache License 2.0 | 6 votes |
@Override protected BodyClickHandler createBodyClickHandler(Grid<JsonObject> grid) { return event -> { JsonObject row = grid.getEventCell().getRow(); NativeEvent e = event.getNativeEvent(); if (!e.getCtrlKey() && !e.getMetaKey()) { if (!grid.isSelected(row)) { grid.select(row); } } else { if (!grid.isSelected(row)) { grid.select(row); } else if (isDeselectAllowed()) { grid.deselect(row); } } }; }
Example 2
Source File: CubaMultiSelectionModelConnector.java From cuba with Apache License 2.0 | 5 votes |
protected void handleCtrlClick(MultiSelectionModel model, CellReference<JsonObject> cell, GridClickEvent event) { NativeEvent e = event.getNativeEvent(); JsonObject row = cell.getRow(); if (!e.getCtrlKey() && !e.getMetaKey()) { model.deselectAll(); } if (model.isSelected(row)) { model.deselect(row); } else { model.select(row); } }
Example 3
Source File: CtrlClickSelectionHandler.java From GridExtensionPack with Apache License 2.0 | 5 votes |
protected void ctrlClickSelect(SelectionModel<JsonObject> model, CellReference<JsonObject> cell, GridClickEvent event) { NativeEvent e = event.getNativeEvent(); JsonObject row = cell.getRow(); if (!e.getCtrlKey() && !e.getMetaKey()) { model.deselectAll(); } if (model.isSelected(row)) { model.deselect(row); } else { model.select(row); } }
Example 4
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 5
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 6
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); }