Search in sources :

Example 16 with Transform

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

Example 17 with Transform

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

the class RadarMenuBuilderTest method testOnDragVisibleBounds.

@Test
public void testOnDragVisibleBounds() {
    final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);
    builder.onDragVisibleBounds(10, 10);
    verify(modellerViewport, times(1)).setTransform(transformArgumentCaptor.capture());
    final Transform result = transformArgumentCaptor.getValue();
    assertNotNull(result);
    assertEquals(-10.0, result.getTranslateX(), 0.0);
    assertEquals(-10.0, result.getTranslateY(), 0.0);
    verify(modellerLayer, times(1)).batch();
}
Also used : Transform(com.ait.lienzo.client.core.types.Transform) Test(org.junit.Test)

Example 18 with Transform

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

the class RadarMenuBuilderTest method testOnDragVisibleBoundsScaled50pct.

@Test
public void testOnDragVisibleBoundsScaled50pct() {
    final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);
    transform.scale(0.5, 0.5);
    builder.onDragVisibleBounds(10, 10);
    verify(modellerViewport, times(1)).setTransform(transformArgumentCaptor.capture());
    final Transform result = transformArgumentCaptor.getValue();
    assertNotNull(result);
    assertEquals(-5.0, result.getTranslateX(), 0.0);
    assertEquals(-5.0, result.getTranslateY(), 0.0);
    verify(modellerLayer, times(1)).batch();
    verify(modellerView).refreshScrollPosition();
}
Also used : Transform(com.ait.lienzo.client.core.types.Transform) Test(org.junit.Test)

Example 19 with Transform

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

the class ColumnHeaderPopOverImpl method getScreenY.

private int getScreenY(final GuidedDecisionTableModellerView modellerView, final GuidedDecisionTableView.Presenter dtPresenter) {
    final GridWidget gridWidget = dtPresenter.getView();
    final double gy = gridWidget.getY();
    final GridLayer layer = modellerView.getGridLayerView();
    final int containerY = layer.getDomElementContainer().getAbsoluteTop();
    final double vy = layer.getVisibleBounds().getY();
    final Transform t = layer.getViewport().getTransform();
    final Group header = gridWidget.getHeader();
    final double headerHeight = gridWidget.getRenderer().getHeaderHeight();
    final double headerRowHeight = gridWidget.getRenderer().getHeaderRowHeight();
    final double offsetY = header == null ? 0 : header.getY();
    final int screenY = containerY + (int) ((gy - vy + offsetY + headerHeight - headerRowHeight / 2) * t.getScaleX());
    return screenY;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) GridLayer(org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer) Transform(com.ait.lienzo.client.core.types.Transform)

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