@Test @SuppressWarnings("unchecked") public void testClearShapes() throws Exception { tested.shapes.put(parentShape.getUUID(), parentShape); tested.shapes.put(childShape.getUUID(), childShape); tested.clearShapes(); verify(canvasView, times(1)).delete(eq(parentShapeView)); verify(canvasView, times(1)).delete(eq(childShapeView)); assertTrue(tested.getShapes().isEmpty()); }
protected void clearShapes() { if (!shapes.isEmpty()) { shapes.values().stream().collect(Collectors.toList()).forEach(this::deleteShape); shapes.clear(); } }
AbstractCanvas implements Canvas<Shape>,
                   HasEventHandlers<AbstractCanvas<V>, Shape<?>>,
                   HasCanvasListeners<CanvasShapeListener> { protected void clearShapes() { if (!shapes.isEmpty()) { shapes.values().stream().collect(Collectors.toList()).forEach(this::deleteShape); shapes.clear(); } } }
AbstractCanvas implements Canvas<Shape>,
                   HasEventHandlers<AbstractCanvas<V>, Shape<?>>,
                   HasCanvasListeners<CanvasShapeListener> { protected void clearShapes() { if (!shapes.isEmpty()) { shapes.values().stream().collect(Collectors.toList()).forEach(this::deleteShape); shapes.clear(); } } protected  AbstractCanvas(final Event<CanvasClearEvent> canvasClearEvent,
                             final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
                             final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
                             final Event<CanvasDrawnEvent> canvasDrawnEvent,
                             final Event<CanvasFocusedEvent> canvasFocusedEvent); }
AbstractCanvas implements Canvas<Shape>,
                   HasEventHandlers<AbstractCanvas<V>, Shape<?>>,
                   HasCanvasListeners<CanvasShapeListener> { protected void clearShapes() { if (!shapes.isEmpty()) { shapes.values().stream().collect(Collectors.toList()).forEach(this::deleteShape); shapes.clear(); } } protected  AbstractCanvas(final Event<CanvasClearEvent> canvasClearEvent,
                             final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
                             final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
                             final Event<CanvasDrawnEvent> canvasDrawnEvent,
                             final Event<CanvasFocusedEvent> canvasFocusedEvent); abstract V getView(); AbstractCanvas<V> initialize(final CanvasPanel panel,
                                        final CanvasSettings settings); @Override Collection<Shape> getShapes(); Shape getShape(final String uuid); @SuppressWarnings("unchecked") Canvas addChild(final Shape parent,
                           final Shape child); @SuppressWarnings("unchecked") Canvas deleteChild(final Shape parent,
                              final Shape child); @SuppressWarnings("unchecked") Canvas dock(final Shape parent,
                       final Shape child); @SuppressWarnings("unchecked") Canvas undock(final Shape target,
                         final Shape child); @Override Canvas addShape(final Shape shape); @Override Canvas deleteShape(final Shape shape); @SuppressWarnings("unchecked") Canvas addShapeIntoView(final Shape shape); @SuppressWarnings("unchecked") Canvas deleteShapeFromView(final Shape shape); AbstractCanvas clear(); Canvas setGrid(final CanvasGrid grid); CanvasGrid getGrid(); Point2D getAbsoluteLocation(); @Override Transform getTransform(); @Override void destroy(); @Override HasCanvasListeners<CanvasShapeListener> addRegistrationListener(final CanvasShapeListener instance); @Override HasCanvasListeners<CanvasShapeListener> removeRegistrationListener(final CanvasShapeListener instance); @Override HasCanvasListeners<CanvasShapeListener> clearRegistrationListeners(); @Override int getWidthPx(); @Override int getHeightPx(); @Override boolean equals(final Object o); @Override int hashCode(); }
AbstractCanvas implements Canvas<Shape>,
                   HasEventHandlers<AbstractCanvas<V>, Shape<?>>,
                   HasCanvasListeners<CanvasShapeListener> { protected void clearShapes() { if (!shapes.isEmpty()) { shapes.values().stream().collect(Collectors.toList()).forEach(this::deleteShape); shapes.clear(); } } protected  AbstractCanvas(final Event<CanvasClearEvent> canvasClearEvent,
                             final Event<CanvasShapeAddedEvent> canvasShapeAddedEvent,
                             final Event<CanvasShapeRemovedEvent> canvasShapeRemovedEvent,
                             final Event<CanvasDrawnEvent> canvasDrawnEvent,
                             final Event<CanvasFocusedEvent> canvasFocusedEvent); abstract V getView(); AbstractCanvas<V> initialize(final CanvasPanel panel,
                                        final CanvasSettings settings); @Override Collection<Shape> getShapes(); Shape getShape(final String uuid); @SuppressWarnings("unchecked") Canvas addChild(final Shape parent,
                           final Shape child); @SuppressWarnings("unchecked") Canvas deleteChild(final Shape parent,
                              final Shape child); @SuppressWarnings("unchecked") Canvas dock(final Shape parent,
                       final Shape child); @SuppressWarnings("unchecked") Canvas undock(final Shape target,
                         final Shape child); @Override Canvas addShape(final Shape shape); @Override Canvas deleteShape(final Shape shape); @SuppressWarnings("unchecked") Canvas addShapeIntoView(final Shape shape); @SuppressWarnings("unchecked") Canvas deleteShapeFromView(final Shape shape); AbstractCanvas clear(); Canvas setGrid(final CanvasGrid grid); CanvasGrid getGrid(); Point2D getAbsoluteLocation(); @Override Transform getTransform(); @Override void destroy(); @Override HasCanvasListeners<CanvasShapeListener> addRegistrationListener(final CanvasShapeListener instance); @Override HasCanvasListeners<CanvasShapeListener> removeRegistrationListener(final CanvasShapeListener instance); @Override HasCanvasListeners<CanvasShapeListener> clearRegistrationListeners(); @Override int getWidthPx(); @Override int getHeightPx(); @Override boolean equals(final Object o); @Override int hashCode();  }