Example usage for com.google.gwt.query.client.plugins.events GqEvent isMetaKeyPressed

List of usage examples for com.google.gwt.query.client.plugins.events GqEvent isMetaKeyPressed

Introduction

In this page you can find the example usage for com.google.gwt.query.client.plugins.events GqEvent isMetaKeyPressed.

Prototype

public final boolean isMetaKeyPressed() 

Source Link

Document

Tell whether ctrl or cmd key is pressed

Usage

From source file:gwtquery.plugins.draggable.client.Draggable.java

License:Apache License

@Override
protected boolean mouseClick(Element element, GqEvent event) {
    // react on click event only if no metakey is pressed, if no drag occurs and
    // if more than one element are selected

    if (!event.isMetaKeyPressed() && !dragStart && selectedDraggables.size() > 1) {
        DraggableHandler dragHandler = DraggableHandler.getInstance(element);
        DraggableOptions options = dragHandler.getOptions();
        unselectAll();//from  w  w w . j av  a  2  s .c  om
        select(element, options.getSelectedClassName());
    }

    dragStart = false;

    return !event.isMetaKeyPressed();
}

From source file:gwtquery.plugins.draggable.client.Draggable.java

License:Apache License

@Override
protected boolean mouseDown(Element draggable, GqEvent event) {

    DraggableHandler dragHandler = DraggableHandler.getInstance(draggable);
    DraggableOptions options = dragHandler.getOptions();

    if (!options.isMultipleSelection()) {
        // ensure all previously selected element are unselected
        unselectAll();/* ww w .  j  a  va 2s  . c o m*/

    } else {

        if (event.isMetaKeyPressed()) {

            if (selectedDraggables.contains(draggable)) {

                unselect(draggable);

            } else if (canBeSelected(draggable, dragHandler)) {
                select(draggable, options.getSelectedClassName());
            }
        } else if (!selectedDraggables.contains(draggable)) {
            // if no meta key pressed and if the draggable is not selected ,
            // deselect all and select the draggable.
            unselectAll();
            select(draggable, options.getSelectedClassName());

        }
    }
    return super.mouseDown(draggable, event) && !event.isMetaKeyPressed();
}

From source file:gwtquery.plugins.selectable.client.Selectable.java

License:Apache License

private boolean isLassoSelectionEnable(GqEvent e) {
    return options.isMultiSelect() && (!options.isLassoOnMetaKey() || e.isMetaKeyPressed());
}

From source file:gwtquery.plugins.selectable.client.Selectable.java

License:Apache License

private boolean isMetaKeyEnabled(GqEvent event) {
    return options.isMultiSelect() && event.isMetaKeyPressed();
}