Search in sources :

Example 6 with ActivityShape

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);
}
Also used : CaseManagementActivityShapeDef(org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementActivityShapeDef) ActivityView(org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView) SafeUri(com.google.gwt.safehtml.shared.SafeUri) BPMNViewDefinition(org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition) ActivityShape(org.kie.workbench.common.stunner.cm.client.shape.ActivityShape) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView)

Example 7 with ActivityShape

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));
}
Also used : ActivityShape(org.kie.workbench.common.stunner.cm.client.shape.ActivityShape) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView) ActivityView(org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Test(org.junit.Test)

Example 8 with ActivityShape

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));
}
Also used : ActivityShape(org.kie.workbench.common.stunner.cm.client.shape.ActivityShape) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView) ActivityView(org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Test(org.junit.Test)

Example 9 with ActivityShape

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();
}
Also used : Node(org.kie.workbench.common.stunner.core.graph.Node) ActivityShape(org.kie.workbench.common.stunner.cm.client.shape.ActivityShape) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView) ActivityView(org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge) MutationContext(org.kie.workbench.common.stunner.core.client.shape.MutationContext) Test(org.junit.Test)

Example 10 with ActivityShape

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));
}
Also used : ActivityShape(org.kie.workbench.common.stunner.cm.client.shape.ActivityShape) Test(org.junit.Test)

Aggregations

ActivityShape (org.kie.workbench.common.stunner.cm.client.shape.ActivityShape)12 Test (org.junit.Test)10 ActivityView (org.kie.workbench.common.stunner.cm.client.shape.view.ActivityView)9 PictureShapeView (org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView)9 Edge (org.kie.workbench.common.stunner.core.graph.Edge)7 View (org.kie.workbench.common.stunner.core.graph.content.view.View)7 CaseManagementTaskShapeDef (org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementTaskShapeDef)2 MutationContext (org.kie.workbench.common.stunner.core.client.shape.MutationContext)2 Node (org.kie.workbench.common.stunner.core.graph.Node)2 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1 SafeUri (com.google.gwt.safehtml.shared.SafeUri)1 BPMNDefinition (org.kie.workbench.common.stunner.bpmn.definition.BPMNDefinition)1 BPMNViewDefinition (org.kie.workbench.common.stunner.bpmn.definition.BPMNViewDefinition)1 CMContainerShape (org.kie.workbench.common.stunner.cm.client.shape.CMContainerShape)1 NullShape (org.kie.workbench.common.stunner.cm.client.shape.NullShape)1 CaseManagementActivityShapeDef (org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementActivityShapeDef)1 CaseManagementDiagramShapeDef (org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementDiagramShapeDef)1 CaseManagementReusableSubprocessTaskShapeDef (org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementReusableSubprocessTaskShapeDef)1 CaseManagementSubprocessShapeDef (org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementSubprocessShapeDef)1 NullShapeDef (org.kie.workbench.common.stunner.cm.client.shape.def.NullShapeDef)1