Search in sources :

Example 6 with Transform

use of com.ait.lienzo.client.core.types.Transform in project drools-wb by kiegroup.

the class BoundaryTransformMediatorTest method testLeftEdge.

@Test
public void testLeftEdge() {
    final Bounds visibleBounds = new BaseBounds(-500, -500, 1000, 1000);
    final Transform test = new Transform().translate(1200.0, 0.0);
    final Transform result = restriction.adjust(test, visibleBounds);
    assertNotNull(result);
    assertEquals(1000.0, result.getTranslateX(), 0.0);
    assertEquals(0.0, result.getTranslateY(), 0.0);
    // View.getBounds() is called once in BoundaryTransformMediator's constructor and once in it's adjust method.
    verify(view, times(2)).getBounds();
}
Also used : BaseBounds(org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds) Bounds(org.uberfire.ext.wires.core.grids.client.model.Bounds) BaseBounds(org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds) Transform(com.ait.lienzo.client.core.types.Transform) Test(org.junit.Test)

Example 7 with Transform

use of com.ait.lienzo.client.core.types.Transform in project drools-wb by kiegroup.

the class BoundaryTransformMediatorTest method testBottomEdge.

@Test
public void testBottomEdge() {
    final Bounds visibleBounds = new BaseBounds(-500, -500, 1000, 1000);
    final Transform test = new Transform().translate(0.0, -200.0);
    final Transform result = restriction.adjust(test, visibleBounds);
    assertNotNull(result);
    assertEquals(0.0, result.getTranslateX(), 0.0);
    assertEquals(0.0, result.getTranslateY(), 0.0);
    // View.getBounds() is called once in BoundaryTransformMediator's constructor and once in it's adjust method.
    verify(view, times(2)).getBounds();
}
Also used : BaseBounds(org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds) Bounds(org.uberfire.ext.wires.core.grids.client.model.Bounds) BaseBounds(org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds) Transform(com.ait.lienzo.client.core.types.Transform) Test(org.junit.Test)

Example 8 with Transform

use of com.ait.lienzo.client.core.types.Transform 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 9 with Transform

use of com.ait.lienzo.client.core.types.Transform 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 10 with Transform

use of com.ait.lienzo.client.core.types.Transform in project drools-wb by kiegroup.

the class RadarMenuBuilderTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.transform = new Transform();
    this.builder = new RadarMenuBuilder(view);
    this.builder.setup();
    this.builder.setModeller(modeller);
    when(modeller.getView()).thenReturn(modellerView);
    when(modeller.getView().getGridLayerView()).thenReturn(modellerLayer);
    when(modellerLayer.getViewport()).thenReturn(modellerViewport);
    when(modellerViewport.getTransform()).thenReturn(transform);
    when(modellerViewport.getAttributes()).thenReturn(attributes);
    when(modeller.getView().getBounds()).thenReturn(bounds);
    when(modeller.getView().getGridLayerView().getVisibleBounds()).thenReturn(visibleBounds);
    when(modeller.getAvailableDecisionTables()).thenReturn(dtables);
}
Also used : Transform(com.ait.lienzo.client.core.types.Transform) Before(org.junit.Before)

Aggregations

Transform (com.ait.lienzo.client.core.types.Transform)19 Test (org.junit.Test)9 Bounds (org.uberfire.ext.wires.core.grids.client.model.Bounds)4 BaseBounds (org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds)4 Viewport (com.ait.lienzo.client.core.shape.Viewport)3 Mediators (com.ait.lienzo.client.core.mediator.Mediators)2 Point2D (com.ait.lienzo.client.core.types.Point2D)2 Element (com.google.gwt.user.client.Element)2 AbsolutePanel (com.google.gwt.user.client.ui.AbsolutePanel)2 GridWidget (org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget)2 GridLayer (org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer)2 TransformMediator (org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.TransformMediator)2 Group (com.ait.lienzo.client.core.shape.Group)1 ScrollEvent (com.google.gwt.event.dom.client.ScrollEvent)1 ScrollHandler (com.google.gwt.event.dom.client.ScrollHandler)1 Before (org.junit.Before)1 BaseGridRendererHelper (org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper)1