use of org.kie.workbench.common.stunner.core.graph.content.Bounds in project kie-wb-common by kiegroup.
the class LocationControlImpl method getLocationBounds.
@SuppressWarnings("unchecked")
private double[] getLocationBounds() {
final Graph<DefinitionSet, ? extends Node> graph = canvasHandler.getDiagram().getGraph();
final Bounds bounds = graph.getContent().getBounds();
return new double[] { bounds.getUpperLeft().getX(), bounds.getUpperLeft().getY(), bounds.getLowerRight().getX(), bounds.getLowerRight().getY() };
}
use of org.kie.workbench.common.stunner.core.graph.content.Bounds 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.Bounds 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.Bounds in project kie-wb-common by kiegroup.
the class MigrationDiagramMarshallerTest method assertNodeEquals.
private void assertNodeEquals(Diagram<Graph, Metadata> oldDiagram, Diagram<Graph, Metadata> newDiagram, String fileName) {
Map<String, Node<View, ?>> oldNodes = asNodeMap(oldDiagram.getGraph().nodes());
Map<String, Node<View, ?>> newNodes = asNodeMap(newDiagram.getGraph().nodes());
assertEquals(fileName + ": Number of nodes should match", oldNodes.size(), newNodes.size());
for (Node<View, ?> o : oldNodes.values()) {
Node<View, ?> n = newNodes.get(o.getUUID());
View oldContent = o.getContent();
View newContent = n.getContent();
Bounds oldBounds = oldContent.getBounds();
Bounds newBounds = newContent.getBounds();
assertEquals(fileName + ": Bounds should match for " + o.getUUID(), oldBounds, newBounds);
Object oldDefinition = oldContent.getDefinition();
Object newDefinition = newContent.getDefinition();
assertEquals(fileName + ": Definitions should match for " + o.getUUID(), oldDefinition, newDefinition);
}
}
use of org.kie.workbench.common.stunner.core.graph.content.Bounds in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerBase method assertNodeEquals.
private void assertNodeEquals(Diagram<Graph, Metadata> oldDiagram, Diagram<Graph, Metadata> newDiagram, String fileName) {
Map<String, Node<View, ?>> oldNodes = asNodeMap(oldDiagram.getGraph().nodes());
Map<String, Node<View, ?>> newNodes = asNodeMap(newDiagram.getGraph().nodes());
assertEquals(fileName + ": Number of nodes should match", oldNodes.size(), newNodes.size());
for (Node<View, ?> o : oldNodes.values()) {
Node<View, ?> n = newNodes.get(o.getUUID());
View oldContent = o.getContent();
View newContent = n.getContent();
Bounds oldBounds = oldContent.getBounds();
Bounds newBounds = newContent.getBounds();
assertEquals(fileName + ": Bounds should match for " + o.getUUID(), oldBounds, newBounds);
Object oldDefinition = oldContent.getDefinition();
Object newDefinition = newContent.getDefinition();
assertEquals(fileName + ": Definitions should match for " + o.getUUID(), oldDefinition, newDefinition);
}
}
Aggregations