use of org.kie.workbench.common.stunner.cm.client.shape.ActivityShape in project kie-wb-common by kiegroup.
the class CaseManagementShapeDefFactory method newActivityShape.
@SuppressWarnings("unchecked")
private Shape newActivityShape(final Object instance, final ShapeDef shapeDef) {
final BPMNViewDefinition bpmnDefinition = (BPMNViewDefinition) instance;
final CaseManagementActivityShapeDef cmShapeDef = (CaseManagementActivityShapeDef) shapeDef;
final double width = cmShapeDef.getWidth(bpmnDefinition);
final double height = cmShapeDef.getHeight(bpmnDefinition);
final ActivityView view = cmShapeViewFactory.newActivityView(width, height);
final SafeUri iconUri = cmShapeDef.getIconUri(instance.getClass());
final PictureShapeView iconView = basicShapeViewFactory.pictureFromUri(iconUri, 15d, 15d);
return new ActivityShape(cmShapeDef, iconView, view);
}
use of org.kie.workbench.common.stunner.cm.client.shape.ActivityShape in project kie-wb-common by kiegroup.
the class CaseManagementCanvasHandlerTest method checkAddChildRenderableShapes.
@Test
@SuppressWarnings("unchecked")
public void checkAddChildRenderableShapes() {
final ActivityShape parentShape = makeShape();
final ActivityShape childShape = makeShape();
final Node<View<BPMNViewDefinition>, Edge> parentNode = makeNode("parent", parentShape);
final Node<View<BPMNViewDefinition>, Edge> childNode = makeNode("child", childShape);
handler.register(parentShape, parentNode, true);
handler.register(childShape, childNode, true);
handler.addChild(parentNode, childNode);
verify(canvas, times(1)).addChildShape(eq(parentShape), eq(childShape));
verify(layer, never()).addShape(eq(childShape));
}
use of org.kie.workbench.common.stunner.cm.client.shape.ActivityShape in project kie-wb-common by kiegroup.
the class CaseManagementCanvasHandlerTest method checkAddChildRenderableShapesAtIndex.
@Test
@SuppressWarnings("unchecked")
public void checkAddChildRenderableShapesAtIndex() {
final ActivityShape parentShape = makeShape();
final ActivityShape childShape = makeShape();
final Node<View<BPMNViewDefinition>, Edge> parentNode = makeNode("parent", parentShape);
final Node<View<BPMNViewDefinition>, Edge> childNode = makeNode("child", childShape);
handler.register(parentShape, parentNode, true);
handler.register(childShape, childNode, true);
handler.addChild(parentNode, childNode, 0);
verify(canvas, times(1)).addChildShape(eq(parentShape), eq(childShape), eq(0));
verify(layer, never()).addShape(eq(childShape));
}
use of org.kie.workbench.common.stunner.cm.client.shape.ActivityShape in project kie-wb-common by kiegroup.
the class CaseManagementCanvasHandlerTest method checkApplyShapeElementMutationRenderableShapes.
@Test
@SuppressWarnings("unchecked")
public void checkApplyShapeElementMutationRenderableShapes() {
final ActivityShape shape = spy(makeShape());
final Node<View<BPMNViewDefinition>, Edge> node = makeNode("uuid", shape);
final MutationContext mutationContext = mock(MutationContext.class);
doNothing().when(shape).applyPosition(eq(node), eq(mutationContext));
doNothing().when(shape).applyProperties(eq(node), eq(mutationContext));
doNothing().when(shape).applyTitle(anyString(), any(Node.class), eq(mutationContext));
handler.register(shape, node, true);
verify(canvas, times(1)).draw();
handler.applyElementMutation(node, true, true, mutationContext);
verify(shape, times(1)).applyPosition(eq(node), eq(mutationContext));
verify(shape, times(1)).applyProperties(eq(node), eq(mutationContext));
verify(canvas, times(2)).draw();
}
use of org.kie.workbench.common.stunner.cm.client.shape.ActivityShape in project kie-wb-common by kiegroup.
the class CaseManagementCanvasHandlerTest method checkRemoveShapeRenderableShapes.
@Test
public void checkRemoveShapeRenderableShapes() {
final ActivityShape shape = makeShape();
handler.removeShape(shape);
verify(canvas, times(1)).deleteShape(eq(shape));
}
Aggregations