protected KeyDownEvent mockKeyDownEvent(final Optional<Integer> keyCode, final Optional<Boolean> isShiftKeyDown, final Optional<Boolean> isControlKeyDown) { final KeyDownEvent e = mock(KeyDownEvent.class); keyCode.ifPresent((c) -> when(e.getNativeKeyCode()).thenReturn(c)); isShiftKeyDown.ifPresent((c) -> when(e.isShiftKeyDown()).thenReturn(c)); isControlKeyDown.ifPresent((c) -> when(e.isControlKeyDown()).thenReturn(c)); return e; } }
@Override public void onKeyDown(final KeyDownEvent e) { final int keyCode = e.getNativeKeyCode(); final boolean isShiftKeyDown = e.isShiftKeyDown(); switch (keyCode) { case KeyCodes.KEY_TAB: case KeyCodes.KEY_ESCAPE: gridCell.destroyResources(); case KeyCodes.KEY_ENTER: moveSelection(keyCode, isShiftKeyDown); gridPanel.setFocus(true); gridLayer.batch(); } e.stopPropagation(); } }
@Override public void onKeyDown(final KeyDownEvent e) { final int keyCode = e.getNativeKeyCode(); final boolean isShiftKeyDown = e.isShiftKeyDown(); switch (keyCode) { case KeyCodes.KEY_TAB: case KeyCodes.KEY_ESCAPE: gridCell.destroyResources(); case KeyCodes.KEY_ENTER: moveSelection(keyCode, isShiftKeyDown); gridPanel.setFocus(true); gridLayer.batch(); } e.stopPropagation(); } }
private KeyboardOperation getOperation(final KeyDownEvent event) { final int keyCode = event.getNativeKeyCode(); final boolean isShiftKeyDown = event.isShiftKeyDown(); final boolean isControlKeyDown = event.isControlKeyDown(); for (KeyboardOperation operation : operations) { if (operation.getKeyCode() == keyCode) { if (keyDownStateMatches(isShiftKeyDown, operation.isShiftKeyDown()) && keyDownStateMatches(isControlKeyDown, operation.isControlKeyDown())) { return operation; } } } return null; }
private KeyboardOperation getOperation(final KeyDownEvent event) { final int keyCode = event.getNativeKeyCode(); final boolean isShiftKeyDown = event.isShiftKeyDown(); final boolean isControlKeyDown = event.isControlKeyDown(); for (KeyboardOperation operation : operations) { if (operation.getKeyCode() == keyCode) { if (keyDownStateMatches(isShiftKeyDown, operation.isShiftKeyDown()) && keyDownStateMatches(isControlKeyDown, operation.isControlKeyDown())) { return operation; } } } return null; }
any(Boolean.class))).thenReturn(true); when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_LEFT); when(event.isShiftKeyDown()).thenReturn(true);
any(Boolean.class))).thenReturn(true); when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_DOWN); when(event.isShiftKeyDown()).thenReturn(true);
any(Boolean.class))).thenReturn(true); when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_RIGHT); when(event.isShiftKeyDown()).thenReturn(true);
@Override public void onKeyDown(KeyDownEvent event) { int keyCode = event.getNativeEvent().getKeyCode(); if (keyCode == 0) { keyCode = event.getNativeEvent().getCharCode(); } if (handleNavigation(keyCode, event.isControlKeyDown() || event.isMetaKeyDown(), event.isShiftKeyDown())) { event.preventDefault(); event.stopPropagation(); } }
any(Boolean.class))).thenReturn(true); when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_LEFT); when(event.isShiftKeyDown()).thenReturn(true);
any(Boolean.class))).thenReturn(true); when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_UP); when(event.isShiftKeyDown()).thenReturn(true);
any(Boolean.class))).thenReturn(true); when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_RIGHT); when(event.isShiftKeyDown()).thenReturn(true);
any(Boolean.class))).thenReturn(true); when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_UP); when(event.isShiftKeyDown()).thenReturn(true);
any(Boolean.class))).thenReturn(true); when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_DOWN); when(event.isShiftKeyDown()).thenReturn(true);
@Override public void onKeyDown(final KeyDownEvent e) { final int keyCode = e.getNativeKeyCode(); final boolean isShiftKeyDown = e.isShiftKeyDown(); switch (keyCode) { case KeyCodes.KEY_TAB: case KeyCodes.KEY_ENTER: gridCell.flush(); moveSelection(keyCode, isShiftKeyDown); e.preventDefault(); case KeyCodes.KEY_ESCAPE: gridCell.destroyResources(); gridPanel.setFocus(true); gridLayer.batch(); } e.stopPropagation(); }
@Override public void onKeyDown(final KeyDownEvent e) { final int keyCode = e.getNativeKeyCode(); final boolean isShiftKeyDown = e.isShiftKeyDown(); switch (keyCode) { case KeyCodes.KEY_TAB: case KeyCodes.KEY_ENTER: gridCell.flush(); moveSelection(keyCode, isShiftKeyDown); e.preventDefault(); case KeyCodes.KEY_ESCAPE: gridCell.destroyResources(); gridPanel.setFocus(true); gridLayer.batch(); } e.stopPropagation(); }
@Override public void onKeyDown(final KeyDownEvent event) { final GridWidget selectedGridWidget = getSelectedGridWidget(); if (selectedGridWidget == null) { return; } final KeyboardOperation operation = getOperation(event); if (operation == null) { return; } if (!operation.isExecutable(selectedGridWidget)) { return; } final boolean redraw = operation.perform(selectedGridWidget, event.isShiftKeyDown(), event.isControlKeyDown()); event.preventDefault(); event.stopPropagation(); flushDOMElements(selectedGridWidget); if (redraw) { gridLayer.draw(); } }
@Override public void onKeyDown(final KeyDownEvent event) { final GridWidget selectedGridWidget = getSelectedGridWidget(); if (selectedGridWidget == null) { return; } final KeyboardOperation operation = getOperation(event); if (operation == null) { return; } if (!operation.isExecutable(selectedGridWidget)) { return; } final boolean redraw = operation.perform(selectedGridWidget, event.isShiftKeyDown(), event.isControlKeyDown()); event.preventDefault(); event.stopPropagation(); flushDOMElements(selectedGridWidget); if (redraw) { gridLayer.draw(); } }
if (event.isShiftKeyDown()) { preventDefault = this.maskHelper.focusPrevious(); } else {
if (event.isShiftKeyDown()) { preventDefault = this.maskHelper.focusPrevious(); } else {