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


Java KeyCodes.KEY_UP属性代码示例

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


在下文中一共展示了KeyCodes.KEY_UP属性的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;
		}
	}
}
 
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:34,代码来源:VComboBoxMultiselect.java

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

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

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

示例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;
	}

}
 
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:42,代码来源:VComboBoxMultiselect.java

示例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;
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:8,代码来源:EventUtils.java

示例7: 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

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

示例9: 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();
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:36,代码来源:EventWrapper.java

示例10: 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();
    }
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:10,代码来源:ContactInputWidget.java

示例11: 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();
  }
}
 
开发者ID:codeaudit,项目名称:gwt-chronoscope,代码行数:34,代码来源:ChartKeyDownHandler.java

示例12: 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:
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:36,代码来源:PopupKeyDownListener.java

示例13: 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();
	}
}
 
开发者ID:mecatran,项目名称:OpenTripPlanner-client-gwt,代码行数:38,代码来源:ValueTextBox.java

示例14: 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);
}
 
开发者ID:mecatran,项目名称:OpenTripPlanner-client-gwt,代码行数:37,代码来源:ValueTextBox.java

示例15: createCurPageBox

/**
* Create a box that holds the current page.
*/
private void createCurPageBox() {
    // Setup the widget
    curPageBox.setWidth("3em");
    curPageBox.setText("1");
    curPageBox.setTextAlignment(TextBoxBase.ALIGN_RIGHT);

    // Disallow non-numeric pages
    KeyPressHandler handler = new KeyPressHandler() {
        public void onKeyPress(KeyPressEvent event) {
            char charCode = event.getCharCode();
            if (charCode == KeyCodes.KEY_ENTER) {
                PagingOptions.this.imageGridPanel.getImageGrid().gotoPage(getPagingBoxValue(), false);
            } else if (!Character.isDigit(charCode)
                    && (charCode != KeyCodes.KEY_TAB)
                    && (charCode != KeyCodes.KEY_BACKSPACE)
                    && (charCode != KeyCodes.KEY_DELETE)
                    && (charCode != KeyCodes.KEY_ENTER)
                    && (charCode != KeyCodes.KEY_HOME)
                    && (charCode != KeyCodes.KEY_END)
                    && (charCode != KeyCodes.KEY_LEFT) && (charCode != KeyCodes.KEY_UP)
                    && (charCode != KeyCodes.KEY_RIGHT)
                    && (charCode != KeyCodes.KEY_DOWN)) {
                curPageBox.cancelKey();
            }
        }
    };

    // Add the handler
    curPageBox.addKeyPressHandler(handler);
}
 
开发者ID:lsst,项目名称:firefly,代码行数:33,代码来源:PagingOptions.java


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