Search in sources :

Example 11 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)

Example 12 with Rectangle

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

the class LienzoPictureGlyphRenderer method render.

public Group render(final String data, final double width, final double height) {
    final DestroyableGroup group = new DestroyableGroup();
    final Rectangle decorator = new Rectangle(width, height).setCornerRadius(5).setFillColor(ColorName.LIGHTGREY).setFillAlpha(0.7d);
    pictureBuilder.accept(data, picture -> {
        group.picture = picture;
        scalePicture(picture, width, height);
        group.remove(decorator);
        group.add(picture);
    });
    group.add(decorator);
    return group;
}
Also used : Rectangle(com.ait.lienzo.client.core.shape.Rectangle)

Example 13 with Rectangle

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

the class PrimitiveTooltip method buildDecorator.

private IPrimitive<?> buildDecorator(final double width, final double height, final Direction direction) {
    final boolean isWest = isWest(direction);
    final boolean isNorth = isNorth(direction);
    final double h2 = height / 2;
    final double w2 = width / 2;
    final double s2 = TRIANGLE_SIZE / 2;
    final Point2D a = isWest ? new Point2D(0, h2) : new Point2D(10, 0);
    final Point2D b = isWest ? new Point2D(TRIANGLE_SIZE, h2 + s2) : new Point2D(10 + s2, TRIANGLE_SIZE);
    final Point2D c = isWest ? new Point2D(TRIANGLE_SIZE, h2 - s2) : new Point2D(10 - s2, TRIANGLE_SIZE);
    final Triangle triangle = new Triangle(a, b, c).setFillColor(BG_COLOR).setFillAlpha(ALPHA).setStrokeWidth(0);
    final Rectangle rectangle = new Rectangle(width + (isWest ? TRIANGLE_SIZE : 0), height + (isNorth ? TRIANGLE_SIZE : 0)).setX(isWest ? TRIANGLE_SIZE : 0).setY(isWest ? 0 : TRIANGLE_SIZE).setCornerRadius(10).setFillColor(BG_COLOR).setFillAlpha(ALPHA).setStrokeAlpha(0).setCornerRadius(5);
    final Group decorator = new Group();
    decorator.add(rectangle);
    decorator.add(triangle);
    return decorator;
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Point2D(com.ait.lienzo.client.core.types.Point2D) Triangle(com.ait.lienzo.client.core.shape.Triangle) Rectangle(com.ait.lienzo.client.core.shape.Rectangle)

Example 14 with Rectangle

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

the class ShapeViewUserDataEncoderTest method testSetShapeViewChildrenIds.

@Test
@SuppressWarnings("unchecked")
public void testSetShapeViewChildrenIds() {
    String uuid = "uuid1";
    // Main group.
    Group mainGroup = new Group();
    Rectangle r1 = new Rectangle(50, 50);
    r1.setID("r1");
    Rectangle r2 = new Rectangle(50, 50);
    r2.setUserData("?someUserDataForR2");
    Rectangle r3 = new Rectangle(50, 50);
    mainGroup.add(r1);
    mainGroup.add(r2);
    mainGroup.add(r3);
    // Sub group.
    Group subGroup = new Group();
    Rectangle r11 = new Rectangle(50, 50);
    r11.setID("r11");
    Rectangle r22 = new Rectangle(50, 50);
    r22.setUserData("?someUserDataForR22");
    subGroup.add(r11);
    subGroup.add(r22);
    mainGroup.add(subGroup);
    // Test encoding ids.
    new ShapeViewUserDataEncoder().setShapeViewChildrenIds(uuid, mainGroup);
    // Id's assertions.
    assertEquals(uuid + "_r1", r1.getID());
    assertEquals(uuid + "?someUserDataForR2", r2.getID());
    assertEquals(uuid, r3.getID());
    assertEquals(uuid + "_r11", r11.getID());
    assertEquals(uuid + "?someUserDataForR22", r22.getID());
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Rectangle(com.ait.lienzo.client.core.shape.Rectangle) Test(org.junit.Test)

Example 15 with Rectangle

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

the class WiresUtilsTest method shapeGroup.

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

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