本文整理匯總了Java中com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER屬性的典型用法代碼示例。如果您正苦於以下問題:Java KeyCodes.KEY_ENTER屬性的具體用法?Java KeyCodes.KEY_ENTER怎麽用?Java KeyCodes.KEY_ENTER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.google.gwt.event.dom.client.KeyCodes
的用法示例。
在下文中一共展示了KeyCodes.KEY_ENTER屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
}
}
示例2: 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;
}
}
}
示例3: searchBoxEnter
@UiHandler("searchBox")
void searchBoxEnter(KeyDownEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
SuggestionDisplay suggestionDisplay = searchBox.getSuggestionDisplay();
// This should always be true unless GWT changes the type of the suggestion generated by the
// SuggestBox. It is too complicated and nasty to switch out the SuggestBox suggestion display
// factory, so we're left with this type safety check and broken functionality if GWT changes.
Preconditions.checkState(suggestionDisplay instanceof DefaultSuggestionDisplay);
// At this point this should always be true.
if (suggestionDisplay instanceof DefaultSuggestionDisplay) {
DefaultSuggestionDisplay suggestions = (DefaultSuggestionDisplay) suggestionDisplay;
if (!suggestions.isSuggestionListShowing()) {
presenter.handleSearch(searchBox.getValue());
}
}
}
}
示例4: 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();
}
}
示例5: onProjectNameChanged
@UiHandler("projectName")
void onProjectNameChanged(KeyUpEvent event) {
if (projectName.getValue() != null && projectName.getValue().contains(" ")) {
String tmp = projectName.getValue();
while (tmp.contains(" ")) {
tmp = tmp.replaceAll(" ", "-");
}
projectName.setValue(tmp);
}
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
return;
}
delegate.projectNameChanged(projectName.getText());
}
示例6: 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();
}
}
示例7: 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();
}
}
示例8: addKeyShortcuts
private void addKeyShortcuts() {
final KeyShortcutHandler keyShortcut = new KeyShortcutHandler(
getButton(PredefinedButton.OK), KeyCodes.KEY_ENTER);
latitudTextField.addKeyDownHandler(keyShortcut);
longitudTextField.addKeyDownHandler(keyShortcut);
}
示例9: addKeyShortcuts
private void addKeyShortcuts() {
KeyShortcutHandler keyShortcut = new KeyShortcutHandler(searchButton,
KeyCodes.KEY_ENTER);
layerNameField.addKeyDownHandler(keyShortcut);
valueAttributeField.addKeyDownHandler(keyShortcut);
attributeCombo.addKeyDownHandler(keyShortcut);
}
示例10: addKeyShortcuts
private void addKeyShortcuts() {
KeyShortcutHandler keyShortcut = new KeyShortcutHandler(
getButton(PredefinedButton.OK), KeyCodes.KEY_ENTER);
layerName.addKeyDownHandler(keyShortcut);
projectionName.addKeyDownHandler(keyShortcut);
vectorFormatCombo.addKeyDownHandler(keyShortcut);
geoDataTextArea.addKeyDownHandler(keyShortcut);
}
示例11: addKeyShortcuts
private void addKeyShortcuts() {
KeyShortcutHandler keyShortcut = new KeyShortcutHandler(
getButton(PredefinedButton.OK), KeyCodes.KEY_ENTER);
vectorFormatCombo.addKeyDownHandler(keyShortcut);
epsgCombo.addKeyDownHandler(keyShortcut);
}
示例12: handleKeyPress
private void handleKeyPress(char keyCode) {
if (keyCode == KeyCodes.KEY_ENTER || keyCode == KeyCodes.KEY_TAB) {
// Pressing <tab>, <enter> or <return> will surrender focus.
textEdit.cancelKey();
textEdit.setFocus(false);
} else if (!validateKeyCode(keyCode)) {
textEdit.cancelKey();
}
}
示例13: handleKeyPress
private void handleKeyPress(char keyCode) {
if (keyCode == KeyCodes.KEY_ENTER || keyCode == KeyCodes.KEY_TAB) {
// Pressing <tab>, <enter> or <return> will surrender focus.
urlField.cancelKey();
urlField.setFocus(false);
} else if (!validateKeyCode(keyCode)) {
urlField.cancelKey();
}
}
示例14: 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;
}
}
示例15: onKeyDown
@Override
public void onKeyDown(KeyDownEvent event) {
if (this.enabled && !this.readonly) {
int keyCode = event.getNativeKeyCode();
debug("VComboBoxMultiselect: key down: " + keyCode);
if (this.dataReceivedHandler.isWaitingForFilteringResponse() && navigationKeyCodes.contains(keyCode)
&& (!this.allowNewItems || keyCode != KeyCodes.KEY_ENTER)) {
/*
* Keyboard navigation events should not be handled while we are
* waiting for a response. This avoids flickering, disappearing
* items, wrongly interpreted responses and more.
*/
debug("Ignoring " + keyCode + " because we are waiting for a filtering response");
DOM.eventPreventDefault(DOM.eventGetCurrentEvent());
event.stopPropagation();
return;
}
if (this.suggestionPopup.isAttached()) {
debug("Keycode " + keyCode + " target is popup");
popupKeyDown(event);
} else {
debug("Keycode " + keyCode + " target is text field");
inputFieldKeyDown(event);
}
}
}