本文整理汇总了Java中com.google.gwt.event.dom.client.KeyCodes.KEY_DOWN属性的典型用法代码示例。如果您正苦于以下问题:Java KeyCodes.KEY_DOWN属性的具体用法?Java KeyCodes.KEY_DOWN怎么用?Java KeyCodes.KEY_DOWN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.gwt.event.dom.client.KeyCodes
的用法示例。
在下文中一共展示了KeyCodes.KEY_DOWN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
}
示例3: onKeyUp
@Override
public void onKeyUp(KeyUpEvent event) {
if (iCourses.getRowCount() < 2 || iCourses.getData(1) == null) return;
int row = iCourses.getSelectedRow();
if (event.getNativeKeyCode() == KeyCodes.KEY_DOWN) {
if (row < 0 || iCourses.getSelectedRow() + 1 >= iCourses.getRowCount())
iCourses.setSelected(1, true);
else
iCourses.setSelected(row + 1, true);
scrollToSelectedRow();
updateCourseDetails();
} else if (event.getNativeKeyCode()==KeyCodes.KEY_UP) {
if (row - 1 < 1)
iCourses.setSelected(iCourses.getRowCount() - 1, true);
else
iCourses.setSelected(row - 1, true);
scrollToSelectedRow();
updateCourseDetails();
} else if (event.isControlKeyDown() || event.isAltKeyDown()) {
for (Map.Entry<Character, Integer> entry: iTabAccessKeys.entrySet())
if (event.getNativeKeyCode() == Character.toLowerCase(entry.getKey()) || event.getNativeKeyCode() == Character.toUpperCase(entry.getKey())) {
iCourseDetailsTabBar.selectTab(entry.getValue(), true);
event.preventDefault();
event.stopPropagation();
}
}
}
示例4: 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;
}
}
示例5: inputFieldKeyDown
/**
* Triggered when a key is pressed in the text box
*
* @param event
* The KeyDownEvent
*/
private void inputFieldKeyDown(KeyDownEvent event) {
debug("VComboBoxMultiselect: inputFieldKeyDown(" + event.getNativeKeyCode() + ")");
switch (event.getNativeKeyCode()) {
case KeyCodes.KEY_DOWN:
case KeyCodes.KEY_UP:
case KeyCodes.KEY_PAGEDOWN:
case KeyCodes.KEY_PAGEUP:
// open popup as from gadget
filterOptions(-1, "");
this.tb.selectAll();
this.dataReceivedHandler.popupOpenerClicked();
break;
case KeyCodes.KEY_ENTER:
/*
* This only handles the case when new items is allowed, a text is
* entered, the popup opener button is clicked to close the popup
* and enter is then pressed (see #7560).
*/
if (!this.allowNewItems) {
return;
}
if (this.currentSuggestion != null && this.tb.getText()
.equals(this.currentSuggestion.getReplacementString())) {
// Retain behavior from #6686 by returning without stopping
// propagation if there's nothing to do
return;
}
this.dataReceivedHandler.reactOnInputWhenReady(this.tb.getText());
event.stopPropagation();
break;
}
}
示例6: isArrowKey
public static boolean isArrowKey(int keyCode) {
if (KeyCodes.KEY_LEFT == keyCode || KeyCodes.KEY_RIGHT == keyCode || KeyCodes.KEY_UP == keyCode
|| KeyCodes.KEY_DOWN == keyCode) {
return true;
} else {
return false;
}
}
示例7: 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;
}
}
示例8: 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();
}
}
示例9: 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;
}
}
}
示例10: keyToString
private static String keyToString(int code) {
switch (code) {
case KeyCodes.KEY_SPACE:
return "Space";
case KeyCodes.KEY_BACKSPACE:
return "Backspace";
case KeyCodes.KEY_DELETE:
return "Del";
case KeyCodes.KEY_INSERT:
return "Insert";
case KeyCodes.KEY_ENTER:
return "Enter";
case KeyCodes.KEY_ESCAPE:
return "Esc";
case KeyCodes.KEY_TAB:
return "Tab";
case KeyCodes.KEY_HOME:
return "Home";
case KeyCodes.KEY_END:
return "End";
case KeyCodes.KEY_PAGEUP:
return "PageUp";
case KeyCodes.KEY_PAGEDOWN:
return "PageDown";
case KeyCodes.KEY_LEFT:
return "\u2190";
case KeyCodes.KEY_UP:
return "\u2191";
case KeyCodes.KEY_RIGHT:
return "\u2192";
case KeyCodes.KEY_DOWN:
return "\u2193";
default:
return new Character((char) code).toString();
}
}
示例11: onKeyDown
@Override
public void onKeyDown(KeyDownEvent event) {
if (listener != null) {
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_UP) {
listener.onKeyUp();
} else if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_DOWN) {
listener.onKeyDown();
}
}
}
示例12: onKeyDown
public void onKeyDown(KeyDownEvent event) {
ChartState chartInfo = getChartState(event);
Chart chart = chartInfo.chart;
boolean handled = true;
int keyCode = event.getNativeKeyCode();
// all checks (except TAB) are to prevent focus stealing by the browser.
if (keyCode == KeyCodes.KEY_PAGEUP) {
} else if (keyCode == KeyCodes.KEY_PAGEDOWN) {
} else if (keyCode == KeyCodes.KEY_UP) {
if (UP_NUM < KEY_DOWN_MAX) {
if (UP_NUM != 0) {
chart.nextZoom();
}
UP_NUM++;
}
} else if (keyCode == KeyCodes.KEY_DOWN) {
if (DOWN_NUM < KEY_DOWN_MAX) {
if (DOWN_NUM != 0) {
chart.prevZoom();
}
DOWN_NUM++;
}
} else if (keyCode == KeyCodes.KEY_TAB) {
handled = handleTabKey((Event) event.getNativeEvent(), chartInfo, keyCode,
event.isShiftKeyDown());
} else {
handled = false;
}
chartInfo.setHandled(handled);
if (handled) {
event.stopPropagation();
event.preventDefault();
}
}
示例13: handleEvent
@Override
public void handleEvent(final Event evt) {
if (evt instanceof KeyboardEvent) {
final KeyboardEvent keyEvent = (KeyboardEvent) evt;
switch (keyEvent.getKeyCode()) {
case KeyCodes.KEY_ESCAPE:
Scheduler.get()
.scheduleDeferred(
new ScheduledCommand() {
@Override
public void execute() {
popupWidget.hide();
}
});
break;
case KeyCodes.KEY_DOWN:
focusNext();
break;
case KeyCodes.KEY_UP:
focusPrevious();
break;
case KeyCodes.KEY_HOME:
focusFirst();
break;
case KeyCodes.KEY_END:
focusLast();
break;
case KeyCodes.KEY_ENTER:
evt.preventDefault();
evt.stopImmediatePropagation();
validateItem();
break;
default:
}
}
}
示例14: onKeyUp
@Override
public void onKeyUp(KeyUpEvent event) {
if (isReadOnly() || !isEnabled()) {
return;
}
int keyCode = event.getNativeEvent().getKeyCode();
boolean processed = false;
switch (keyCode) {
case KeyCodes.KEY_LEFT:
case KeyCodes.KEY_RIGHT:
case KeyCodes.KEY_BACKSPACE:
case KeyCodes.KEY_DELETE:
case KeyCodes.KEY_TAB:
if (getText().isEmpty()) {
setValue(formatValue(min));
}
return;
case KeyCodes.KEY_UP:
if (step != 0) {
increaseValue();
processed = true;
}
break;
case KeyCodes.KEY_DOWN:
if (step != 0) {
decreaseValue();
processed = true;
}
break;
}
if (processed) {
cancelKey();
}
}
示例15: onKeyPress
@Override
public void onKeyPress(KeyPressEvent event) {
if (isReadOnly() || !isEnabled()) {
return;
}
int keyCode = event.getNativeEvent().getKeyCode();
switch (keyCode) {
case KeyCodes.KEY_LEFT:
case KeyCodes.KEY_RIGHT:
case KeyCodes.KEY_BACKSPACE:
case KeyCodes.KEY_DELETE:
case KeyCodes.KEY_TAB:
case KeyCodes.KEY_UP:
case KeyCodes.KEY_DOWN:
return;
}
int index = getCursorPos();
String previousText = getText();
String newText;
if (getSelectionLength() > 0) {
newText = previousText.substring(0, getCursorPos())
+ event.getCharCode()
+ previousText.substring(
getCursorPos() + getSelectionLength(),
previousText.length());
} else {
newText = previousText.substring(0, index) + event.getCharCode()
+ previousText.substring(index, previousText.length());
}
cancelKey();
setValue(newText, true);
}