use of org.kie.workbench.common.stunner.core.graph.content.Bounds in project kie-wb-common by kiegroup.
the class TestSequenceFlowWriter method nodeOf.
PropertyWriter nodeOf(String id, float x, float y, float width, float height) {
ScriptTask el = bpmn2.createScriptTask();
el.setId(id);
Bounds sb = Bounds.create(x, y, x + width, y + height);
PropertyWriter p = propertyWriter.of(el);
p.setBounds(sb);
return p;
}
use of org.kie.workbench.common.stunner.core.graph.content.Bounds in project kie-wb-common by kiegroup.
the class LocationControlImplTest method testEnsureDragConstraints.
@Test
public void testEnsureDragConstraints() throws Exception {
tested.init(canvasHandler);
Bounds bounds = Bounds.create(0d, 0d, 600d, 600d);
when(canvasPanel.getLocationConstraints()).thenReturn(bounds);
tested.register(element);
verify(shapeView, times(1)).setDragBounds(eq(bounds));
}
use of org.kie.workbench.common.stunner.core.graph.content.Bounds in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method assertCoordinatesProperlyCalculatedAndMarshalled.
@SuppressWarnings("unchecked")
private static void assertCoordinatesProperlyCalculatedAndMarshalled(Diagram<Graph, Metadata> diagram, String marshalledDiagram, String elementId, Boolean isExpandedAttribute) {
Node<View<? extends Definition>, ?> node = diagram.getGraph().getNode(elementId);
Bounds nodeAbsoluteBounds = BasePropertyWriter.absoluteBounds(node);
float expectedX = Double.valueOf(nodeAbsoluteBounds.getX()).floatValue();
float expectedY = Double.valueOf(nodeAbsoluteBounds.getY()).floatValue();
float expectedWidth = nodeAbsoluteBounds.getLowerRight().getX().floatValue() - nodeAbsoluteBounds.getUpperLeft().getX().floatValue();
float expectedHeight = nodeAbsoluteBounds.getLowerRight().getY().floatValue() - nodeAbsoluteBounds.getUpperLeft().getY().floatValue();
assertContainsShape(marshalledDiagram, elementId, expectedX, expectedY, expectedWidth, expectedHeight, isExpandedAttribute);
}
use of org.kie.workbench.common.stunner.core.graph.content.Bounds in project kie-wb-common by kiegroup.
the class BasePropertyReaderTest method testBounds.
@Test
public void testBounds() {
Bounds bounds = tested.getBounds();
assertTrue(bounds.hasLowerRight());
assertTrue(bounds.hasUpperLeft());
assertEquals(0.7150000154972077d, bounds.getUpperLeft().getX(), 0d);
assertEquals(1.4300000309944154d, bounds.getUpperLeft().getY(), 0d);
assertEquals(65.71500001549721d, bounds.getLowerRight().getX(), 0d);
assertEquals(355.9010174870491d, bounds.getLowerRight().getY(), 0d);
}
use of org.kie.workbench.common.stunner.core.graph.content.Bounds in project kie-wb-common by kiegroup.
the class LanePropertyReaderTest method testGetBoundsWithParentLaneShape.
@Test
public void testGetBoundsWithParentLaneShape() {
LanePropertyReader propertyReader = new LanePropertyReader(lane, diagram, shape, parentLaneShape, RESOLUTION_FACTOR);
Bounds result = propertyReader.getBounds();
assertBounds(PARENT_X * RESOLUTION_FACTOR, Y * RESOLUTION_FACTOR, PARENT_X * RESOLUTION_FACTOR + PARENT_WIDTH * RESOLUTION_FACTOR, Y * RESOLUTION_FACTOR + HEIGHT * RESOLUTION_FACTOR, result);
}
Aggregations