当前位置: 首页>>代码示例>>Java>>正文


Java KeyCodes.KEY_ALT属性代码示例

本文整理汇总了Java中com.google.gwt.event.dom.client.KeyCodes.KEY_ALT属性的典型用法代码示例。如果您正苦于以下问题:Java KeyCodes.KEY_ALT属性的具体用法?Java KeyCodes.KEY_ALT怎么用?Java KeyCodes.KEY_ALT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.gwt.event.dom.client.KeyCodes的用法示例。


在下文中一共展示了KeyCodes.KEY_ALT属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onKeyUp

/**
 * 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;
		}
	}
}
 
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:34,代码来源:VComboBoxMultiselect.java

示例2: isModifierKey

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;
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:8,代码来源:EventUtils.java

示例3: onKeyUp

@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();
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:33,代码来源:CubaSearchSelectWidget.java

示例4: onKeyUp

@Override
public void onKeyUp(KeyUpEvent event) {
    if (enabled && !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:
                // special case for "clear" shortcut action
                if (event.isShiftKeyDown() && event.getNativeKeyCode() == KeyCodes.KEY_DELETE) {
                    suggestionPopup.hide();
                } else {
                    // do not show options popup if we handle shortcut action
                    if (!event.isControlKeyDown()
                            && !event.isAltKeyDown()) {
                        super.onKeyUp(event);
                    }
                }
                break;
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:31,代码来源:CubaComboBoxWidget.java

示例5: getKeyCombo

/**
 * 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;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:12,代码来源:EventWrapper.java

示例6: handleEvent

public void handleEvent(NativeEvent event) {
  int code = event.getKeyCode();

  NativeEvent e = event;

  String type = event.getType();

  if ("keydown".equals(type) && keyEvent == Event.ONKEYDOWN
      || "keypress".equals(type) && keyEvent == Event.ONKEYPRESS) {

  } else {
    return;
  }

  if (component != null && component.getElement() != e.getCurrentEventTarget().cast()) {
    return;
  }

  if (preventDefault) {
    event.preventDefault();
  }

  onKeyPress(e);

  switch (code) {
    case KeyCodes.KEY_ALT:
      onAlt(e);
      break;
    case KeyCodes.KEY_BACKSPACE:
      onBackspace(e);
      break;
    case KeyCodes.KEY_CTRL:
      onControl(e);
      break;
    case KeyCodes.KEY_DELETE:
      onDelete(e);
      break;
    case KeyCodes.KEY_DOWN:
      onDown(e);
      break;
    case KeyCodes.KEY_END:
      onEnd(e);
      break;
    case KeyCodes.KEY_ENTER:
      onEnter(e);
      break;
    case KeyCodes.KEY_ESCAPE:
      onEsc(e);
      break;
    case KeyCodes.KEY_HOME:
      onHome(e);
      break;
    case KeyCodes.KEY_LEFT:
      onLeft(e);
      break;
    case KeyCodes.KEY_PAGEDOWN:
      onPageDown(e);
      break;
    case KeyCodes.KEY_PAGEUP:
      onPageUp(e);
      break;
    case KeyCodes.KEY_SHIFT:
      onShift(e);
      break;
    case KeyCodes.KEY_TAB:
      onTab(e);
      break;
    case KeyCodes.KEY_RIGHT:
      onRight(e);
      break;
    case KeyCodes.KEY_UP:
      onUp(e);
      break;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:75,代码来源:KeyboardNavigationHandler.java

示例7: onKeyPress

@Override
public void onKeyPress(KeyPressEvent event) {
  final char code = event.getCharCode();
  final int nativeCode = event.getNativeEvent().getKeyCode();
  switch (nativeCode) {
    case KeyCodes.KEY_ALT:
    case KeyCodes.KEY_BACKSPACE:
    case KeyCodes.KEY_CTRL:
    case KeyCodes.KEY_DELETE:
    case KeyCodes.KEY_DOWN:
    case KeyCodes.KEY_END:
    case KeyCodes.KEY_ENTER:
    case KeyCodes.KEY_ESCAPE:
    case KeyCodes.KEY_HOME:
    case KeyCodes.KEY_LEFT:
    case KeyCodes.KEY_PAGEDOWN:
    case KeyCodes.KEY_PAGEUP:
    case KeyCodes.KEY_RIGHT:
    case KeyCodes.KEY_SHIFT:
    case KeyCodes.KEY_TAB:
    case KeyCodes.KEY_UP:
      // Allow these, even if one of their assigned codes is
      // identical to an ASCII character we do not want to
      // allow in the box.
      //
      // We still want to let the user move around the input box
      // with their arrow keys, or to move between fields using tab.
      // Invalid characters introduced will be caught through the
      // server's own validation of the input data.
      //
      break;

    default:
      final TextBox box = (TextBox) event.getSource();
      final String re;
      if (box.getCursorPos() == 0) {
        re = Account.USER_NAME_PATTERN_FIRST;
      } else {
        re = Account.USER_NAME_PATTERN_REST;
      }
      if (!String.valueOf(code).matches("^" + re + "$")) {
        event.preventDefault();
        event.stopPropagation();
      }
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:46,代码来源:UsernameField.java


注:本文中的com.google.gwt.event.dom.client.KeyCodes.KEY_ALT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。