Search in sources :

Example 1 with Bounds

use of org.uberfire.ext.wires.core.grids.client.model.Bounds in project kie-wb-common by kiegroup.

the class BoundaryTransformMediator method updateBounds.

private void updateBounds() {
    final Bounds bounds = getBounds();
    this.minX = bounds.getX();
    this.minY = bounds.getY();
    this.maxX = this.minX + bounds.getWidth();
    this.maxY = this.minY + bounds.getHeight();
}
Also used : BaseBounds(org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds) Bounds(org.uberfire.ext.wires.core.grids.client.model.Bounds)

Example 2 with Bounds

use of org.uberfire.ext.wires.core.grids.client.model.Bounds in project drools-wb by kiegroup.

the class BoundaryTransformMediator method updateBounds.

private void updateBounds() {
    final Bounds bounds = view.getBounds();
    this.minX = bounds.getX();
    this.minY = bounds.getY();
    this.maxX = this.minX + bounds.getWidth();
    this.maxY = this.minY + bounds.getHeight();
}
Also used : Bounds(org.uberfire.ext.wires.core.grids.client.model.Bounds)

Example 3 with Bounds

use of org.uberfire.ext.wires.core.grids.client.model.Bounds 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 4 with Bounds

use of org.uberfire.ext.wires.core.grids.client.model.Bounds 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 5 with Bounds

use of org.uberfire.ext.wires.core.grids.client.model.Bounds in project drools-wb by kiegroup.

the class GuidedDecisionTableModellerBoundsHelperTest method multipleDecisionTablesCheckBottomBounds.

@Test
public void multipleDecisionTablesCheckBottomBounds() {
    final Bounds b = helper.getBounds(new HashSet<GuidedDecisionTableView.Presenter>() {

        {
            add(makeTable(0, 0, 400, 400));
            add(makeTable(0, 1800, 400, 400));
        }
    });
    final double expectedMaxY = 1800 + 400 + BOUNDS_PADDING;
    assertEquals(BOUNDS_MIN_X, b.getX(), 0.0);
    assertEquals(BOUNDS_MIN_Y, b.getY(), 0.0);
    assertEquals(BOUNDS_MAX_X - BOUNDS_MIN_X, b.getWidth(), 0.0);
    assertEquals(expectedMaxY - BOUNDS_MIN_Y, b.getHeight(), 0.0);
}
Also used : Bounds(org.uberfire.ext.wires.core.grids.client.model.Bounds) Test(org.junit.Test)

Aggregations

Bounds (org.uberfire.ext.wires.core.grids.client.model.Bounds)16 Test (org.junit.Test)10 BaseBounds (org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds)6 Transform (com.ait.lienzo.client.core.types.Transform)4 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1