Exemplo n.º 1
0
 @Override
 public boolean onKeyboardEvent(KeyboardEvent event) {
   if (event == null) throw new NullPointerException("event may not be null");
   if (!event.isSpecial() || event.isModified()) return false;
   switch (event.getSpecial()) {
     case ARROW_DOWN:
       return onArrowDown(event, false);
     case ARROW_UP:
       return onArrowUp(event, false);
     case ARROW_RIGHT:
       return onArrowRight(event);
     case ARROW_LEFT:
       return onArrowLeft(event);
     case ALTERNATIVE_ARROW_DOWN:
       return onArrowDown(event, true);
     case ALTERNATIVE_ARROW_UP:
       return onArrowUp(event, true);
       // FIXME:case KeyboardEvent.ALTERNATIVE_ARROW_RIGHT:
       // FIXME:case KeyboardEvent.ALTERNATIVE_ARROW_LEFT:
     case HOME:
       return onHome(event);
     case END:
       return onEnd(event);
     case ALTERNATIVE_HOME:
       return onLineHome(event);
     case ALTERNATIVE_END:
       return onLineEnd(event);
     case PAGE_DOWN:
       return onPageDown(event, false);
     case PAGE_UP:
       return onPageUp(event, false);
     case ALTERNATIVE_PAGE_DOWN:
       return onPageDown(event, true);
     case ALTERNATIVE_PAGE_UP:
       return onPageUp(event, true);
     case ENTER:
       if (noProperContent()
           || clickHandler == null
           || hotPointY < 0
           || hotPointY >= model.getRowCount()
           || getColUnderPos(hotPointX) < 0) return false;
       return clickHandler.onClick(
           model,
           getColUnderPos(hotPointX),
           hotPointY,
           model.getCell(getColUnderPos(hotPointX), hotPointY));
     default:
       return false;
   }
 }
Exemplo n.º 2
0
 @Override
 public boolean onKeyboardEvent(KeyboardEvent event) {
   NullCheck.notNull(event, "event");
   if (!event.isSpecial() && (!event.isModified() || event.withShiftOnly())) return onChar(event);
   if (!event.isSpecial() || event.isModified()) return false;
   switch (event.getSpecial()) {
     case ARROW_DOWN:
       return onArrowDown(event, false);
     case ARROW_UP:
       return onArrowUp(event, false);
     case ARROW_RIGHT:
       return onArrowRight(event);
     case ARROW_LEFT:
       return onArrowLeft(event);
     case ALTERNATIVE_ARROW_DOWN:
       return onArrowDown(event, true);
     case ALTERNATIVE_ARROW_UP:
       return onArrowUp(event, true);
     case ALTERNATIVE_ARROW_RIGHT:
       return onAltRight(event);
     case ALTERNATIVE_ARROW_LEFT:
       return onAltLeft(event);
     case HOME:
       return onHome(event);
     case END:
       return onEnd(event);
     case ALTERNATIVE_HOME:
       return onAltHome(event);
     case ALTERNATIVE_END:
       return onAltEnd(event);
     case PAGE_DOWN:
       return onPageDown(event, false);
     case PAGE_UP:
       return onPageUp(event, false);
     case ALTERNATIVE_PAGE_DOWN:
       return onPageDown(event, true);
     case ALTERNATIVE_PAGE_UP:
       return onPageUp(event, true);
     case INSERT:
       return onInsert(event);
     case ENTER:
       return onEnter(event);
     default:
       return false;
   }
 }
Exemplo n.º 3
0
 @Override
 public boolean onKeyboardEvent(KeyboardEvent event) {
   if (event == null) throw new NullPointerException("event may not be null");
   if (closing.onKeyboardEvent(event)) return true;
   if (event.isModified() || !event.isSpecial()) return false;
   switch (event.getSpecial()) {
     case ENTER:
       return closing.doOk();
     case ARROW_DOWN:
       return onArrowDown(event, false);
     case ARROW_UP:
       return onArrowUp(event, false);
     case ALTERNATIVE_ARROW_DOWN:
       return onArrowDown(event, true);
     case ALTERNATIVE_ARROW_UP:
       return onArrowUp(event, true);
     case ARROW_LEFT:
       return onArrowLeft(event);
     case ARROW_RIGHT:
       return onArrowRight(event);
     case ALTERNATIVE_ARROW_LEFT:
       return onAltLeft(event);
     case ALTERNATIVE_ARROW_RIGHT:
       return onAltRight(event);
     case PAGE_DOWN:
       return onPageDown(event, false);
     case PAGE_UP:
       return onPageUp(event, false);
     case ALTERNATIVE_PAGE_DOWN:
       return onPageDown(event, true);
     case ALTERNATIVE_PAGE_UP:
       return onPageUp(event, true);
     case HOME:
       return onHome(event);
     case END:
       return onEnd(event);
     case ALTERNATIVE_HOME:
       return onAltHome(event);
     case ALTERNATIVE_END:
       return onAltEnd(event);
     case INSERT:
       return onInsert(event);
     default:
       return false;
   }
 }