/** * 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; } }
/** * 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; } }
@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; } }