Search in sources :

Example 1 with Rectangle

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

the class BaseExpressionGridThemeTest method testGetBodyBackgroundFillColour.

@Test
public void testGetBodyBackgroundFillColour() {
    tests.stream().forEach(test -> {
        final GridColumn column = mock(test.getK1());
        final Rectangle rectangle = theme.getBodyBackground(column);
        assertEquals(test.getK2(), rectangle.getFillColor());
    });
}
Also used : Rectangle(com.ait.lienzo.client.core.shape.Rectangle) GridColumn(org.uberfire.ext.wires.core.grids.client.model.GridColumn) Test(org.junit.Test)

Example 2 with Rectangle

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

the class DMNGridLayer method addGhost.

void addGhost(final ExpressionContainerGrid container, final GridWidget gridWidget) {
    // Rectangle the size of the ExpressionContainerGrid
    final Rectangle r = getGhostRectangle();
    r.setWidth(container.getWidth() + BaseExpressionGridTheme.STROKE_WIDTH);
    r.setHeight(container.getHeight() + BaseExpressionGridTheme.STROKE_WIDTH);
    r.setFillColor(ColorName.WHITE);
    r.setAlpha(0.50);
    r.setListening(false);
    final Group g = GWT.create(Group.class);
    final Transform transform = getViewport().getTransform();
    g.setX(container.getX() + transform.getTranslateX());
    g.setY(container.getY() + transform.getTranslateY());
    g.add(r);
    // LiteralExpression and UndefinedExpression are not handled as grids in
    // their own right. In these circumstances use their parent GridWidget.
    GridWidget gw = gridWidget;
    if (gw instanceof LiteralExpressionGrid) {
        gw = ((LiteralExpressionGrid) gw).getParentInformation().getGridWidget();
    } else if (gw instanceof UndefinedExpressionGrid) {
        gw = ((UndefinedExpressionGrid) gw).getParentInformation().getGridWidget();
    }
    // Clip the inner GridWidget so everything outside of it is ghosted
    final IPathClipper clipper = new InverseGridWidgetClipper(container, gw);
    clipper.setActive(true);
    g.setPathClipper(clipper);
    g.drawWithTransforms(getContext(), 1.0, getStorageBounds());
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) GridWidget(org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget) UndefinedExpressionGrid(org.kie.workbench.common.dmn.client.editors.expressions.types.undefined.UndefinedExpressionGrid) IPathClipper(com.ait.lienzo.client.core.shape.IPathClipper) Rectangle(com.ait.lienzo.client.core.shape.Rectangle) Transform(com.ait.lienzo.client.core.types.Transform) LiteralExpressionGrid(org.kie.workbench.common.dmn.client.editors.expressions.types.literal.LiteralExpressionGrid)

Example 3 with Rectangle

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

the class WiresUtilsTest method shapeUUID.

@Test
public void shapeUUID() {
    final String uuid = "uuid";
    final IDrawable shape = new Rectangle(0, 0);
    WiresUtils.assertShapeUUID(shape, uuid);
    assertTrue(shape.getUserData() instanceof WiresUtils.UserData);
    assertEquals(uuid, WiresUtils.getShapeUUID(shape));
}
Also used : Rectangle(com.ait.lienzo.client.core.shape.Rectangle) IDrawable(com.ait.lienzo.client.core.shape.IDrawable) Test(org.junit.Test)

Example 4 with Rectangle

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

the class AbstractLienzoShapeGlyphRenderer method render.

@Override
public Group render(final G glyph, final double width, final double height) {
    final Group group = new Group();
    final Rectangle decorator = new Rectangle(width, height).setCornerRadius(5).setFillColor(ColorName.LIGHTGREY).setFillAlpha(0.7d);
    group.add(decorator);
    getShape(glyph, width, height, shape -> {
        group.add(shape);
        scaleShape(shape, width, height);
        group.remove(decorator);
    });
    return group;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Rectangle(com.ait.lienzo.client.core.shape.Rectangle)

Example 5 with Rectangle

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

the class SVGChildViewHandlerTest method setup.

@Before
public void setup() throws Exception {
    this.svgGroup = new Group().setID("svgGroup1");
    this.group = new Group().setID("parent");
    this.rectangle = new Rectangle(10d, 10d);
    when(svgChild.getContainer()).thenReturn(svgGroup);
    this.parentShape = new SVGContainer("parent", group, false, null);
    this.tested = new SVGChildViewHandler(shapeView);
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) SVGContainer(org.kie.workbench.common.stunner.svg.client.shape.view.SVGContainer) Rectangle(com.ait.lienzo.client.core.shape.Rectangle) Before(org.junit.Before)

Aggregations

Rectangle (com.ait.lienzo.client.core.shape.Rectangle)21 Group (com.ait.lienzo.client.core.shape.Group)10 Test (org.junit.Test)5 Text (com.ait.lienzo.client.core.shape.Text)3 Before (org.junit.Before)3 SVGContainer (org.kie.workbench.common.stunner.svg.client.shape.view.SVGContainer)3 IDrawable (com.ait.lienzo.client.core.shape.IDrawable)2 IPathClipper (com.ait.lienzo.client.core.shape.IPathClipper)2 SVGPrimitiveShape (org.kie.workbench.common.stunner.svg.client.shape.view.SVGPrimitiveShape)2 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)2 AnimationProperties (com.ait.lienzo.client.core.animation.AnimationProperties)1 IAnimation (com.ait.lienzo.client.core.animation.IAnimation)1 IAnimationCallback (com.ait.lienzo.client.core.animation.IAnimationCallback)1 IAnimationHandle (com.ait.lienzo.client.core.animation.IAnimationHandle)1 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1 Triangle (com.ait.lienzo.client.core.shape.Triangle)1 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)1 Point2D (com.ait.lienzo.client.core.types.Point2D)1 Transform (com.ait.lienzo.client.core.types.Transform)1 GuidedDecisionTableRenderer (org.drools.workbench.screens.guided.dtable.client.widget.table.themes.GuidedDecisionTableRenderer)1