Search in sources :

Example 1 with ViewTraverseProcessorImpl

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);
}
Also used : ChildrenTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ChildrenTraverseProcessorImpl) ViewTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ViewTraverseProcessorImpl) TreeWalkTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl) Before(org.junit.Before)

Example 2 with ViewTraverseProcessorImpl

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);
            }
        }
    });
}
Also used : Shape(org.kie.workbench.common.stunner.core.client.shape.Shape) Node(org.kie.workbench.common.stunner.core.graph.Node) ViewTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ViewTraverseProcessorImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) TreeWalkTraverseProcessorImpl(org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl) TreeWalkTraverseProcessor(org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessor) Graph(org.kie.workbench.common.stunner.core.graph.Graph) DefinitionSet(org.kie.workbench.common.stunner.core.graph.content.definition.DefinitionSet) Edge(org.kie.workbench.common.stunner.core.graph.Edge)

Aggregations

ViewTraverseProcessorImpl (org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ViewTraverseProcessorImpl)2 TreeWalkTraverseProcessorImpl (org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessorImpl)2 Before (org.junit.Before)1 Shape (org.kie.workbench.common.stunner.core.client.shape.Shape)1 Edge (org.kie.workbench.common.stunner.core.graph.Edge)1 Graph (org.kie.workbench.common.stunner.core.graph.Graph)1 Node (org.kie.workbench.common.stunner.core.graph.Node)1 DefinitionSet (org.kie.workbench.common.stunner.core.graph.content.definition.DefinitionSet)1 View (org.kie.workbench.common.stunner.core.graph.content.view.View)1 ChildrenTraverseProcessorImpl (org.kie.workbench.common.stunner.core.graph.processing.traverse.content.ChildrenTraverseProcessorImpl)1 TreeWalkTraverseProcessor (org.kie.workbench.common.stunner.core.graph.processing.traverse.tree.TreeWalkTraverseProcessor)1