use of org.kie.workbench.common.stunner.core.graph.Node 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.core.graph.Node in project kie-wb-common by kiegroup.
the class CaseManagementContainmentAcceptorControlImplTest method getDeleteEdgeCommand.
@Test
public void getDeleteEdgeCommand() {
final Node parent = mock(Node.class);
final Node child = mock(Node.class);
control.getDeleteEdgeCommand(parent, child);
verify(canvasCommandFactory, times(1)).removeChild(eq(parent), eq(child));
}
use of org.kie.workbench.common.stunner.core.graph.Node in project kie-wb-common by kiegroup.
the class CaseManagementRemoveChildCommandTest method setup.
@Before
public void setup() {
super.setup();
this.parent = CommandTestUtils.makeNode("uuid1", "parent", 10.0, 20.0, 50.0, 50.0);
this.candidate = CommandTestUtils.makeNode("uuid2", "candidate", 10.0, 20.0, 50.0, 50.0);
this.command = new CaseManagementRemoveChildCommand(parent, candidate);
final Edge<Child, Node> edge = new EdgeImpl<>("edge1");
edge.setContent(new Child());
edge.setSourceNode(parent);
edge.setTargetNode(candidate);
parent.getOutEdges().add(edge);
candidate.getInEdges().add(edge);
}
use of org.kie.workbench.common.stunner.core.graph.Node in project kie-wb-common by kiegroup.
the class DefaultRouteFormProvider method findElements.
@Override
protected Collection<Pair<Object, String>> findElements(Predicate<Node> filter, Function<Node, Pair<Object, String>> mapper) {
Node selectedNode = getSelectedElement();
Collection<Pair<Object, String>> result = new ArrayList<>();
if (selectedNode != null) {
List<Edge> outEdges = selectedNode.getOutEdges();
if (outEdges != null) {
result = outEdges.stream().map(outEdge -> {
String routeIdentifier = outEdge.getUUID();
// UI value for the route is the target node name or target node type
String targetName = null;
String targetNodeType = null;
BPMNDefinition bpmnDefinition = getEdgeTarget(outEdge);
if (bpmnDefinition != null) {
targetNodeType = definitionManager.adapters().forDefinition().getTitle(bpmnDefinition);
if (bpmnDefinition instanceof BaseStartEvent || bpmnDefinition instanceof BaseCatchingIntermediateEvent || bpmnDefinition instanceof BaseThrowingIntermediateEvent || bpmnDefinition instanceof BaseEndEvent || bpmnDefinition instanceof BaseTask || bpmnDefinition instanceof BaseGateway || bpmnDefinition instanceof BaseSubprocess) {
targetName = bpmnDefinition.getGeneral().getName().getValue();
}
}
if (targetName != null && !targetName.isEmpty()) {
return new Pair<Object, String>(routeIdentifier, targetName);
} else if (targetNodeType != null && !targetNodeType.isEmpty()) {
return new Pair<Object, String>(routeIdentifier, targetNodeType);
} else {
return new Pair<Object, String>(routeIdentifier, routeIdentifier);
}
}).collect(Collectors.toList());
}
}
return result;
}
use of org.kie.workbench.common.stunner.core.graph.Node in project kie-wb-common by kiegroup.
the class BPMNProcessVariableDeleteHandler method isVariableBoundToNodes.
public boolean isVariableBoundToNodes(Graph graph, String propertyId) {
final Collection<String> result = new ArrayList();
graph.nodes().forEach(node -> {
Node nodeVar = (Node) node;
boolean process = this.isVariableBoundToNode(nodeVar, propertyId);
if (process) {
result.add(nodeVar.getUUID());
}
});
return result.size() > 0;
}
Aggregations