Search in sources :

Example 41 with BoundingBox

use of com.ait.lienzo.client.core.types.BoundingBox in project kie-wb-common by kiegroup.

the class BaseExpressionGridRenderingTest method testRenderQueueCommandsWhenHeaderIsHidden.

@Test
public void testRenderQueueCommandsWhenHeaderIsHidden() {
    this.isHeaderHidden = true;
    grid.drawWithTransforms(context, 1.0, new BoundingBox());
    verify(renderHeaderBackgroundCommand, never()).execute(any(GridRendererContext.class));
    verify(renderHeaderGridLinesCommand, never()).execute(any(GridRendererContext.class));
    verify(renderHeaderContentCommand, never()).execute(any(GridRendererContext.class));
    verify(renderHeaderBodyDividerCommand, never()).execute(any(GridRendererContext.class));
    final InOrder order = inOrder(renderBodyGridBackgroundCommand, renderBodyGridContentCommand, renderBodyGridLinesCommand, renderGridBoundaryCommand, renderSelectedCellsCommand);
    order.verify(renderBodyGridBackgroundCommand).execute(any(GridRendererContext.class));
    order.verify(renderBodyGridContentCommand).execute(any(GridRendererContext.class));
    order.verify(renderGridBoundaryCommand).execute(any(GridRendererContext.class));
    order.verify(renderBodyGridLinesCommand).execute(any(GridRendererContext.class));
    order.verify(renderSelectedCellsCommand).execute(any(GridRendererContext.class));
}
Also used : InOrder(org.mockito.InOrder) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) GridRendererContext(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.GridRendererContext) Test(org.junit.Test)

Example 42 with BoundingBox

use of com.ait.lienzo.client.core.types.BoundingBox in project kie-wb-common by kiegroup.

the class BaseExpressionGridRenderingTest method testRenderQueueCommandsWhenHeaderIsNotHidden.

@Test
public void testRenderQueueCommandsWhenHeaderIsNotHidden() {
    this.isHeaderHidden = false;
    grid.drawWithTransforms(context, 1.0, new BoundingBox());
    final InOrder order = inOrder(renderHeaderBackgroundCommand, renderHeaderContentCommand, renderBodyGridBackgroundCommand, renderBodyGridContentCommand, renderGridBoundaryCommand, renderHeaderGridLinesCommand, renderBodyGridLinesCommand, renderSelectedCellsCommand);
    order.verify(renderHeaderBackgroundCommand).execute(any(GridRendererContext.class));
    order.verify(renderHeaderContentCommand).execute(any(GridRendererContext.class));
    order.verify(renderBodyGridBackgroundCommand).execute(any(GridRendererContext.class));
    order.verify(renderBodyGridContentCommand).execute(any(GridRendererContext.class));
    order.verify(renderGridBoundaryCommand).execute(any(GridRendererContext.class));
    order.verify(renderHeaderGridLinesCommand).execute(any(GridRendererContext.class));
    order.verify(renderBodyGridLinesCommand).execute(any(GridRendererContext.class));
    order.verify(renderSelectedCellsCommand).execute(any(GridRendererContext.class));
}
Also used : InOrder(org.mockito.InOrder) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) GridRendererContext(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.GridRendererContext) Test(org.junit.Test)

Example 43 with BoundingBox

use of com.ait.lienzo.client.core.types.BoundingBox in project kie-wb-common by kiegroup.

the class FocusableGroup method setUpGroupDecorator.

private static MultiPath setUpGroupDecorator(final MultiPath primitive, final Group group) {
    final BoundingBox boundingBox = group.getBoundingBox();
    final double width = boundingBox.getWidth();
    final double height = boundingBox.getHeight();
    return primitive.clear().rect(0, 0, width, height).setFillAlpha(0.01).setStrokeAlpha(0.01).setListening(true).setFillBoundsForSelection(true).moveToTop();
}
Also used : BoundingBox(com.ait.lienzo.client.core.types.BoundingBox)

Example 44 with BoundingBox

use of com.ait.lienzo.client.core.types.BoundingBox in project kie-wb-common by kiegroup.

the class ItemGridImpl method itemsUpdated.

private ItemGridImpl itemsUpdated() {
    // Reposition items as for the given grid.
    repositionItems();
    // Calculate BB.
    double maxw = 0;
    double maxh = 0;
    for (final AbstractDecoratedItem item : items) {
        final Point2D location = item.asPrimitive().getLocation();
        final BoundingBox itemBB = (BoundingBox) item.getBoundingBox().get();
        final double itemw = itemBB.getWidth() + location.getX();
        final double itemh = itemBB.getHeight() + location.getY();
        if (itemw > maxw) {
            maxw = itemw;
        }
        if (itemh > maxh) {
            maxh = itemh;
        }
    }
    boundingBox = new BoundingBox(0, 0, maxw, maxh);
    // Update decorator.
    if (null != getWrapped().getDecorator()) {
        getWrapped().getDecorator().setBoundingBox(getBoundingBox().get());
        if (getWrapped().getDecorator() instanceof AbstractPrimitiveItem) {
            ((AbstractPrimitiveItem) getWrapped().getDecorator()).asPrimitive().moveToBottom();
        }
    }
    return this;
}
Also used : AbstractPrimitiveItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.AbstractPrimitiveItem) AbstractDecoratedItem(org.kie.workbench.common.stunner.lienzo.toolbox.items.AbstractDecoratedItem) Point2D(com.ait.lienzo.client.core.types.Point2D) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox)

Example 45 with BoundingBox

use of com.ait.lienzo.client.core.types.BoundingBox in project kie-wb-common by kiegroup.

the class ToolboxImpl method updateGridSize.

private ToolboxImpl updateGridSize() {
    final BoundingBox boundingBox = shapeBoundingBoxSupplier.get();
    final double margin = getGrid().getMargin() * 2;
    return setGridSize(boundingBox.getWidth() + margin, boundingBox.getHeight() + margin);
}
Also used : BoundingBox(com.ait.lienzo.client.core.types.BoundingBox)

Aggregations

BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)79 Point2D (com.ait.lienzo.client.core.types.Point2D)24 Test (org.junit.Test)16 ScratchPad (com.ait.lienzo.client.core.util.ScratchPad)8 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)7 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)7 Context2D (com.ait.lienzo.client.core.Context2D)6 ArrayList (java.util.ArrayList)6 Direction (com.ait.lienzo.shared.core.types.Direction)5 Group (com.ait.lienzo.client.core.shape.Group)4 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)4 Text (com.ait.lienzo.client.core.shape.Text)3 Transform (com.ait.lienzo.client.core.types.Transform)3 NFastDoubleArrayJSO (com.ait.tooling.nativetools.client.collection.NFastDoubleArrayJSO)3 Shape (org.kie.workbench.common.stunner.core.client.shape.Shape)3 MultiPathDecorator (com.ait.lienzo.client.core.shape.MultiPathDecorator)2 WiresConnection (com.ait.lienzo.client.core.shape.wires.WiresConnection)2 WiresConnector (com.ait.lienzo.client.core.shape.wires.WiresConnector)2 WiresMagnet (com.ait.lienzo.client.core.shape.wires.WiresMagnet)2 BoundingPoints (com.ait.lienzo.client.core.types.BoundingPoints)2