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);
}
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;
}
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;
}
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());
}
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));
}
Aggregations