Search in sources :

Example 11 with Transform

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

the class RadarMenuViewImpl method getTransform.

private Transform getTransform(final Bounds bounds) {
    final Transform t = new Transform();
    t.scale((double) RADAR_WIDTH / bounds.getWidth(), (double) RADAR_HEIGHT / bounds.getHeight()).translate(-bounds.getX(), -bounds.getY());
    return t;
}
Also used : Transform(com.ait.lienzo.client.core.types.Transform)

Example 12 with Transform

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

the class GuidedDecisionTableModellerViewImpl method setupGridPanel.

void setupGridPanel() {
    // Lienzo stuff - Set default scale
    final Transform transform = newTransform().scale(VP_SCALE);
    gridPanel.getViewport().setTransform(transform);
    // Lienzo stuff - Add mouse pan support
    defaultTransformMediator = new BoundaryTransformMediator(GuidedDecisionTableModellerViewImpl.this);
    mousePanMediator.setTransformMediator(defaultTransformMediator);
    gridPanel.getViewport().getMediators().push(mousePanMediator);
    mousePanMediator.setBatchDraw(true);
    gridPanel.setBounds(getBounds());
    gridPanel.getScrollPanel().addDomHandler(scrollEvent -> getPresenter().updateRadar(), ScrollEvent.getType());
    // Wire-up widgets
    gridPanel.add(gridLayer);
    // Set ID on GridLienzoPanel for Selenium tests.
    gridPanel.getElement().setId("dtable_container_" + Document.get().createUniqueId());
}
Also used : Transform(com.ait.lienzo.client.core.types.Transform)

Example 13 with Transform

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

the class GuidedDecisionTableModellerViewImpl method addDecisionTable.

@Override
public void addDecisionTable(final GuidedDecisionTableView gridWidget) {
    // Ensure the first Decision Table is visible
    if (gridLayer.getGridWidgets().isEmpty()) {
        final Point2D translation = getTranslation(gridWidget);
        final Transform t = gridLayer.getViewport().getTransform();
        t.translate(translation.getX(), translation.getY());
    }
    gridLayer.add(gridWidget);
    gridLayer.batch();
}
Also used : Point2D(com.ait.lienzo.client.core.types.Point2D) Transform(com.ait.lienzo.client.core.types.Transform)

Example 14 with Transform

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

the class BoundaryTransformMediatorTest method testTopEdge.

@Test
public void testTopEdge() {
    final Bounds visibleBounds = new BaseBounds(-500, -500, 1000, 1000);
    final Transform test = new Transform().translate(0.0, 1200.0);
    final Transform result = restriction.adjust(test, visibleBounds);
    assertNotNull(result);
    assertEquals(0.0, result.getTranslateX(), 0.0);
    assertEquals(1000.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 15 with Transform

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

the class BoundaryTransformMediatorTest method testRightEdge.

@Test
public void testRightEdge() {
    final Bounds visibleBounds = new BaseBounds(-500, -500, 1000, 1000);
    final Transform test = new Transform().translate(-200.0, 0.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)

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