use of org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ViewTraverseProcessorImpl in project kie-wb-common by kiegroup.
the class CaseManagementCanvasCommandFactoryTest method setup.
@Before
public void setup() {
when(childrenTraverseProcessorInstances.get()).thenReturn(new ChildrenTraverseProcessorImpl(new TreeWalkTraverseProcessorImpl()));
when(viewTraverseProcessorInstances.get()).thenReturn(new ViewTraverseProcessorImpl(new TreeWalkTraverseProcessorImpl()));
this.factory = new CaseManagementCanvasCommandFactory(childrenTraverseProcessorInstances, null);
}
use of org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ViewTraverseProcessorImpl in project kie-wb-common by kiegroup.
the class CanvasHighlightVisitor method prepareVisit.
@SuppressWarnings("unchecked")
private void prepareVisit(final Command command) {
final Graph graph = canvasHandler.getDiagram().getGraph();
final TreeWalkTraverseProcessor treeWalkTraverseProcessor = new TreeWalkTraverseProcessorImpl().useStartNodePredicate(this::isStartNode);
new ViewTraverseProcessorImpl(treeWalkTraverseProcessor).traverse(graph, new ContentTraverseCallback<View<?>, Node<View, Edge>, Edge<View<?>, Node>>() {
@Override
public void startGraphTraversal(final Graph<DefinitionSet, Node<View, Edge>> graph) {
}
@Override
public void startEdgeTraversal(final Edge<View<?>, Node> edge) {
addShape(edge.getUUID());
}
@Override
public void endEdgeTraversal(final Edge<View<?>, Node> edge) {
}
@Override
public void startNodeTraversal(final Node<View, Edge> node) {
addShape(node.getUUID());
}
@Override
public void endNodeTraversal(final Node<View, Edge> node) {
}
@Override
public void endGraphTraversal() {
command.execute();
}
private void addShape(final String uuid) {
final Shape shape = canvasHandler.getCanvas().getShape(uuid);
if (null != shape) {
shapes.add(shape);
}
}
});
}
Aggregations