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


Java KeyCodes.KEY_ESCAPE属性代码示例

本文整理汇总了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;
}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:18,代码来源:ToggleTool.java

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

示例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);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:CubaNotification.java

示例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;
		}
	}
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:18,代码来源:AboutDialog.java

示例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();
    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:18,代码来源:AutoCompleteTextFieldConnector.java

示例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;
    }
  }
}
 
开发者ID:mvp4g,项目名称:mvp4g-examples,代码行数:17,代码来源:AboutDialog.java

示例7: onKeyUp

@Override
public void onKeyUp(KeyUpEvent event) {
    if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
        event.preventDefault();
        closeFullScreen();
    }

}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:8,代码来源:VideoFullScreenHelper.java

示例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();
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:8,代码来源:BookmarkPopupContents.java

示例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();
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:12,代码来源:UniTimeDialogBox.java

示例10: onKeyDown

@Override
public void onKeyDown(KeyDownEvent event) {
    int keycode = event.getNativeKeyCode();
    if (KeyCodes.KEY_ESCAPE == keycode && selectionStart != null) {
        cancelRangeSelection();
    }
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:7,代码来源:MonthGrid.java

示例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);
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:9,代码来源:TextPropertyEditorBase.java

示例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);
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:9,代码来源:YoungAndroidDefaultURLPropertyEditor.java

示例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;
    }
}
 
开发者ID:czak,项目名称:retronix,代码行数:12,代码来源:Application.java

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

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


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