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);
}
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);
}
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);
}
}
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;
}
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;
}
Aggregations