コード例 #1
0
 /**
  * Called when a KeyPress event is triggered inside the rich text area.
  *
  * @param event the native event that was fired
  */
 protected void onKeyPress(Event event) {
   switch (event.getKeyCode()) {
     case KeyCodes.KEY_TAB:
       onTab(event);
       break;
     case KeyCodes.KEY_DELETE:
       onDelete(event);
       break;
     case KeyCodes.KEY_BACKSPACE:
       onBackSpace(event);
       break;
     default:
       break;
   }
 }
コード例 #2
0
  /**
   * Called when a KeyDown event is triggered inside the rich text area.
   *
   * @param event the native event that was fired
   */
  protected void onKeyDown(Event event) {
    if (event == null || event.isCancelled()) {
      return;
    }

    switch (event.getKeyCode()) {
      case KeyCodes.KEY_DOWN:
        onDownArrow(event);
        break;
      case KeyCodes.KEY_UP:
        onUpArrow(event);
        break;
      default:
        break;
    }
  }
コード例 #3
0
  @Override
  protected void onKeyDown(Event event) {
    if (event == null || event.isCancelled()) {
      return;
    }

    switch (event.getKeyCode()) {
      case KeyCodes.KEY_TAB:
        // IE moves the focus when Tab key is down and thus the key press event doesn't get fired.
        // If we block
        // the key down event then IE doesn't fire key press. We are forced to apply out custom
        // behavior for tab
        // key now, on key down, and not later, on key press.
        onTab(event);
        break;
      default:
        super.onKeyDown(event);
        break;
    }
  }