Search in sources :

Example 16 with BoundsImpl

use of org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl in project kie-wb-common by kiegroup.

the class DMNEditBusinessKnowledgeModelToolboxActionTest method setup.

@Before
public void setup() throws Exception {
    bkmNode = new NodeImpl<>(E_UUID);
    bkm = new BusinessKnowledgeModel();
    bkmFunction = new FunctionDefinition();
    bkm.setEncapsulatedLogic(bkmFunction);
    final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
    final View<BusinessKnowledgeModel> nodeContent = new ViewImpl<>(bkm, bounds);
    bkmNode.setContent(nodeContent);
    when(canvasHandler.getGraphIndex()).thenReturn(graphIndex);
    when(graphIndex.get(eq(E_UUID))).thenReturn(bkmNode);
    when(sessionManager.getCurrentSession()).thenReturn(session);
    this.tested = new DMNEditBusinessKnowledgeModelToolboxAction(sessionManager, translationService, editExpressionEvent);
}
Also used : BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.v1_1.BusinessKnowledgeModel) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.v1_1.FunctionDefinition) BoundsImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl) Before(org.junit.Before)

Example 17 with BoundsImpl

use of org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl in project kie-wb-common by kiegroup.

the class SessionPreviewImplTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.preview = new SessionPreviewImpl(definitionManager, shapeManager, textPropertyProviderFactory, canvasCommandManager, definitionUtils, graphUtils, canvasHandlerFactories, canvasCommandFactories, selectionControl, view);
    final DiagramImpl diagram = new DiagramImpl("diagram", new MetadataImpl());
    final GraphImpl graph = new GraphImpl("graph", new GraphNodeStoreImpl());
    final DefinitionSetImpl definitionSet = new DefinitionSetImpl("id");
    diagram.setGraph(graph);
    graph.setContent(definitionSet);
    definitionSet.setBounds(new BoundsImpl(new BoundImpl(0.0, 0.0), new BoundImpl(100.0, 100.0)));
    when(session.getCanvasHandler()).thenReturn(canvasHandler);
    when(session.getCanvas()).thenReturn(canvas);
    when(canvasHandler.getDiagram()).thenReturn(diagram);
    when(shapeManager.getCanvasFactory(any(Diagram.class))).thenReturn(canvasFactory);
    when(canvasFactory.newCanvas()).thenReturn(canvas);
    when(canvasFactory.newControl(eq(ZoomControl.class))).thenReturn(zoomControl);
    when(canvasHandlerFactories.select(any(Annotation.class))).thenReturn(canvasHandlerFactories);
    when(canvasHandlerFactories.get()).thenReturn(canvasHandler);
    when(canvas.getView()).thenReturn(canvasView);
    preview.open(session, callback);
}
Also used : GraphNodeStoreImpl(org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl) ZoomControl(org.kie.workbench.common.stunner.core.client.canvas.controls.zoom.ZoomControl) MetadataImpl(org.kie.workbench.common.stunner.core.diagram.MetadataImpl) DefinitionSetImpl(org.kie.workbench.common.stunner.core.graph.content.definition.DefinitionSetImpl) DiagramImpl(org.kie.workbench.common.stunner.core.diagram.DiagramImpl) GraphImpl(org.kie.workbench.common.stunner.core.graph.impl.GraphImpl) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) BoundsImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl) Annotation(java.lang.annotation.Annotation) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Before(org.junit.Before)

Example 18 with BoundsImpl

use of org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl in project kie-wb-common by kiegroup.

the class AbstractNodeBuilder method setBounds.

protected void setBounds(BuilderContext context, T node) {
    if (null != boundUL && null != boundLR) {
        Bounds bounds = new BoundsImpl(new BoundImpl(boundUL[0], boundUL[1]), new BoundImpl(boundLR[0], boundLR[1]));
        node.getContent().setBounds(bounds);
        setSize(context, node);
    }
}
Also used : Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) BoundsImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl)

Example 19 with BoundsImpl

use of org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl 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;
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) BoundsImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge)

Example 20 with BoundsImpl

use of org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl in project kie-wb-common by kiegroup.

the class BPMNGraphGenerator method createGraph.

public Graph<DefinitionSet, Node> createGraph() {
    Graph<DefinitionSet, Node> graph = (Graph<DefinitionSet, Node>) factoryManager.newElement(UUID.uuid(), diagramDefinitionSetClass);
    // TODO: Where are the BPMN diagram bounds in the Oryx json structure? Exist?
    if (null == graph.getContent().getBounds()) {
        graph.getContent().setBounds(new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(BPMNGraphFactory.GRAPH_DEFAULT_WIDTH, BPMNGraphFactory.GRAPH_DEFAULT_HEIGHT)));
    }
    builderContext.init(graph).execute(builderContext.getCommandFactory().clearGraph());
    NodeObjectBuilder diagramBuilder = getDiagramBuilder(builderContext);
    if (diagramBuilder == null) {
        throw new RuntimeException("No diagrams found!");
    }
    Node<View<BPMNDefinition>, Edge> diagramNode = (Node<View<BPMNDefinition>, Edge>) diagramBuilder.build(builderContext);
    graph.addNode(diagramNode);
    logBuilders();
    return graph;
}
Also used : Graph(org.kie.workbench.common.stunner.core.graph.Graph) TreeNode(com.fasterxml.jackson.core.TreeNode) Node(org.kie.workbench.common.stunner.core.graph.Node) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) BPMNDefinition(org.kie.workbench.common.stunner.bpmn.definition.BPMNDefinition) DefinitionSet(org.kie.workbench.common.stunner.core.graph.content.definition.DefinitionSet) BoundsImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge)

Aggregations

BoundsImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl)31 BoundImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl)28 Bounds (org.kie.workbench.common.stunner.core.graph.content.Bounds)14 Edge (org.kie.workbench.common.stunner.core.graph.Edge)12 View (org.kie.workbench.common.stunner.core.graph.content.view.View)12 Test (org.junit.Test)11 Node (org.kie.workbench.common.stunner.core.graph.Node)11 Point2D (org.kie.workbench.common.stunner.core.graph.content.view.Point2D)9 Before (org.junit.Before)7 TestingGraphMockHandler (org.kie.workbench.common.stunner.core.TestingGraphMockHandler)6 ViewImpl (org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl)6 Ignore (org.junit.Ignore)4 DefinitionSet (org.kie.workbench.common.stunner.core.graph.content.definition.DefinitionSet)4 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)4 Command (org.kie.workbench.common.stunner.core.command.Command)3 RuleEvaluationContext (org.kie.workbench.common.stunner.core.rule.RuleEvaluationContext)3 Consumer (java.util.function.Consumer)2 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.v1_1.BusinessKnowledgeModel)2 Decision (org.kie.workbench.common.dmn.api.definition.v1_1.Decision)2 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)2