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