Java Code Examples for com.google.gwt.event.dom.client.KeyCodes#KEY_CTRL

The following examples show how to use com.google.gwt.event.dom.client.KeyCodes#KEY_CTRL . 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: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
/**
 * Triggered when a key was depressed.
 *
 * @param event
 *            The KeyUpEvent of the key depressed
 */
@Override
public void onKeyUp(KeyUpEvent event) {
	debug("VComboBoxMultiselect: onKeyUp(" + event.getNativeKeyCode() + ")");

	if (this.enabled && !this.readonly) {
		switch (event.getNativeKeyCode()) {
		case KeyCodes.KEY_ENTER:
		case KeyCodes.KEY_TAB:
		case KeyCodes.KEY_SHIFT:
		case KeyCodes.KEY_CTRL:
		case KeyCodes.KEY_ALT:
		case KeyCodes.KEY_DOWN:
		case KeyCodes.KEY_UP:
		case KeyCodes.KEY_PAGEDOWN:
		case KeyCodes.KEY_PAGEUP:
		case KeyCodes.KEY_ESCAPE:
			// NOP
			break;
		default:
			if (this.textInputEnabled) {
				// when filtering, we always want to see the results on the
				// first page first.
				filterOptions(0);
			}
			break;
		}
	}
}
 
Example 2
Source File: EventUtils.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
public static boolean isModifierKey(int keyCode) {
	if (KeyCodes.KEY_SHIFT == keyCode || KeyCodes.KEY_ALT == keyCode || KeyCodes.KEY_CTRL == keyCode
			|| KeyCodes.KEY_DOWN == keyCode) {
		return true;
	} else {
		return false;
	}
}
 
Example 3
Source File: CubaSearchSelectWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void onKeyUp(KeyUpEvent event) {
    if (enabled && !readonly) {
        switch (event.getNativeKeyCode()) {
            case KeyCodes.KEY_ENTER:
                String tbText = tb.getText() == null ? ""
                        : tb.getText();
                String currentText = currentSuggestion == null ? ""
                        : currentSuggestion.getReplacementString();
                if (!this.preventFilterAfterSelect && !tbText.equals(currentText)) {
                    filterOptions(currentPage);
                } else {
                    if (!event.isAnyModifierKeyDown()) {
                        event.stopPropagation();
                    }
                }
                this.preventFilterAfterSelect = false;
                break;
            case KeyCodes.KEY_TAB:
            case KeyCodes.KEY_SHIFT:
            case KeyCodes.KEY_CTRL:
            case KeyCodes.KEY_ALT:
            case KeyCodes.KEY_DOWN:
            case KeyCodes.KEY_UP:
            case KeyCodes.KEY_PAGEDOWN:
            case KeyCodes.KEY_PAGEUP:
                // NOP
                break;
            case KeyCodes.KEY_ESCAPE:
                reset();
                break;
        }
        updateEditState();
    }
}
 
Example 4
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
/**
 * Triggered when a key was depressed.
 *
 * @param event
 *            The KeyUpEvent of the key depressed
 */
@Override
public void onKeyUp(KeyUpEvent event) {
	debug("VComboBoxMultiselect: onKeyUp(" + event.getNativeKeyCode() + ")");

	if (this.enabled && !this.readonly) {
		switch (event.getNativeKeyCode()) {
		case KeyCodes.KEY_ENTER:
		case KeyCodes.KEY_TAB:
		case KeyCodes.KEY_SHIFT:
		case KeyCodes.KEY_CTRL:
		case KeyCodes.KEY_ALT:
		case KeyCodes.KEY_DOWN:
		case KeyCodes.KEY_UP:
		case KeyCodes.KEY_PAGEDOWN:
		case KeyCodes.KEY_PAGEUP:
		case KeyCodes.KEY_ESCAPE:
			// NOP
			break;
		default:
			if (this.textInputEnabled) {
				// when filtering, we always want to see the results on the
				// first page first.
				filterOptions(0);
			}
			break;
		}
	}
}
 
Example 5
Source File: EventWrapper.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Converts the parameters to {@link KeyCodes} events to a KeyCombo.
 *
 * @return the key-combo representation of the key event.
 */
public static KeyCombo getKeyCombo(char keyCode, int modifiers) {
  int gwtCode = keyCode
      + (((modifiers & KeyCodes.KEY_CTRL) != 0) ? CTRL : 0)
      + (((modifiers & KeyCodes.KEY_SHIFT) != 0) ? SHIFT : 0)
      + (((modifiers & KeyCodes.KEY_ALT) != 0) ? ALT : 0);
  return keyMap.containsKey(gwtCode) ? keyMap.get(gwtCode) : KeyCombo.OTHER;
}
 
Example 6
Source File: EventWrapper.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Converts the parameters to {@link KeyCodes} events to a KeyCombo.
 *
 * @return the key-combo representation of the key event.
 */
public static KeyCombo getKeyCombo(char keyCode, int modifiers) {
  int gwtCode = keyCode
      + (((modifiers & KeyCodes.KEY_CTRL) != 0) ? CTRL : 0)
      + (((modifiers & KeyCodes.KEY_SHIFT) != 0) ? SHIFT : 0)
      + (((modifiers & KeyCodes.KEY_ALT) != 0) ? ALT : 0);
  return keyMap.containsKey(gwtCode) ? keyMap.get(gwtCode) : KeyCombo.OTHER;
}