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


Java KeyCodes.KEY_RIGHT属性代码示例

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


在下文中一共展示了KeyCodes.KEY_RIGHT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleNavigationKeyEvents

private boolean handleNavigationKeyEvents(EditorEvent event) {
  editorInteractor.checkpoint(null);
  editorInteractor.clearCaretAnnotations();
  ContentNode node = cachedSelection.getFocus().getContainer();
  logger.trace().log("Navigation event");

  // Not using key combo, because we want to handle left key with
  // any modifiers also applying.
  // TODO(danilatos): MoveUnit, and holding down shift for selection.
  if (event.getKeyCode() == KeyCodes.KEY_LEFT) {
    router.handleLeft(node, event);
    editorInteractor.rebiasSelection(CursorDirection.FROM_RIGHT);
    return !event.shouldAllowBrowserDefault();
  } else if (event.getKeyCode() == KeyCodes.KEY_RIGHT) {
    router.handleRight(node, event);
    editorInteractor.rebiasSelection(CursorDirection.FROM_LEFT);
    return !event.shouldAllowBrowserDefault();
  } else {
    editorInteractor.rebiasSelection(CursorDirection.NEUTRAL);
  }
  return false;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:22,代码来源:EditorEventHandler.java

示例2: onKey

private void onKey(KeyEvent<?> event, int charCode, int keyCode) {
  if ('0' <= charCode && charCode <= '9') {
    if (event.isAnyModifierKeyDown()) {
      event.preventDefault();
    }
  } else {
    switch (keyCode) {
      case KeyCodes.KEY_BACKSPACE:
      case KeyCodes.KEY_LEFT:
      case KeyCodes.KEY_RIGHT:
      case KeyCodes.KEY_HOME:
      case KeyCodes.KEY_END:
      case KeyCodes.KEY_TAB:
      case KeyCodes.KEY_DELETE:
        break;

      default:
        // Allow copy and paste using ctl-c/ctrl-v,
        // or whatever the platform's convention is.
        if (!(event.isControlKeyDown() || event.isMetaKeyDown() || event.isAltKeyDown())) {
          event.preventDefault();
        }
        break;
    }
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:NpIntTextBox.java

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

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

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

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

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

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

示例9: describeKeyStroke

SafeHtml describeKeyStroke() {
  final SafeHtmlBuilder b = new SafeHtmlBuilder();

  if ((keyMask & M_CTRL) == M_CTRL) {
    modifier(b, KeyConstants.I.keyCtrl());
  }
  if ((keyMask & M_ALT) == M_ALT) {
    modifier(b, KeyConstants.I.keyAlt());
  }
  if ((keyMask & M_META) == M_META) {
    modifier(b, KeyConstants.I.keyMeta());
  }
  if ((keyMask & M_SHIFT) == M_SHIFT) {
    modifier(b, KeyConstants.I.keyShift());
  }

  final char c = (char) (keyMask & 0xffff);
  switch (c) {
    case KeyCodes.KEY_ENTER:
      namedKey(b, KeyConstants.I.keyEnter());
      break;
    case KeyCodes.KEY_ESCAPE:
      namedKey(b, KeyConstants.I.keyEsc());
      break;
    case KeyCodes.KEY_LEFT:
      namedKey(b, KeyConstants.I.keyLeft());
      break;
    case KeyCodes.KEY_RIGHT:
      namedKey(b, KeyConstants.I.keyRight());
      break;
    default:
      b.openSpan();
      b.setStyleName(KeyResources.I.css().helpKey());
      b.append(String.valueOf(c));
      b.closeSpan();
      break;
  }

  return b;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:40,代码来源:KeyCommand.java

示例10: handleEventInner

private void handleEventInner(Event event) {
  switch (DOM.eventGetType(event)) {
    case Event.ONCONTEXTMENU:
      event.preventDefault();
      break;
    case Event.ONKEYPRESS:
    case Event.ONKEYDOWN: {
      // NOTE(user): It is necessary to stop propagation on the key events to
      // prevent them from leaking to the blip/wave presenters.
      int keyCode = DOM.eventGetKeyCode(event);

      // Move left/right to previous/next drop down widget
      switch (keyCode) {
        case KeyCodes.KEY_LEFT:
        case KeyCodes.KEY_RIGHT:
          handler.handleLeftRight(keyCode == KeyCodes.KEY_RIGHT);
          event.stopPropagation();
          return;
        case KeyCodes.KEY_ENTER:
          event.stopPropagation();
      }

      if (keyCode >= '1' && keyCode <= '9') {
        // TODO(danilatos): Is this ok? i18n etc?
        int index = keyCode - '1';

        if (index >= 0 && index < getItems().size()) {
          MenuItem item = getItems().get(index);
          if (item == null) {
            return;
          }

          item.getCommand().execute();
          DOM.eventPreventDefault(event);
        }
      }
      break;
    }
    case Event.ONMOUSEOUT: {
      // Need to check that we really seem to have left the menu, as
      // mouse-out events get triggered whenever the mouse moves between
      // selections in the menu.
      EventTarget target = event.getRelatedEventTarget();
      Element targetElement = Element.as(target);
      if (!getElement().isOrHasChild(targetElement)) {
        handler.handleMouseOut();
      }
      break;
    }
    case Event.ONMOUSEOVER: {
      handler.handleMouseOver();
      break;
    }
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:55,代码来源:SuggestionMenu.java

示例11: isKeyRight

private static boolean isKeyRight(int keyCode) {
  return keyCode == KeyCodes.KEY_RIGHT
  || keyCode == SafariKeyboardConstants.SAFARI_RIGHT;
}
 
开发者ID:codeaudit,项目名称:gwt-chronoscope,代码行数:4,代码来源:ChartKeyUpHandler.java

示例12: handleEvent

public void handleEvent(NativeEvent event) {
  int code = event.getKeyCode();

  NativeEvent e = event;

  String type = event.getType();

  if ("keydown".equals(type) && keyEvent == Event.ONKEYDOWN
      || "keypress".equals(type) && keyEvent == Event.ONKEYPRESS) {

  } else {
    return;
  }

  if (component != null && component.getElement() != e.getCurrentEventTarget().cast()) {
    return;
  }

  if (preventDefault) {
    event.preventDefault();
  }

  onKeyPress(e);

  switch (code) {
    case KeyCodes.KEY_ALT:
      onAlt(e);
      break;
    case KeyCodes.KEY_BACKSPACE:
      onBackspace(e);
      break;
    case KeyCodes.KEY_CTRL:
      onControl(e);
      break;
    case KeyCodes.KEY_DELETE:
      onDelete(e);
      break;
    case KeyCodes.KEY_DOWN:
      onDown(e);
      break;
    case KeyCodes.KEY_END:
      onEnd(e);
      break;
    case KeyCodes.KEY_ENTER:
      onEnter(e);
      break;
    case KeyCodes.KEY_ESCAPE:
      onEsc(e);
      break;
    case KeyCodes.KEY_HOME:
      onHome(e);
      break;
    case KeyCodes.KEY_LEFT:
      onLeft(e);
      break;
    case KeyCodes.KEY_PAGEDOWN:
      onPageDown(e);
      break;
    case KeyCodes.KEY_PAGEUP:
      onPageUp(e);
      break;
    case KeyCodes.KEY_SHIFT:
      onShift(e);
      break;
    case KeyCodes.KEY_TAB:
      onTab(e);
      break;
    case KeyCodes.KEY_RIGHT:
      onRight(e);
      break;
    case KeyCodes.KEY_UP:
      onUp(e);
      break;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:75,代码来源:KeyboardNavigationHandler.java

示例13: _keyboardNavigation

private void _keyboardNavigation(final Event event) {
	// Handle keyboard events if keyboard navigation is enabled
	if (this.isKeyboardNavigationEnabled(_focusedItem)) {
		int code = event.getKeyCode();

		switch (KeyCodes.maybeSwapArrowKeysForRtl(code,LocaleInfo.getCurrentLocale().isRTL())) {
		case KeyCodes.KEY_UP: {
			List<TreeViewItem> slibingsBefore = _focusedItem.getSiblingsBefore();
			if (slibingsBefore != null) {
				_onFocus(slibingsBefore.get(slibingsBefore.size()-1));
			} else if (_focusedItem.getDirectAncestor() != null) {
				_onFocus(_focusedItem.getDirectAncestor());
			}
			break;
		}
		case KeyCodes.KEY_DOWN: {
			List<TreeViewItem> slibingsAfter = _focusedItem.getSiblingsAfter();
			if (slibingsAfter != null) {
				_onFocus(slibingsAfter.get(0));
			} else {
				TreeViewItem focusedItemAncestor = _focusedItem.getDirectAncestor();
				while (focusedItemAncestor != null && focusedItemAncestor.getNextSibling() == null) {
					focusedItemAncestor = focusedItemAncestor.getDirectAncestor();
				}
				if (focusedItemAncestor != null && focusedItemAncestor.getNextSibling() != null) _onFocus(focusedItemAncestor.getNextSibling());
			}
			break;
		}
		case KeyCodes.KEY_LEFT: {
			if (_focusedItem.getDirectAncestor() == null) return;
			_onFocus(_focusedItem.getDirectAncestor());
			break;
		}
		case KeyCodes.KEY_RIGHT: {
			if (!_focusedItem.hasChildren()) return;
			if (_focusedItem.isCollapsed()) _focusedItem.expand();	
			_onFocus(_focusedItem.getChildAt(0));	// move focus
			break;
		}
		default: {
			return;
		}
		}
	}
}
 
开发者ID:opendata-euskadi,项目名称:r01fb,代码行数:45,代码来源:TreeView.java

示例14: onKeyPress

@Override
public void onKeyPress(KeyPressEvent event) {
  final char code = event.getCharCode();
  final int nativeCode = event.getNativeEvent().getKeyCode();
  switch (nativeCode) {
    case KeyCodes.KEY_ALT:
    case KeyCodes.KEY_BACKSPACE:
    case KeyCodes.KEY_CTRL:
    case KeyCodes.KEY_DELETE:
    case KeyCodes.KEY_DOWN:
    case KeyCodes.KEY_END:
    case KeyCodes.KEY_ENTER:
    case KeyCodes.KEY_ESCAPE:
    case KeyCodes.KEY_HOME:
    case KeyCodes.KEY_LEFT:
    case KeyCodes.KEY_PAGEDOWN:
    case KeyCodes.KEY_PAGEUP:
    case KeyCodes.KEY_RIGHT:
    case KeyCodes.KEY_SHIFT:
    case KeyCodes.KEY_TAB:
    case KeyCodes.KEY_UP:
      // Allow these, even if one of their assigned codes is
      // identical to an ASCII character we do not want to
      // allow in the box.
      //
      // We still want to let the user move around the input box
      // with their arrow keys, or to move between fields using tab.
      // Invalid characters introduced will be caught through the
      // server's own validation of the input data.
      //
      break;

    default:
      final TextBox box = (TextBox) event.getSource();
      final String re;
      if (box.getCursorPos() == 0) {
        re = Account.USER_NAME_PATTERN_FIRST;
      } else {
        re = Account.USER_NAME_PATTERN_REST;
      }
      if (!String.valueOf(code).matches("^" + re + "$")) {
        event.preventDefault();
        event.stopPropagation();
      }
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:46,代码来源:UsernameField.java

示例15: getKeyCode

@Override
public int getKeyCode() {
    return KeyCodes.KEY_RIGHT;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:4,代码来源:KeyboardOperationMoveRight.java


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