use of org.kie.workbench.common.stunner.core.graph.Node 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.Node in project kie-wb-common by kiegroup.
the class CaseManagementContainmentAcceptorControlImplTest method getAddEdgeCommand.
@Test
public void getAddEdgeCommand() {
final Node parent = mock(Node.class);
final Node child = mock(Node.class);
control.getAddEdgeCommand(parent, child);
verify(canvasCommandFactory, times(1)).setChildNode(eq(parent), eq(child));
}
use of org.kie.workbench.common.stunner.core.graph.Node in project kie-wb-common by kiegroup.
the class CaseManagementContainmentAcceptorControlImplTest method getSetEdgeCommand.
@Test
public void getSetEdgeCommand() {
final Node parent = mock(Node.class);
final Node child = mock(Node.class);
control.getSetEdgeCommand(parent, child, Optional.empty(), Optional.empty(), Optional.empty());
verify(canvasCommandFactory, times(1)).setChildNode(eq(parent), eq(child), eq(Optional.empty()), eq(Optional.empty()), eq(Optional.empty()));
}
use of org.kie.workbench.common.stunner.core.graph.Node in project kie-wb-common by kiegroup.
the class AbstractProcessFilteredNodeProvider method findElements.
protected Collection<Pair<Object, String>> findElements(final Predicate<Node> filter, final Function<Node, Pair<Object, String>> mapper) {
final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram();
@SuppressWarnings("unchecked") Iterable<Node> it = diagram.getGraph().nodes();
return StreamSupport.stream(it.spliterator(), false).filter(filter).map(mapper).filter(pair -> pair != null).collect(Collectors.toSet());
}
use of org.kie.workbench.common.stunner.core.graph.Node 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;
}
Aggregations