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


Java KeyCodes.KEY_DELETE属性代码示例

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


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

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

示例4: isAcceleratorInner

/**
 * Parameterised to allow testing different browser/os permuations
 * @param event
 * @param isMac
 * @param quirksHasOldSchoolClipboardShortcuts
 */
@VisibleForTesting
static boolean isAcceleratorInner(SignalEvent event, boolean isMac,
    boolean quirksHasOldSchoolClipboardShortcuts) {
  switch (event.getKeySignalType()) {
    case INPUT:
      // Alt on its own is a simple modifier, like shift, on OSX
      boolean maybeAltKey = !isMac && event.getAltKey();

      // NOTE(user): Perhaps we should create a registry in
      // EditorEventSubHandler of non-metesque like command keys such as TAB.
      // For now TAB is our only special case, but we may need to allow
      // implementers to define arbitrary keys as accelerators.
      return event.getCtrlKey() || event.getMetaKey() || event.getKeyCode() == KeyCodes.KEY_TAB
          || maybeAltKey;
    case DELETE:
      if (quirksHasOldSchoolClipboardShortcuts &&
          event.getKeyCode() == KeyCodes.KEY_DELETE && KeyModifier.SHIFT.check(event)) {

        // shift+delete on windows/linux is cut
        // (shift+insert and ctrl+insert are other clipboard alternatives,
        // but that's handled below).

        return true;
      } else {
        return false;
      }
    case NAVIGATION:
      // All navigation does not count
      return false;
    case NOEFFECT:
      // Random special keys like ESC, F7, TAB, INS, etc count
      return true;
  }
  throw new RuntimeException("Unknown KeySignal type");
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:41,代码来源:EditorEventHandler.java

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

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

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

示例8: isDelKey

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

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

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

示例11: getKeyCode

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


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