@Test @SuppressWarnings("unchecked") public void testKeyBindings() { ArgumentCaptor<KeyboardControl.KeyShortcutCallback> callbackArgumentCaptor = ArgumentCaptor.forClass(KeyboardControl.KeyShortcutCallback.class); verify(keyEventHandler, times(4)).addKeyShortcutCallback(callbackArgumentCaptor.capture()); KeyboardControl.KeyShortcutCallback callback = callbackArgumentCaptor.getValue(); callback.onKeyUp(KeyboardEvent.Key.ALT); verify(mediators, times(1)).disablePreview(); when(mediators.enablePreview()).thenReturn(false); callback.onKeyShortcut(KeyboardEvent.Key.CONTROL); verify(cursor, times(1)).accept(eq(LienzoCanvasMediators.CURSOR_ZOOM)); when(mediators.enablePreview()).thenReturn(false); callback.onKeyShortcut(KeyboardEvent.Key.ALT); verify(cursor, times(1)).accept(eq(LienzoCanvasMediators.CURSOR_PAN)); when(mediators.enablePreview()).thenReturn(true); callback.onKeyShortcut(KeyboardEvent.Key.CONTROL, KeyboardEvent.Key.ALT); callback.onKeyShortcut(KeyboardEvent.Key.ALT, KeyboardEvent.Key.CONTROL); verify(cursor, times(2)).accept(eq(LienzoCanvasMediators.CURSOR_PREVIEW)); verify(notification, times(2)).show(eq(CoreTranslationMessages.MEDIATOR_PREVIEW)); }
private void enablePreview() { if (null != mediators && mediators.enablePreview()) { cursor.accept(CURSOR_PREVIEW); notification.show(translationService.getNotNullValue(CoreTranslationMessages.MEDIATOR_PREVIEW)); } }
LienzoCanvasMediators { private void enablePreview() { if (null != mediators && mediators.enablePreview()) { cursor.accept(CURSOR_PREVIEW); notification.show(translationService.getNotNullValue(CoreTranslationMessages.MEDIATOR_PREVIEW)); } } }
LienzoCanvasMediators { private void enablePreview() { if (null != mediators && mediators.enablePreview()) { cursor.accept(CURSOR_PREVIEW); notification.show(translationService.getNotNullValue(CoreTranslationMessages.MEDIATOR_PREVIEW)); } } @Inject  LienzoCanvasMediators(final KeyEventHandler keyEventHandler,
                                 final ClientTranslationService translationService,
                                 final LienzoCanvasNotification notification,
                                 final EditorContextProvider editorContextProvider);   LienzoCanvasMediators(final KeyEventHandler keyEventHandler,
                          final ClientTranslationService translationService,
                          final LienzoCanvasNotification notification,
                          final Function<LienzoBoundsPanel, PanelMediators> mediatorsBuilder); }
LienzoCanvasMediators { private void enablePreview() { if (null != mediators && mediators.enablePreview()) { cursor.accept(CURSOR_PREVIEW); notification.show(translationService.getNotNullValue(CoreTranslationMessages.MEDIATOR_PREVIEW)); } } @Inject  LienzoCanvasMediators(final KeyEventHandler keyEventHandler,
                                 final ClientTranslationService translationService,
                                 final LienzoCanvasNotification notification,
                                 final EditorContextProvider editorContextProvider);   LienzoCanvasMediators(final KeyEventHandler keyEventHandler,
                          final ClientTranslationService translationService,
                          final LienzoCanvasNotification notification,
                          final Function<LienzoBoundsPanel, PanelMediators> mediatorsBuilder); void init(final Supplier<LienzoCanvas> canvas); void setMinScale(final double minScale); void setMaxScale(final double maxScale); void setZoomFactor(final double factor); void setScaleAboutPoint(final boolean scaleAboutPoint); void enable(); void disable(); @PreDestroy void destroy(); }
LienzoCanvasMediators { private void enablePreview() { if (null != mediators && mediators.enablePreview()) { cursor.accept(CURSOR_PREVIEW); notification.show(translationService.getNotNullValue(CoreTranslationMessages.MEDIATOR_PREVIEW)); } } @Inject  LienzoCanvasMediators(final KeyEventHandler keyEventHandler,
                                 final ClientTranslationService translationService,
                                 final LienzoCanvasNotification notification,
                                 final EditorContextProvider editorContextProvider);   LienzoCanvasMediators(final KeyEventHandler keyEventHandler,
                          final ClientTranslationService translationService,
                          final LienzoCanvasNotification notification,
                          final Function<LienzoBoundsPanel, PanelMediators> mediatorsBuilder); void init(final Supplier<LienzoCanvas> canvas); void setMinScale(final double minScale); void setMaxScale(final double maxScale); void setZoomFactor(final double factor); void setScaleAboutPoint(final boolean scaleAboutPoint); void enable(); void disable(); @PreDestroy void destroy();  }