use of org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl in project kie-wb-common by kiegroup.
the class UpdateElementPositionCommandTest method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
super.setUp();
when(candidate.getUUID()).thenReturn("uuid1");
when(candidate.getContent()).thenReturn(content);
when(content.getBounds()).thenReturn(new BoundsImpl(new BoundImpl(3d, 27d), new BoundImpl(50d, 50d)));
this.tested = new UpdateElementPositionCommand(candidate, new Point2D(100d, 200d));
}
use of org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl in project kie-wb-common by kiegroup.
the class TestingGraphMockHandler method newViewNode.
public Node newViewNode(String uuid, Optional<Object> def, final double x, final double y, final double w, final double h) {
final Object definition = def.isPresent() ? def.get() : newDef("def-" + uuid, Optional.empty());
when(definitionUtils.buildBounds(eq(definition), anyDouble(), anyDouble())).thenReturn(new BoundsImpl(new BoundImpl(x, y), new BoundImpl(x + w, y + h)));
final Node<Definition<Object>, Edge> result = nodeFactory.build(uuid, definition);
execute(commandFactory.addNode(result));
when(graphIndex.getNode(eq(uuid))).thenReturn(result);
when(graphIndex.get(eq(uuid))).thenReturn(result);
return result;
}
use of org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl in project kie-wb-common by kiegroup.
the class DMNCommonActionsToolboxFactoryTest method testBuildToolboxForDecisionType.
@Test
@SuppressWarnings("unchecked")
public void testBuildToolboxForDecisionType() {
final Node<View<Decision>, Edge> decisionNode = new NodeImpl<>("decisionNode1");
final Decision decision = new Decision();
final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
final View<Decision> nodeContent = new ViewImpl<>(decision, bounds);
decisionNode.setContent(nodeContent);
final Optional<Toolbox<?>> _toolbox = tested.build(canvasHandler, decisionNode);
assertTrue(_toolbox.isPresent());
Toolbox<?> toolbox = _toolbox.get();
assertTrue(toolbox instanceof ActionsToolbox);
final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox;
assertEquals("decisionNode1", actionsToolbox.getElementUUID());
assertEquals(2, actionsToolbox.size());
final Iterator<ToolboxAction> actionsIt = actionsToolbox.iterator();
assertEquals(deleteNodeAction, actionsIt.next());
assertEquals(editDecisionToolboxAction, actionsIt.next());
assertFalse(actionsIt.hasNext());
verify(view, times(1)).init(eq(actionsToolbox));
verify(view, times(2)).addButton(any(Glyph.class), anyString(), any(Consumer.class));
}
use of org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl in project kie-wb-common by kiegroup.
the class DMNEditDecisionToolboxActionTest method setup.
@Before
public void setup() throws Exception {
decisionNode = new NodeImpl<>(E_UUID);
decision = new Decision();
final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
final View<Decision> nodeContent = new ViewImpl<>(decision, bounds);
decisionNode.setContent(nodeContent);
when(canvasHandler.getGraphIndex()).thenReturn(graphIndex);
when(graphIndex.get(eq(E_UUID))).thenReturn(decisionNode);
when(sessionManager.getCurrentSession()).thenReturn(session);
this.tested = new DMNEditDecisionToolboxAction(sessionManager, translationService, editExpressionEvent);
}
use of org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl in project kie-wb-common by kiegroup.
the class DMNMarshaller method internalAugment.
private void internalAugment(Stream<DMNShape> drgShapeStream, Id id, Bound ul, RectangleDimensionsSet dimensionsSet, Bound lr, BackgroundSet bgset, Consumer<FontSet> fontSetSetter) {
Optional<DMNShape> drgShapeOpt = drgShapeStream.filter(shape -> shape.getDmnElementRef().equals(id.getValue())).findFirst();
if (!drgShapeOpt.isPresent()) {
return;
}
DMNShape drgShape = drgShapeOpt.get();
((BoundImpl) ul).setX(drgShape.getBounds().getX());
((BoundImpl) ul).setY(drgShape.getBounds().getY());
dimensionsSet.setWidth(new Width(drgShape.getBounds().getWidth()));
dimensionsSet.setHeight(new Height(drgShape.getBounds().getHeight()));
((BoundImpl) lr).setX(drgShape.getBounds().getX() + drgShape.getBounds().getWidth());
((BoundImpl) lr).setY(drgShape.getBounds().getY() + drgShape.getBounds().getHeight());
if (null != drgShape.getBgColor()) {
bgset.setBgColour(new BgColour(ColorUtils.wbFromDMN(drgShape.getBgColor())));
}
if (null != drgShape.getBorderColor()) {
bgset.setBorderColour(new BorderColour(ColorUtils.wbFromDMN(drgShape.getBorderColor())));
}
if (null != drgShape.getBorderSize()) {
bgset.setBorderSize(new BorderSize(drgShape.getBorderSize().getValue()));
}
if (null != drgShape.getFontStyle()) {
fontSetSetter.accept(FontSetPropertyConverter.wbFromDMN(drgShape.getFontStyle()));
}
}
Aggregations