Search in sources :

Example 1 with Viewport

use of com.ait.lienzo.client.core.shape.Viewport in project drools-wb by kiegroup.

the class GuidedDecisionTableModellerViewImplTest method testSetup.

@Test
public void testSetup() throws Exception {
    final AbsolutePanel mainPanel = mock(AbsolutePanel.class);
    final Transform transform = mock(Transform.class);
    final Viewport viewport = mock(Viewport.class);
    final Mediators mediators = mock(Mediators.class);
    final Element element = mock(Element.class);
    doReturn(transform).when(transform).scale(anyDouble());
    doReturn(transform).when(view).newTransform();
    doReturn(mediators).when(viewport).getMediators();
    doReturn(element).when(mockGridPanel).getElement();
    doReturn(mainPanel).when(mockGridPanel).getScrollPanel();
    doReturn(viewport).when(mockGridPanel).getViewport();
    view.setup();
    verify(view).setupGridPanel();
    verify(mediators).push(restrictedMousePanMediator);
}
Also used : Mediators(com.ait.lienzo.client.core.mediator.Mediators) Element(com.google.gwt.user.client.Element) Viewport(com.ait.lienzo.client.core.shape.Viewport) AbsolutePanel(com.google.gwt.user.client.ui.AbsolutePanel) Transform(com.ait.lienzo.client.core.types.Transform) Test(org.junit.Test)

Example 2 with Viewport

use of com.ait.lienzo.client.core.shape.Viewport in project drools-wb by kiegroup.

the class GuidedDecisionTableModellerViewImplTest method testScrollbarsUpdatedAfterZoom.

@Test
public void testScrollbarsUpdatedAfterZoom() throws Exception {
    final double x = 10.0;
    final double y = 20.0;
    final int zoom = 70;
    final Transform transform = mock(Transform.class);
    final Viewport viewport = mock(Viewport.class);
    final TransformMediator mediator = mock(TransformMediator.class);
    doReturn(transform).when(mediator).adjust(eq(transform), any());
    doReturn(mediator).when(restrictedMousePanMediator).getTransformMediator();
    doReturn(x).when(transform).getTranslateX();
    doReturn(y).when(transform).getTranslateY();
    doReturn(transform).when(view).newTransform();
    doReturn(transform).when(viewport).getTransform();
    doReturn(viewport).when(mockGridPanel).getViewport();
    view.setZoom(zoom);
    verify(transform).translate(x, y);
    verify(transform).scale(zoom / 100.0);
    verify(viewport, times(2)).setTransform(transform);
    verify(viewport).batch();
    verify(mockGridPanel).refreshScrollPosition();
}
Also used : Viewport(com.ait.lienzo.client.core.shape.Viewport) Transform(com.ait.lienzo.client.core.types.Transform) TransformMediator(org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.TransformMediator) Test(org.junit.Test)

Example 3 with Viewport

use of com.ait.lienzo.client.core.shape.Viewport in project drools-wb by kiegroup.

the class GuidedDecisionTableModellerViewImplTest method testRadarIsUpdatedAfterScrolling.

@Test
public void testRadarIsUpdatedAfterScrolling() throws Exception {
    final ArgumentCaptor<ScrollHandler> scrollHandler = ArgumentCaptor.forClass(ScrollHandler.class);
    final ScrollEvent scrollEvent = mock(ScrollEvent.class);
    final AbsolutePanel mainPanel = mock(AbsolutePanel.class);
    final Transform transform = mock(Transform.class);
    final Viewport viewport = mock(Viewport.class);
    final Mediators mediators = mock(Mediators.class);
    final Element element = mock(Element.class);
    doReturn(transform).when(transform).scale(anyDouble());
    doReturn(presenter).when(view).getPresenter();
    doReturn(transform).when(view).newTransform();
    doReturn(mediators).when(viewport).getMediators();
    doReturn(element).when(mockGridPanel).getElement();
    doReturn(mainPanel).when(mockGridPanel).getScrollPanel();
    doReturn(viewport).when(mockGridPanel).getViewport();
    view.setupGridPanel();
    verify(mainPanel).addDomHandler(scrollHandler.capture(), eq(ScrollEvent.getType()));
    scrollHandler.getValue().onScroll(scrollEvent);
    verify(presenter).updateRadar();
}
Also used : ScrollHandler(com.google.gwt.event.dom.client.ScrollHandler) ScrollEvent(com.google.gwt.event.dom.client.ScrollEvent) Mediators(com.ait.lienzo.client.core.mediator.Mediators) Element(com.google.gwt.user.client.Element) Viewport(com.ait.lienzo.client.core.shape.Viewport) AbsolutePanel(com.google.gwt.user.client.ui.AbsolutePanel) Transform(com.ait.lienzo.client.core.types.Transform) Test(org.junit.Test)

Aggregations

Viewport (com.ait.lienzo.client.core.shape.Viewport)3 Transform (com.ait.lienzo.client.core.types.Transform)3 Test (org.junit.Test)3 Mediators (com.ait.lienzo.client.core.mediator.Mediators)2 Element (com.google.gwt.user.client.Element)2 AbsolutePanel (com.google.gwt.user.client.ui.AbsolutePanel)2 ScrollEvent (com.google.gwt.event.dom.client.ScrollEvent)1 ScrollHandler (com.google.gwt.event.dom.client.ScrollHandler)1 TransformMediator (org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.TransformMediator)1