@Test @SuppressWarnings("unchecked") public void testInit() { assertEquals(mediators, tested.getMediators()); ArgumentCaptor<Supplier> panelCaptor = ArgumentCaptor.forClass(Supplier.class); verify(notification, times(1)).init(panelCaptor.capture()); assertEquals(panel, panelCaptor.getValue().get()); verify(zoomMediator, times(1)).setScaleAboutPoint(eq(false)); }
public void init(final Supplier<LienzoCanvas> canvas) { keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.ALT}, "Navigate | Hold and drag to Pan", this::enablePan, this::clear)); keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.CONTROL}, "Navigate | Hold and scroll to Zoom", this::enableZoom, this::clear)); keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.CONTROL, Key.ALT}, "Navigate | Hold to Preview", this::enablePreview, this::clear)); keyEventHandler .setTimerDelay(150) .addKeyShortcutCallback(new KeyboardControl.KeyShortcutCallback() { @Override public void onKeyShortcut(Key... keys) { if (doKeysMatch(keys, Key.CONTROL)) { enableZoom(); } else if (doKeysMatch(keys, Key.ALT)) { enablePan(); } else if (doKeysMatch(keys, Key.CONTROL, Key.ALT) || doKeysMatch(keys, Key.ALT, Key.CONTROL)) { enablePreview(); } } @Override public void onKeyUp(Key key) { clear(); } }); cursor = c -> canvas.get().getView().setCursor(c); final LienzoPanel panel = (LienzoPanel) canvas.get().getView().getPanel(); this.mediators = mediatorsBuilder.apply(panel.getView()); this.notification.init(() -> panel); setScaleAboutPoint(false); }
LienzoCanvasMediators { public void init(final Supplier<LienzoCanvas> canvas) { keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.ALT}, "Navigate | Hold and drag to Pan", this::enablePan, this::clear)); keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.CONTROL}, "Navigate | Hold and scroll to Zoom", this::enableZoom, this::clear)); keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.CONTROL, Key.ALT}, "Navigate | Hold to Preview", this::enablePreview, this::clear)); keyEventHandler .setTimerDelay(150) .addKeyShortcutCallback(new KeyboardControl.KeyShortcutCallback() { @Override public void onKeyShortcut(Key... keys) { if (doKeysMatch(keys, Key.CONTROL)) { enableZoom(); } else if (doKeysMatch(keys, Key.ALT)) { enablePan(); } else if (doKeysMatch(keys, Key.CONTROL, Key.ALT) || doKeysMatch(keys, Key.ALT, Key.CONTROL)) { enablePreview(); } } @Override public void onKeyUp(Key key) { clear(); } }); cursor = c -> canvas.get().getView().setCursor(c); final LienzoPanel panel = (LienzoPanel) canvas.get().getView().getPanel(); this.mediators = mediatorsBuilder.apply(panel.getView()); this.notification.init(() -> panel); setScaleAboutPoint(false); } }
LienzoCanvasMediators { public void init(final Supplier<LienzoCanvas> canvas) { keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.ALT}, "Navigate | Hold and drag to Pan", this::enablePan, this::clear)); keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.CONTROL}, "Navigate | Hold and scroll to Zoom", this::enableZoom, this::clear)); keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.CONTROL, Key.ALT}, "Navigate | Hold to Preview", this::enablePreview, this::clear)); keyEventHandler .setTimerDelay(150) .addKeyShortcutCallback(new KeyboardControl.KeyShortcutCallback() { @Override public void onKeyShortcut(Key... keys) { if (doKeysMatch(keys, Key.CONTROL)) { enableZoom(); } else if (doKeysMatch(keys, Key.ALT)) { enablePan(); } else if (doKeysMatch(keys, Key.CONTROL, Key.ALT) || doKeysMatch(keys, Key.ALT, Key.CONTROL)) { enablePreview(); } } @Override public void onKeyUp(Key key) { clear(); } }); cursor = c -> canvas.get().getView().setCursor(c); final LienzoPanel panel = (LienzoPanel) canvas.get().getView().getPanel(); this.mediators = mediatorsBuilder.apply(panel.getView()); this.notification.init(() -> panel); setScaleAboutPoint(false); } @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 { public void init(final Supplier<LienzoCanvas> canvas) { keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.ALT}, "Navigate | Hold and drag to Pan", this::enablePan, this::clear)); keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.CONTROL}, "Navigate | Hold and scroll to Zoom", this::enableZoom, this::clear)); keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.CONTROL, Key.ALT}, "Navigate | Hold to Preview", this::enablePreview, this::clear)); keyEventHandler .setTimerDelay(150) .addKeyShortcutCallback(new KeyboardControl.KeyShortcutCallback() { @Override public void onKeyShortcut(Key... keys) { if (doKeysMatch(keys, Key.CONTROL)) { enableZoom(); } else if (doKeysMatch(keys, Key.ALT)) { enablePan(); } else if (doKeysMatch(keys, Key.CONTROL, Key.ALT) || doKeysMatch(keys, Key.ALT, Key.CONTROL)) { enablePreview(); } } @Override public void onKeyUp(Key key) { clear(); } }); cursor = c -> canvas.get().getView().setCursor(c); final LienzoPanel panel = (LienzoPanel) canvas.get().getView().getPanel(); this.mediators = mediatorsBuilder.apply(panel.getView()); this.notification.init(() -> panel); setScaleAboutPoint(false); } @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 { public void init(final Supplier<LienzoCanvas> canvas) { keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.ALT}, "Navigate | Hold and drag to Pan", this::enablePan, this::clear)); keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.CONTROL}, "Navigate | Hold and scroll to Zoom", this::enableZoom, this::clear)); keyEventHandler.addKeyShortcutCallback(new KogitoKeyShortcutKeyDownThenUp(new Key[]{Key.CONTROL, Key.ALT}, "Navigate | Hold to Preview", this::enablePreview, this::clear)); keyEventHandler .setTimerDelay(150) .addKeyShortcutCallback(new KeyboardControl.KeyShortcutCallback() { @Override public void onKeyShortcut(Key... keys) { if (doKeysMatch(keys, Key.CONTROL)) { enableZoom(); } else if (doKeysMatch(keys, Key.ALT)) { enablePan(); } else if (doKeysMatch(keys, Key.CONTROL, Key.ALT) || doKeysMatch(keys, Key.ALT, Key.CONTROL)) { enablePreview(); } } @Override public void onKeyUp(Key key) { clear(); } }); cursor = c -> canvas.get().getView().setCursor(c); final LienzoPanel panel = (LienzoPanel) canvas.get().getView().getPanel(); this.mediators = mediatorsBuilder.apply(panel.getView()); this.notification.init(() -> panel); setScaleAboutPoint(false); } @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();  }