Java Code Examples for com.google.gwt.dom.client.NativeEvent#getMetaKey()

The following examples show how to use com.google.gwt.dom.client.NativeEvent#getMetaKey() . 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 vote down vote up
@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 vote down vote up
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 vote down vote up
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 vote down vote up
public static boolean isModifierKeyDown(NativeEvent currentEvent) {
	return currentEvent.getCtrlKey() || currentEvent.getShiftKey() || currentEvent.getMetaKey()
		|| currentEvent.getAltKey();
}
 
Example 5
Source File: VLayoutDragDropMouseHandler.java    From cuba with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
}