本文整理汇总了Java中com.google.gwt.event.dom.client.KeyCodes.KEY_ESCAPE属性的典型用法代码示例。如果您正苦于以下问题:Java KeyCodes.KEY_ESCAPE属性的具体用法?Java KeyCodes.KEY_ESCAPE怎么用?Java KeyCodes.KEY_ESCAPE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.gwt.event.dom.client.KeyCodes
的用法示例。
在下文中一共展示了KeyCodes.KEY_ESCAPE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setEscapeHandler
private KeyUpHandler setEscapeHandler() {
KeyUpHandler handler = new KeyUpHandler() {
@Override
public void onKeyUp(final KeyUpEvent event) {
if (KeyCodes.KEY_ESCAPE == event.getNativeEvent().getKeyCode()) {
for (Control control : controls) {
try {
((DrawFeature) control).cancel();
} catch (Exception e) {
LOGGER.error("ACTION CANCELED: "
+ control.getControlId());
}
}
}
}
};
return handler;
}
示例2: onKeyDown
@Override
public void onKeyDown(KeyDownEvent keyDownEvent) {
if (keyDownEvent.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
SimplePanel panel = WidgetUtil.findWidget(WidgetUtil.getFocusedElement(), SimplePanel.class);
if (panel != null) {
WidgetUtil.focus(panel.getParent().getElement());
// prevent further bubbling of the event as it has only
// navigational purpose if thrown at this depth. A subsequent
// press of ESC is not stopped, so ESC abort actions of the
// application should work as soon as the focus is in
// "navigational mode" on a grid-cell
keyDownEvent.preventDefault();
keyDownEvent.stopPropagation();
}
}
}
示例3: onEventPreview
@Override
public boolean onEventPreview(Event event) {
int type = DOM.eventGetType(event);
if ((type == Event.ONCLICK || type == Event.ONTOUCHEND)
&& event.getEventTarget() != null) {
Element target = Element.as(event.getEventTarget());
if (target.getClassName() != null && target.getClassName().contains(CUBA_NOTIFICATION_MODALITY_CURTAIN)) {
hide();
return false;
}
}
if (type == Event.ONKEYDOWN && event.getKeyCode() == KeyCodes.KEY_ESCAPE) {
if (!getElement().getClassName().contains(TRAY_STYLE)) {
hide();
return false;
}
}
return super.onEventPreview(event);
}
示例4: onPreviewNativeEvent
@Override
protected void onPreviewNativeEvent(NativePreviewEvent preview) {
super.onPreviewNativeEvent(preview);
NativeEvent evt = preview.getNativeEvent();
if (evt.getType().equals("keydown")) {
// Use the popup's key preview hooks to close the dialog when either
// enter or escape is pressed.
switch (evt.getKeyCode()) {
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_ESCAPE:
hide();
break;
default:
break;
}
}
}
示例5: handlePanelEventDelegation
private void handlePanelEventDelegation(final KeyUpEvent event) {
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_DOWN:
arrowKeyDown(event);
break;
case KeyCodes.KEY_UP:
arrorKeyUp(event);
break;
case KeyCodes.KEY_ESCAPE:
escapeKey();
break;
case KeyCodes.KEY_ENTER:
enterKey();
break;
default:
doAskForSuggestion();
}
}
示例6: onPreviewNativeEvent
@Override
protected void onPreviewNativeEvent(NativePreviewEvent preview) {
super.onPreviewNativeEvent(preview);
NativeEvent evt = preview.getNativeEvent();
if (evt.getType()
.equals("keydown")) {
// Use the popup's key preview hooks to close the dialog when either
// enter or escape is pressed.
switch (evt.getKeyCode()) {
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_ESCAPE:
hide();
break;
}
}
}
示例7: onKeyUp
@Override
public void onKeyUp(KeyUpEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
event.preventDefault();
closeFullScreen();
}
}
示例8: titleKeyDownHandler
@UiHandler("titleTextBox")
public void titleKeyDownHandler(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
presenter.applyBookmark();
} else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
presenter.discardChanges();
}
}
示例9: onPreviewNativeEvent
@Override
protected void onPreviewNativeEvent(NativePreviewEvent event) {
super.onPreviewNativeEvent(event);
if (isEscapeToHide() && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) {
AriaStatus.getInstance().setText(ARIA.dialogClosed(getText()));
hide();
} if (isEnterToSubmit() && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
event.getNativeEvent().stopPropagation();
event.getNativeEvent().preventDefault();
iSubmitHandler.execute();
}
}
示例10: onKeyDown
@Override
public void onKeyDown(KeyDownEvent event) {
int keycode = event.getNativeKeyCode();
if (KeyCodes.KEY_ESCAPE == keycode && selectionStart != null) {
cancelRangeSelection();
}
}
示例11: handleKeyUp
private void handleKeyUp(int keyCode) {
if (keyCode == KeyCodes.KEY_ESCAPE) {
// Pressing <esc> will reset the content of the editor to the previous property value as well
// as surrender focus.
updateValue(); // Restore previous property value.
textEdit.cancelKey();
textEdit.setFocus(false);
}
}
示例12: handleKeyUp
private void handleKeyUp(int keyCode) {
if (keyCode == KeyCodes.KEY_ESCAPE) {
// Pressing <esc> will reset the content of the editor to the previous property value as well
// as surrender focus.
updateValue(); // Restore previous property value.
urlField.cancelKey();
urlField.setFocus(false);
}
}
示例13: onKeyDown
@Override
public void onKeyDown(KeyDownEvent event) {
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_LEFT: game.addEvent(Event.LEFT); break;
case KeyCodes.KEY_RIGHT: game.addEvent(Event.RIGHT); break;
case KeyCodes.KEY_UP: game.addEvent(Event.UP); break;
case KeyCodes.KEY_DOWN: game.addEvent(Event.DOWN); break;
case KeyCodes.KEY_ENTER: game.addEvent(Event.SELECT); break;
case KeyCodes.KEY_ESCAPE: game.addEvent(Event.BACK); break;
default: return;
}
}
示例14: 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;
}
}
}
示例15: 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();
}
}