Example usage for com.google.gwt.user.client.ui KeyboardListener MODIFIER_SHIFT

List of usage examples for com.google.gwt.user.client.ui KeyboardListener MODIFIER_SHIFT

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui KeyboardListener MODIFIER_SHIFT.

Prototype

int MODIFIER_SHIFT

To view the source code for com.google.gwt.user.client.ui KeyboardListener MODIFIER_SHIFT.

Click Source Link

Usage

From source file:com.audata.client.record.RecordListPanel.java

License:Open Source License

public void onKeyPress(Widget sender, char keyCode, int modifiers) {
    String newChar = Character.toString(keyCode);
    if (modifiers == KeyboardListener.MODIFIER_SHIFT && newChar.equalsIgnoreCase("r")) {
        this.onUpdate();
    }/*  ww w  . ja v  a  2s  .  c o  m*/
}

From source file:com.audata.client.widgets.ValidatedTextBox.java

License:Open Source License

public void onKeyPress(Widget sender, char keyCode, int modifiers) {
    //auto file todays date
    if (this.pattern == ValidatedTextBox.PATTERN_DATE) {
        String newChar = Character.toString(keyCode);
        if (newChar.equalsIgnoreCase("t") && modifiers == KeyboardListener.MODIFIER_SHIFT) {
            this.cancelKey();
            Date d = new Date();
            String year = Integer.toString(d.getYear() + 1900);
            String month = Integer.toString(d.getMonth() + 1);
            if (month.length() == 1) {
                month = "0" + month;
            }//from  w  w  w  . j  a  v  a2 s  . c  om
            String day = Integer.toString(d.getDate());
            if (day.length() == 1) {
                day = "0" + day;
            }
            this.setText(year + "-" + month + "-" + day);
        }
    }
}

From source file:com.gwt.components.client.Canvas.java

License:Open Source License

public void onBrowserEvent(Event event) {
    switch (DOM.eventGetType(event)) {
    case Event.ONMOUSEDOWN:
    case Event.ONMOUSEUP:
    case Event.ONMOUSEMOVE:
    case Event.ONMOUSEOVER:
    case Event.ONMOUSEOUT: {
        if (mouseListeners != null) {
            modifiers = (DOM.eventGetShiftKey(event) ? KeyboardListener.MODIFIER_SHIFT : 0)
                    | (DOM.eventGetMetaKey(event) ? KeyboardListener.MODIFIER_META : 0)
                    | (DOM.eventGetCtrlKey(event) ? KeyboardListener.MODIFIER_CTRL : 0)
                    | (DOM.eventGetAltKey(event) ? KeyboardListener.MODIFIER_ALT : 0);
            mouseListeners.fireMouseEvent(this, event);
        }/*from   ww w  .j ava2s.c  om*/
        break;
    }
    case Event.ONMOUSEWHEEL: {
        if (mouseWheelListeners != null) {
            modifiers = (DOM.eventGetShiftKey(event) ? KeyboardListener.MODIFIER_SHIFT : 0)
                    | (DOM.eventGetMetaKey(event) ? KeyboardListener.MODIFIER_META : 0)
                    | (DOM.eventGetCtrlKey(event) ? KeyboardListener.MODIFIER_CTRL : 0)
                    | (DOM.eventGetAltKey(event) ? KeyboardListener.MODIFIER_ALT : 0);
            mouseWheelListeners.fireMouseWheelEvent(this, event);
        }
        break;
    }
    case Event.ONKEYDOWN:
    case Event.ONKEYPRESS:
    case Event.ONKEYUP:
        super.onBrowserEvent(event);
    }
}

From source file:com.vaadin.client.ui.ShortcutActionHandler.java

License:Apache License

ShortcutKeyCombination(int kc, int[] modifiers) {
    keyCode = (char) kc;

    modifiersMask = 0;// ww w . ja  v  a 2  s.c  om
    if (modifiers != null) {
        for (int i = 0; i < modifiers.length; i++) {
            switch (modifiers[i]) {
            case ALT:
                modifiersMask = modifiersMask | KeyboardListener.MODIFIER_ALT;
                break;
            case CTRL:
                modifiersMask = modifiersMask | KeyboardListener.MODIFIER_CTRL;
                break;
            case SHIFT:
                modifiersMask = modifiersMask | KeyboardListener.MODIFIER_SHIFT;
                break;
            case META:
                modifiersMask = modifiersMask | KeyboardListener.MODIFIER_META;
                break;
            default:
                break;
            }
        }
    }
}

From source file:org.gems.ajax.client.event.GlobalKeyboardListener.java

License:Open Source License

private static int getModifiers(Event event) {
    int modifiers = 0;

    if (DOM.eventGetCtrlKey(event))
        modifiers = modifiers | KeyboardListener.MODIFIER_CTRL;
    if (DOM.eventGetAltKey(event))
        modifiers = modifiers | KeyboardListener.MODIFIER_ALT;
    if (DOM.eventGetShiftKey(event))
        modifiers = modifiers | KeyboardListener.MODIFIER_SHIFT;

    return modifiers;
}