@Test public void testChildren() { tested.add(someShape); assertEquals(rectangle, tested.getPrimitive("rect1")); } }
protected static SVGContainer newSVGContainer(final String id, final Group group, final boolean scalable, final LayoutContainer.Layout layout) { return new SVGContainer(id, group, scalable, layout); }
public IPrimitive getPrimitive(final String uuid) { return getPrimitive(get(), uuid); }
@Test public void testGetters() { assertEquals("cont1", tested.getId()); assertEquals(LayoutContainer.Layout.BOTTOM, tested.getLayout()); assertEquals(group, tested.get()); assertTrue(tested.isScalable()); }
private SVGBasicShapeView scriptTaskBasicView(final double width, final double height) { SVGPrimitiveShape mainShape = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.Rectangle(150.00, 98.00).setCornerRadius(2.00).setDraggable(false).setID("task").setX(0.00).setY(0.00).setAlpha(1.00).setListening(true).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#ffffff").setStrokeAlpha(0.00), false, null); final SVGBasicShapeViewImpl view = new SVGBasicShapeViewImpl("scriptTask", mainShape, width, height); SVGPrimitiveShape task_border = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.Rectangle(150.00, 98.00).setCornerRadius(2.00).setDraggable(false).setID("task-border").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setStrokeColor("#000000").setStrokeWidth(1.50), true, null); view.addChild(task_border); SVGContainer task__Utec = SVGPrimitiveFactory.newSVGContainer("task__Utec",new com.ait.lienzo.client.core.shape.Group().setDraggable(false).add( new com.ait.lienzo.client.core.shape.Group().setDraggable(false).setID("task__Utec").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(0.06,0.06).setOffset(10.00,10.00).setListening(false) ), false, null);SVGPrimitiveShape task__Utec__ts1K = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_TASK__UTEC__TS1K).setDraggable(false).setID("task__Utec__ts1K").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#393f44"), false, null);task__Utec.add(task__Utec__ts1K);SVGPrimitiveShape task__Utec__U6ex = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_TASK__UTEC__U6EX).setDraggable(false).setID("task__Utec__U6ex").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#393f44"), false, null);task__Utec.add(task__Utec__U6ex);SVGPrimitiveShape task__Utec__NWQr = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_TASK__UTEC__NWQR).setDraggable(false).setID("task__Utec__NWQr").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#393f44"), false, null);task__Utec.add(task__Utec__NWQr); view.addChild(task__Utec); return view; }
@SuppressWarnings("unchecked") public SVGContainer addPrimitive(final IPrimitive<?> primitive) { final ContainerNode container = (ContainerNode) getPrimitive(id); if (null != container) { container.add(primitive); } return this; }
public SVGContainer add(final SVGPrimitiveShape primitive) { children.add(primitive); addPrimitive(primitive.get()); return this; }
public static SVGPrimitive getPrimitive(final SVGContainer container, final String id) { return getPrimitive(container.getChildren(), id); }
private SVGBasicShapeView endEscalationEventBasicView(final double width, final double height) { SVGPrimitiveShape mainShape = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_EVENT_BACKGROUND).setDraggable(false).setID("event-background").setX(0.00).setY(0.00).setAlpha(1.00).setListening(true).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#fce7e7"), false, null); final SVGBasicShapeViewImpl view = new SVGBasicShapeViewImpl("endEscalationEvent", mainShape, width, height); SVGContainer event_type = SVGPrimitiveFactory.newSVGContainer("event-type",new com.ait.lienzo.client.core.shape.Group().setDraggable(false).add( new com.ait.lienzo.client.core.shape.Group().setDraggable(false).setID("event-type").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setListening(false) ), true, null);SVGPrimitiveShape end = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_END).setDraggable(false).setID("end").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#a30000"), true, null);event_type.add(end); view.addChild(event_type); SVGContainer event_subtypes = SVGPrimitiveFactory.newSVGContainer("event-subtypes",new com.ait.lienzo.client.core.shape.Group().setDraggable(false).add( new com.ait.lienzo.client.core.shape.Group().setDraggable(false).setID("event-subtypes").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setListening(false) ), true, null);SVGPrimitiveShape escalation_catching = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_ESCALATION_CATCHING).setDraggable(false).setID("escalation-catching").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#a30000"), true, null);event_subtypes.add(escalation_catching); view.addChild(event_subtypes); return view; }
@SuppressWarnings("unchecked") private static IPrimitive getPrimitive(final IContainer<?, IPrimitive<?>> container, final String uuid) { if (null != container.getID() && container.getID().equals(uuid)) { return (IPrimitive) container; } final NFastArrayList<IPrimitive<?>> childNodes = container.getChildNodes(); if (null != childNodes) { for (final IPrimitive node : childNodes) { if (null != node.getID() && node.getID().equals(uuid)) { return node; } else if (node instanceof IContainer) { final IPrimitive p = getPrimitive((IContainer<?, IPrimitive<?>>) node, uuid); if (null != p) { return p; } } } } return null; } }
@SuppressWarnings("unchecked") public void addSVGChild(final SVGContainer parent, final SVGBasicShapeView child) { if (!hasSvgChild(child)) { svgChildren.add(child); parent.addPrimitive((IPrimitive<?>) child.getContainer()); } }
private SVGBasicShapeView intermediateSignalThrowingEventBasicView(final double width, final double height) { SVGPrimitiveShape mainShape = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_EVENT_BACKGROUND).setDraggable(false).setID("event-background").setX(0.00).setY(0.00).setAlpha(1.00).setListening(true).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#bedee1"), false, null); final SVGBasicShapeViewImpl view = new SVGBasicShapeViewImpl("intermediateSignalThrowingEvent", mainShape, width, height); SVGContainer event_type = SVGPrimitiveFactory.newSVGContainer("event-type",new com.ait.lienzo.client.core.shape.Group().setDraggable(false).add( new com.ait.lienzo.client.core.shape.Group().setDraggable(false).setID("event-type").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setListening(false) ), true, null);SVGPrimitiveShape intermediate = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_INTERMEDIATE).setDraggable(false).setID("intermediate").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#007a87"), true, null);event_type.add(intermediate); view.addChild(event_type); SVGContainer event_subtypes = SVGPrimitiveFactory.newSVGContainer("event-subtypes",new com.ait.lienzo.client.core.shape.Group().setDraggable(false).add( new com.ait.lienzo.client.core.shape.Group().setDraggable(false).setID("event-subtypes").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setListening(false) ), true, null);SVGPrimitiveShape signal_throwing = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_SIGNAL_THROWING).setDraggable(false).setID("signal-throwing").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#007a87"), true, null);event_subtypes.add(signal_throwing); view.addChild(event_subtypes); return view; }
public static SVGContainer newSVGContainer(final String id, final Group group, final boolean scalable, final LayoutContainer.Layout layout) { return new SVGContainer(id, group, scalable, layout); }
@Test public void testAddSVGChild() { tested.addSVGChild(parentShape, svgChild); assertEquals(svgGroup, parentShape.getPrimitive("svgGroup1")); assertEquals(1, tested.getSVGChildren().size()); assertEquals(svgChild, tested.getSVGChildren().iterator().next()); }
private SVGShapeView scriptTaskView(final double width, final double height, final boolean resizable) { SVGPrimitiveShape mainShape = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.Rectangle(150.00, 98.00).setCornerRadius(2.00).setDraggable(false).setID("task").setX(0.00).setY(0.00).setAlpha(1.00).setListening(true).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#ffffff").setStrokeAlpha(0.00), true, null); final SVGShapeView view = getViewBuilder().build("scriptTask", mainShape, width, height, resizable); SVGPrimitiveShape task_border = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.Rectangle(150.00, 98.00).setCornerRadius(2.00).setDraggable(false).setID("task-border").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setStrokeColor("#000000").setStrokeWidth(1.50), true, null); view.addChild(task_border); SVGContainer task__Utec = SVGPrimitiveFactory.newSVGContainer("task__Utec",new com.ait.lienzo.client.core.shape.Group().setDraggable(false).add( new com.ait.lienzo.client.core.shape.Group().setDraggable(false).setID("task__Utec").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(0.06,0.06).setOffset(10.00,10.00).setListening(false) ), false, null);SVGPrimitiveShape task__Utec__ts1K = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_TASK__UTEC__TS1K).setDraggable(false).setID("task__Utec__ts1K").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#393f44"), false, null);task__Utec.add(task__Utec__ts1K);SVGPrimitiveShape task__Utec__U6ex = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_TASK__UTEC__U6EX).setDraggable(false).setID("task__Utec__U6ex").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#393f44"), false, null);task__Utec.add(task__Utec__U6ex);SVGPrimitiveShape task__Utec__NWQr = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_TASK__UTEC__NWQR).setDraggable(false).setID("task__Utec__NWQr").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#393f44"), false, null);task__Utec.add(task__Utec__NWQr); view.addChild(task__Utec); view.setTitleAlpha(1.00d);view.setTitleFontFamily("Open Sans");view.setTitleFontSize(12.00d);view.setTitleFontColor("#000000");view.setTitleStrokeWidth(1.00d);view.setTitleStrokeColor("#393f44"); if (view instanceof SVGShapeViewImpl) { ((SVGShapeViewImpl) view).getShapeStateHandler().setBorderShape(() -> SVGViewUtils.getVisibleShape(task_border)); ((SVGShapeViewImpl) view).getShapeStateHandler().setRenderType(org.kie.workbench.common.stunner.client.lienzo.shape.impl.ShapeStateDefaultHandler.RenderType.STROKE); } return view; }
@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); }
private SVGBasicShapeView inclusiveGatewayBasicView(final double width, final double height) { SVGPrimitiveShape mainShape = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_GATEWAY_BACKGROUND).setDraggable(false).setID("gateway-background").setX(0.00).setY(0.00).setAlpha(1.00).setListening(true).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#fef4ea"), false, null); final SVGBasicShapeViewImpl view = new SVGBasicShapeViewImpl("inclusiveGateway", mainShape, width, height); SVGContainer gateway_type = SVGPrimitiveFactory.newSVGContainer("gateway-type",new com.ait.lienzo.client.core.shape.Group().setDraggable(false).add( new com.ait.lienzo.client.core.shape.Group().setDraggable(false).setID("gateway-type").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setListening(false) ), true, null);SVGPrimitiveShape gateway = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_GATEWAY).setDraggable(false).setID("gateway").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#ec7a08"), true, null);gateway_type.add(gateway); view.addChild(gateway_type); SVGContainer gateway_subtypes = SVGPrimitiveFactory.newSVGContainer("gateway-subtypes",new com.ait.lienzo.client.core.shape.Group().setDraggable(false).add( new com.ait.lienzo.client.core.shape.Group().setDraggable(false).setID("gateway-subtypes").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setListening(false) ), true, null);SVGPrimitiveShape inclusive = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_INCLUSIVE).setDraggable(false).setID("inclusive").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#ec7a08"), true, null);gateway_subtypes.add(inclusive); view.addChild(gateway_subtypes); return view; }
@Before public void setup() throws Exception { group = new Group().setID("cont1"); rectangle = new Rectangle(10d, 10d).setID("rect1"); someShape = new SVGPrimitiveShape(rectangle); tested = new SVGContainer("cont1", group, true, LayoutContainer.Layout.BOTTOM); }
private SVGBasicShapeView intermediateMessageThrowingEventBasicView(final double width, final double height) { SVGPrimitiveShape mainShape = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_EVENT_BACKGROUND).setDraggable(false).setID("event-background").setX(0.00).setY(0.00).setAlpha(1.00).setListening(true).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#bedee1"), false, null); final SVGBasicShapeViewImpl view = new SVGBasicShapeViewImpl("intermediateMessageThrowingEvent", mainShape, width, height); SVGContainer event_type = SVGPrimitiveFactory.newSVGContainer("event-type",new com.ait.lienzo.client.core.shape.Group().setDraggable(false).add( new com.ait.lienzo.client.core.shape.Group().setDraggable(false).setID("event-type").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setListening(false) ), true, null);SVGPrimitiveShape intermediate = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_INTERMEDIATE).setDraggable(false).setID("intermediate").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#007a87"), true, null);event_type.add(intermediate); view.addChild(event_type); SVGContainer event_subtypes = SVGPrimitiveFactory.newSVGContainer("event-subtypes",new com.ait.lienzo.client.core.shape.Group().setDraggable(false).add( new com.ait.lienzo.client.core.shape.Group().setDraggable(false).setID("event-subtypes").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setListening(false) ), true, null);SVGPrimitiveShape message_throwing = SVGPrimitiveFactory.newSVGPrimitiveShape(new com.ait.lienzo.client.core.shape.MultiPath(VALUE_MESSAGE_THROWING).setDraggable(false).setID("message-throwing").setX(0.00).setY(0.00).setAlpha(1.00).setListening(false).setScale(1.00,1.00).setOffset(0.00,0.00).setFillColor("#007a87"), true, null);event_subtypes.add(message_throwing); view.addChild(event_subtypes); return view; }
@Before public void setup() throws Exception { this.parent = new SVGContainer("parent", new Group().setID("parent"), false, null); rectangle = new Rectangle(10d, 10d); this.shape = new SVGPrimitiveShape(rectangle); this.childShape = new SVGPrimitiveShape(new Rectangle(10d, 10d)); this.child = new SVGBasicShapeViewImpl("svgChild1", childShape, 50d, 23d); this.tested = new SVGBasicShapeViewImpl("svg-test1", shape, 100, 340); }