@Test public void testStunnerControlPointsAcceptorAdd() { final HandlerRegistration mouseUpHandlerRegistration = mock(HandlerRegistration.class); final NodeMouseUpHandler[] mouseUpHandlerCaptured = new NodeMouseUpHandler[1]; doAnswer(invocationOnMock -> { mouseUpHandlerCaptured[0] = (NodeMouseUpHandler) invocationOnMock.getArguments()[0]; mouseUpHandlerCaptured[0].onNodeMouseUp(mock(NodeMouseUpEvent.class)); return mouseUpHandlerRegistration; }).when(layer).addNodeMouseUpHandler(any(NodeMouseUpHandler.class)); ControlPointControl control = mock(ControlPointControl.class); ControlPointControlImpl.StunnerControlPointsAcceptor acceptor = createStunnerControlPointsAcceptor(control); boolean addResult = acceptor.add(connector, 1, new com.ait.lienzo.client.core.types.Point2D(2, 2)); assertTrue(addResult); verify(connector, times(1)).addControlPoint(eq(2d), eq(2d), eq(1)); verify(control, times(1)).addControlPoint(eq(edge), eq(ControlPoint.build(2, 2)), eq(0)); }
@Override public void addControlPoint(final Edge candidate, final ControlPoint controlPoint, final int index) { selectionEvent.fire(new CanvasSelectionEvent(canvasHandler, candidate.getUUID())); execute(canvasCommandFactory.addControlPoint(candidate, controlPoint, index)); }
ControlPointControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ControlPointControl<AbstractCanvasHandler> { @Override public void addControlPoint(final Edge candidate, final ControlPoint controlPoint, final int index) { selectionEvent.fire(new CanvasSelectionEvent(canvasHandler, candidate.getUUID())); execute(canvasCommandFactory.addControlPoint(candidate, controlPoint, index)); } }
ControlPointControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ControlPointControl<AbstractCanvasHandler> { @Override public void addControlPoint(final Edge candidate, final ControlPoint controlPoint, final int index) { selectionEvent.fire(new CanvasSelectionEvent(canvasHandler, candidate.getUUID())); execute(canvasCommandFactory.addControlPoint(candidate, controlPoint, index)); } @Inject  ControlPointControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
                                   final Event<CanvasSelectionEvent> selectionEvent); }
ControlPointControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ControlPointControl<AbstractCanvasHandler> { @Override public void addControlPoint(final Edge candidate, final ControlPoint controlPoint, final int index) { selectionEvent.fire(new CanvasSelectionEvent(canvasHandler, candidate.getUUID())); execute(canvasCommandFactory.addControlPoint(candidate, controlPoint, index)); } @Inject  ControlPointControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
                                   final Event<CanvasSelectionEvent> selectionEvent); @Override void register(final Element element); @Override void addControlPoint(final Edge candidate,
                                final ControlPoint controlPoint,
                                final int index); @Override void updateControlPoints(final Edge candidate,
                                    final ControlPoint[] controlPoints); @Override void deleteControlPoint(final Edge candidate,
                                   final int index); @Override void setCommandManagerProvider(final CommandManagerProvider<AbstractCanvasHandler> provider); }
ControlPointControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ControlPointControl<AbstractCanvasHandler> { @Override public void addControlPoint(final Edge candidate, final ControlPoint controlPoint, final int index) { selectionEvent.fire(new CanvasSelectionEvent(canvasHandler, candidate.getUUID())); execute(canvasCommandFactory.addControlPoint(candidate, controlPoint, index)); } @Inject  ControlPointControlImpl(final CanvasCommandFactory<AbstractCanvasHandler> canvasCommandFactory,
                                   final Event<CanvasSelectionEvent> selectionEvent); @Override void register(final Element element); @Override void addControlPoint(final Edge candidate,
                                final ControlPoint controlPoint,
                                final int index); @Override void updateControlPoints(final Edge candidate,
                                    final ControlPoint[] controlPoints); @Override void deleteControlPoint(final Edge candidate,
                                   final int index); @Override void setCommandManagerProvider(final CommandManagerProvider<AbstractCanvasHandler> provider);  }