use of org.kie.workbench.common.stunner.core.graph.content.view.View in project kie-wb-common by kiegroup.
the class CaseManagementCanvasHandlerTest method checkApplyElementMutationRenderableShapes.
@Test
@SuppressWarnings("unchecked")
public void checkApplyElementMutationRenderableShapes() {
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.applyElementMutation(shape, 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(1)).draw();
}
use of org.kie.workbench.common.stunner.core.graph.content.view.View in project kie-wb-common by kiegroup.
the class CommandTestUtils method makeNode.
public static Node<View<?>, Edge> makeNode(final String uuid, final String content, final double x, final double y, final double w, final double h) {
final Bounds bounds = new BoundsImpl(new BoundImpl(x, y), new BoundImpl(x + w, y + h));
final Node<View<?>, Edge> node = new NodeImpl<>(uuid);
node.setContent(new ViewImpl<>(content, bounds));
return node;
}
use of org.kie.workbench.common.stunner.core.graph.content.view.View in project kie-wb-common by kiegroup.
the class ProcessVariablesProvider method findElements.
@Override
protected Collection<Pair<Object, String>> findElements(Predicate<Node> filter, Function<Node, Pair<Object, String>> mapper) {
Collection<Pair<Object, String>> result = new ArrayList<>();
String elementUUID = sessionManager.getCurrentSession().getCanvasHandler().getDiagram().getMetadata().getCanvasRootUUID();
Node node;
if (elementUUID != null) {
node = sessionManager.getCurrentSession().getCanvasHandler().getDiagram().getGraph().getNode(elementUUID);
Object oDefinition = ((View) node.getContent()).getDefinition();
if (oDefinition instanceof BPMNDiagram) {
BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) oDefinition;
ProcessVariables processVars = bpmnDiagram.getProcessData().getProcessVariables();
if (processVars.getValue().length() > 0) {
List<String> list = Arrays.asList(processVars.getValue().split(","));
list.forEach(s1 -> {
String value = s1.split(":")[0];
result.add(new Pair<>(value, value));
});
}
}
}
return result;
}
use of org.kie.workbench.common.stunner.core.graph.content.view.View in project kie-wb-common by kiegroup.
the class AssignmentsEditorWidget method getProcessVariables.
protected String getProcessVariables() {
Diagram diagram = canvasSessionManager.getCurrentSession().getCanvasHandler().getDiagram();
Iterator<Element> it = diagram.getGraph().nodes().iterator();
while (it.hasNext()) {
Element element = it.next();
if (element.getContent() instanceof View) {
Object oDefinition = ((View) element.getContent()).getDefinition();
if (oDefinition instanceof BPMNDiagramImpl) {
BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) oDefinition;
ProcessVariables variables = bpmnDiagram.getProcessData().getProcessVariables();
if (variables != null) {
return variables.getValue();
}
break;
}
}
}
return null;
}
use of org.kie.workbench.common.stunner.core.graph.content.view.View in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testUnmarshallEmbeddedSubprocess.
@Test
public void testUnmarshallEmbeddedSubprocess() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_EMBEDDED_SUBPROCESS);
EmbeddedSubprocess subprocess = null;
Iterator<Element> it = nodesIterator(diagram);
while (it.hasNext()) {
Element element = it.next();
if (element.getContent() instanceof View) {
Object oDefinition = ((View) element.getContent()).getDefinition();
if (oDefinition instanceof EmbeddedSubprocess) {
subprocess = (EmbeddedSubprocess) oDefinition;
break;
}
}
}
assertNotNull(subprocess);
}
Aggregations