@Test @SuppressWarnings("unchecked") public void testSetPresenter() { when(tested.isRemoteCommunicationEnabled()).thenReturn(true); tested.setPresenter(presenter); verify(presenter, times(3)).register(any(HandlerRegistration.class)); ArgumentCaptor<KeyDownHandler> downCaptor = ArgumentCaptor.forClass(KeyDownHandler.class); verify(tested, times(1)).addKeyDownHandler(downCaptor.capture()); KeyDownHandler downHandler = downCaptor.getValue(); KeyDownEvent keyDownEvent = mock(KeyDownEvent.class); when(keyDownEvent.getNativeKeyCode()).thenReturn(11); downHandler.onKeyDown(keyDownEvent); verify(presenter, times(1)).onKeyDown(eq(11)); ArgumentCaptor<KeyPressHandler> pressCaptor = ArgumentCaptor.forClass(KeyPressHandler.class); verify(tested, times(1)).addKeyPressHandler(pressCaptor.capture()); KeyPressHandler pressHandler = pressCaptor.getValue(); KeyPressEvent kePressEvent = mock(KeyPressEvent.class); when(kePressEvent.getUnicodeCharCode()).thenReturn(33); pressHandler.onKeyPress(kePressEvent); verify(presenter, times(1)).onKeyPress(eq(33)); ArgumentCaptor<KeyUpHandler> upCaptor = ArgumentCaptor.forClass(KeyUpHandler.class); verify(tested, times(1)).addKeyUpHandler(upCaptor.capture()); KeyUpHandler upHandler = upCaptor.getValue(); KeyUpEvent keyUpEvent = mock(KeyUpEvent.class); when(keyUpEvent.getNativeKeyCode()).thenReturn(55); upHandler.onKeyUp(keyUpEvent); verify(presenter, times(1)).onKeyUp(eq(55)); }
@Override public void setPresenter(final StunnerLienzoBoundsPanel presenter) { if (!isRemoteCommunicationEnabled()) { DomGlobal.console.debug("Kogito environment detected. Skipping default event handling."); return; } presenter.register( addKeyDownHandler(event -> presenter.onKeyDown(event.getNativeKeyCode())) ); presenter.register( addKeyPressHandler(event -> presenter.onKeyPress(event.getUnicodeCharCode())) ); presenter.register( addKeyUpHandler(event -> presenter.onKeyUp(event.getNativeKeyCode())) ); }
ScrollableLienzoPanelView extends ScrollablePanel implements StunnerLienzoBoundsPanelView { @Override public void setPresenter(final StunnerLienzoBoundsPanel presenter) { if (!isRemoteCommunicationEnabled()) { DomGlobal.console.debug("Kogito environment detected. Skipping default event handling."); return; } presenter.register( addKeyDownHandler(event -> presenter.onKeyDown(event.getNativeKeyCode())) ); presenter.register( addKeyPressHandler(event -> presenter.onKeyPress(event.getUnicodeCharCode())) ); presenter.register( addKeyUpHandler(event -> presenter.onKeyUp(event.getNativeKeyCode())) ); } }
ScrollableLienzoPanelView extends ScrollablePanel implements StunnerLienzoBoundsPanelView { @Override public void setPresenter(final StunnerLienzoBoundsPanel presenter) { if (!isRemoteCommunicationEnabled()) { DomGlobal.console.debug("Kogito environment detected. Skipping default event handling."); return; } presenter.register( addKeyDownHandler(event -> presenter.onKeyDown(event.getNativeKeyCode())) ); presenter.register( addKeyPressHandler(event -> presenter.onKeyPress(event.getUnicodeCharCode())) ); presenter.register( addKeyUpHandler(event -> presenter.onKeyUp(event.getNativeKeyCode())) ); } ScrollableLienzoPanelView();  ScrollableLienzoPanelView(final int width,
                                     final int height); }
ScrollableLienzoPanelView extends ScrollablePanel implements StunnerLienzoBoundsPanelView { @Override public void setPresenter(final StunnerLienzoBoundsPanel presenter) { if (!isRemoteCommunicationEnabled()) { DomGlobal.console.debug("Kogito environment detected. Skipping default event handling."); return; } presenter.register( addKeyDownHandler(event -> presenter.onKeyDown(event.getNativeKeyCode())) ); presenter.register( addKeyPressHandler(event -> presenter.onKeyPress(event.getUnicodeCharCode())) ); presenter.register( addKeyUpHandler(event -> presenter.onKeyUp(event.getNativeKeyCode())) ); } ScrollableLienzoPanelView();  ScrollableLienzoPanelView(final int width,
                                     final int height); @Override void setPresenter(final StunnerLienzoBoundsPanel presenter); }
ScrollableLienzoPanelView extends ScrollablePanel implements StunnerLienzoBoundsPanelView { @Override public void setPresenter(final StunnerLienzoBoundsPanel presenter) { if (!isRemoteCommunicationEnabled()) { DomGlobal.console.debug("Kogito environment detected. Skipping default event handling."); return; } presenter.register( addKeyDownHandler(event -> presenter.onKeyDown(event.getNativeKeyCode())) ); presenter.register( addKeyPressHandler(event -> presenter.onKeyPress(event.getUnicodeCharCode())) ); presenter.register( addKeyUpHandler(event -> presenter.onKeyUp(event.getNativeKeyCode())) ); } ScrollableLienzoPanelView();  ScrollableLienzoPanelView(final int width,
                                     final int height); @Override void setPresenter(final StunnerLienzoBoundsPanel presenter);  }