Search in sources :

Example 1 with CaseManagementDiagram

use of org.kie.workbench.common.stunner.cm.definition.CaseManagementDiagram in project kie-wb-common by kiegroup.

the class CaseManagementShapeDefFactory method newDiagramShape.

@SuppressWarnings("unchecked")
private Shape newDiagramShape(final Object instance, final ShapeDef shapeDef) {
    final CaseManagementDiagram diagram = (CaseManagementDiagram) instance;
    final CaseManagementDiagramShapeDef cmShapeDef = (CaseManagementDiagramShapeDef) shapeDef;
    final double width = cmShapeDef.getWidth(diagram);
    final double height = cmShapeDef.getHeight(diagram);
    final DiagramView view = cmShapeViewFactory.newDiagramView(width, height);
    return new CMContainerShape(cmShapeDef, view);
}
Also used : DiagramView(org.kie.workbench.common.stunner.cm.client.shape.view.DiagramView) CaseManagementDiagram(org.kie.workbench.common.stunner.cm.definition.CaseManagementDiagram) CaseManagementDiagramShapeDef(org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementDiagramShapeDef) CMContainerShape(org.kie.workbench.common.stunner.cm.client.shape.CMContainerShape)

Example 2 with CaseManagementDiagram

use of org.kie.workbench.common.stunner.cm.definition.CaseManagementDiagram in project kie-wb-common by kiegroup.

the class CaseManagementUtilsTest method checkGetFirstDiagramNodeWithNonEmptyGraph.

@Test
@SuppressWarnings("unchecked")
public void checkGetFirstDiagramNodeWithNonEmptyGraph() {
    final Graph graph = new GraphImpl<>("uuid", new GraphNodeStoreImpl());
    final Node node = new NodeImpl<Definition>("node-uuid");
    final CaseManagementDiagram content = new CaseManagementDiagram.CaseManagementDiagramBuilder().build();
    node.setContent(new DefinitionImpl<>(content));
    graph.addNode(node);
    final Node<Definition<CaseManagementDiagram>, ?> fNode = CaseManagementUtils.getFirstDiagramNode(graph);
    assertNotNull(fNode);
    assertEquals("node-uuid", fNode.getUUID());
    assertEquals(content, fNode.getContent().getDefinition());
}
Also used : GraphNodeStoreImpl(org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl) Graph(org.kie.workbench.common.stunner.core.graph.Graph) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) CaseManagementDiagram(org.kie.workbench.common.stunner.cm.definition.CaseManagementDiagram) GraphImpl(org.kie.workbench.common.stunner.core.graph.impl.GraphImpl) Node(org.kie.workbench.common.stunner.core.graph.Node) Definition(org.kie.workbench.common.stunner.core.graph.content.definition.Definition) Test(org.junit.Test)

Aggregations

CaseManagementDiagram (org.kie.workbench.common.stunner.cm.definition.CaseManagementDiagram)2 Test (org.junit.Test)1 CMContainerShape (org.kie.workbench.common.stunner.cm.client.shape.CMContainerShape)1 CaseManagementDiagramShapeDef (org.kie.workbench.common.stunner.cm.client.shape.def.CaseManagementDiagramShapeDef)1 DiagramView (org.kie.workbench.common.stunner.cm.client.shape.view.DiagramView)1 Graph (org.kie.workbench.common.stunner.core.graph.Graph)1 Node (org.kie.workbench.common.stunner.core.graph.Node)1 Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)1 GraphImpl (org.kie.workbench.common.stunner.core.graph.impl.GraphImpl)1 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)1 GraphNodeStoreImpl (org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl)1