use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.
the class SVGShapeViewImplTest method setup.
@Before
public void setup() throws Exception {
this.parent = new SVGContainer("parent", new Group().setID("parent"), false, null);
rectangle = new Rectangle(10d, 10d);
this.childShape = new SVGPrimitiveShape(new Rectangle(10d, 10d));
this.child = new SVGBasicShapeViewImpl("svgChild1", childShape, 50d, 23d);
this.shape = new SVGPrimitiveShape(rectangle);
this.tested = new SVGShapeViewImpl("svg-test1", shape, 100, 340, false);
}
use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.
the class ConnectorGlyphLienzoRenderer method render.
@Override
public Group render(final ConnectorGlyph glyph, final double width, final double height) {
final Group group = new Group();
final Arrow arrow = new Arrow(new Point2D(STROKE_SIZE, height), new Point2D(width, STROKE_SIZE), 5, 10, 45, 45, ArrowType.AT_END).setStrokeWidth(STROKE_SIZE).setFillColor(glyph.getColor()).setStrokeColor(glyph.getColor()).setDraggable(true);
group.add(arrow);
scaleTo(group, width - arrow.getStrokeWidth(), height - arrow.getStrokeWidth());
return group;
}
use of com.ait.lienzo.client.core.shape.Group 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.Group in project kie-wb-common by kiegroup.
the class LienzoElementGlyphRenderer method newPanel.
private LienzoPanel newPanel(final G glyph, final int width, final int height) {
final Group glyphGroup = getLienzoGlyphRenderer().render(glyph, width, height);
final LienzoPanel panel = new LienzoPanel(width, height);
final Layer layer = new Layer();
panel.add(layer.setTransformable(true));
layer.add(glyphGroup);
return panel;
}
use of com.ait.lienzo.client.core.shape.Group in project kie-wb-common by kiegroup.
the class ControlPointControlImplTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
layer = spy(new Layer());
edge = new EdgeImpl<>(EDGE_UUID);
content = new ViewConnectorImpl(mock(Object.class), Bounds.create());
edge.setContent(content);
controlPoints = new ControlPoint[] { CONTROL_POINT };
content.setControlPoints(controlPoints);
Group connectorGroup = new Group();
layer.add(connectorGroup);
when(connector.getGroup()).thenReturn(connectorGroup);
when(connector.uuid()).thenReturn(EDGE_UUID);
when(connector.getUUID()).thenReturn(EDGE_UUID);
when(connector.getPointHandles()).thenReturn(wiresPointHandles);
when(wiresPointHandles.isEmpty()).thenReturn(false);
when(wiresPointHandles.size()).thenReturn(3);
when(wiresPointHandles.getHandle(eq(0))).thenReturn(mock(IControlHandle.class));
when(wiresPointHandles.getHandle(eq(1))).thenReturn(wiresPointHandle);
when(wiresPointHandles.getHandle(eq(2))).thenReturn(mock(IControlHandle.class));
when(wiresPointHandle.getControl()).thenReturn(wiresPointPrimitive);
when(wiresPointPrimitive.getX()).thenReturn(CONTROL_POINT.getLocation().getX());
when(wiresPointPrimitive.getY()).thenReturn(CONTROL_POINT.getLocation().getY());
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(canvasHandler.getCanvas()).thenReturn(canvas);
when(canvasHandler.getAbstractCanvas()).thenReturn(canvas);
when(canvas.getWiresManager()).thenReturn(wiresManager);
when(canvas.getShape(EDGE_UUID)).thenReturn(connectorShape);
when(connectorShape.getShapeView()).thenReturn(connector);
when(diagram.getMetadata()).thenReturn(metadata);
when(graph.getContent()).thenReturn(graphContent);
when(diagram.getGraph()).thenReturn(graph);
when(commandManager.allow(eq(canvasHandler), any(Command.class))).thenReturn(CanvasCommandResultBuilder.SUCCESS);
tested = new ControlPointControlImpl(canvasCommandFactory, selectionEvent);
tested.setCommandManagerProvider(() -> commandManager);
}
Aggregations