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


Java KeyCodes.KEY_HOME属性代码示例

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


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

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

示例2: onKeyDown

@Override
public void onKeyDown(KeyDownEvent event) {
	int key = event.getNativeKeyCode();
	if (event.isControlKeyDown()) {
		if (key == KEY_PLUS || key == KEY_MINUS) {
			app.getToolbar().zoomChangeClicked(key == KEY_PLUS ? 1 : -1);
			event.preventDefault();
		}
	} else if (!event.isShiftKeyDown()) {
		boolean handled = true;
		switch (key) {
		case KeyCodes.KEY_HOME:
			changePage(0, -1, -1);
			break;
		case KeyCodes.KEY_END:
			changePage(dataStore.getPageCount() - 1, 1, 1);
			break;
		default:
			handled = false;
		}
		if (handled)
			event.preventDefault();
	}
}
 
开发者ID:mateusz-matela,项目名称:djvu-html5,代码行数:24,代码来源:SinglePageLayout.java

示例3: isNavigationKey

public static boolean isNavigationKey(int keyCode) {
	if (isArrowKey(keyCode) || KeyCodes.KEY_HOME == keyCode || KeyCodes.KEY_END == keyCode ||
			KeyCodes.KEY_PAGEUP == keyCode || KeyCodes.KEY_PAGEDOWN == keyCode) {
		return true;
	} else {
		return false;
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:8,代码来源:EventUtils.java

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

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

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

示例7: isHomeKey

public static boolean isHomeKey(int keycode) {
	if(keycode == KeyCodes.KEY_HOME) {
		return true;
	}
	return false;
}
 
开发者ID:TatuLund,项目名称:GridFastNavigation,代码行数:6,代码来源:Keys.java

示例8: isMaxZoomOut

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

示例9: handleEvent

@Override
public void handleEvent(Event evt) {
  if (Event.KEYDOWN.equalsIgnoreCase(evt.getType())) {
    final KeyboardEvent keyEvent = (KeyboardEvent) evt;
    switch (keyEvent.getKeyCode()) {
      case KeyCodes.KEY_ESCAPE:
        Scheduler.get().scheduleDeferred(this::hide);
        break;

      case KeyCodes.KEY_DOWN:
        selectNext();
        evt.preventDefault();
        break;

      case KeyCodes.KEY_UP:
        selectPrevious();
        evt.preventDefault();
        break;

      case KeyCodes.KEY_PAGEUP:
        selectPreviousPage();
        evt.preventDefault();
        break;

      case KeyCodes.KEY_PAGEDOWN:
        selectNextPage();
        evt.preventDefault();
        break;

      case KeyCodes.KEY_HOME:
        selectFirst();
        break;

      case KeyCodes.KEY_END:
        selectLast();
        break;

      case KeyCodes.KEY_ENTER:
        evt.preventDefault();
        evt.stopImmediatePropagation();
        validateItem(true);
        break;

      case KeyCodes.KEY_TAB:
        evt.preventDefault();
        evt.stopImmediatePropagation();
        validateItem(false);
        break;
    }
  } else if (Event.SCROLL.equalsIgnoreCase(evt.getType())) {
    updateIfNecessary();
  } else if (Event.FOCUS.equalsIgnoreCase(evt.getType())) {
    focused = true;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:55,代码来源:ContentAssistWidget.java

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

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

示例12: getKeyCode

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


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