@Test public void testOnShapeLocationsChanged() { when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(mock(CanvasHandler.class)); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, never()).rebuildBoundingBox(); verify(selectionManager, never()).drawSelectionShape(eq(MIN_WIDTH), eq(MIN_HEIGHT), eq(MAX_WIDTH), eq(MAX_HEIGHT), eq(overLayer)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); when(shapeLocationsChangedEvent.getUuids()).thenReturn(new ArrayList<>()); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, never()).rebuildBoundingBox(); verify(selectionManager, never()).drawSelectionShape(eq(MIN_WIDTH), eq(MIN_HEIGHT), eq(MAX_WIDTH), eq(MAX_HEIGHT), eq(overLayer)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); List<String> selectedUUIds = new ArrayList<>(); selectedUUIds.add("ELEMENT"); when(shapeLocationsChangedEvent.getUuids()).thenReturn(selectedUUIds); when(tested.getSelectedItems()).thenReturn(selectedUUIds); when(delegateShapeProvider.getShape()).thenReturn(mock(com.ait.lienzo.client.core.shape.Shape.class)); when(selectionManager.getSelectedItems()).thenReturn(selectedItems); when(selectedItems.getBoundingBox()).thenReturn(new BoundingBox(MIN_WIDTH, MIN_HEIGHT, MAX_WIDTH, MAX_HEIGHT)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, times(1)).rebuildBoundingBox(); verify(selectionManager, times(1)).drawSelectionShapeForSelection(); }
protected void onShapeLocationsChanged(@Observes ShapeLocationsChangedEvent event) { if (isSameCanvas(event.getCanvasHandler()) && areSelected(event.getUuids())) { rebuildSelectionArea(); } }
LienzoMultipleSelectionControl extends AbstractSelectionControl<H> { protected void onShapeLocationsChanged(@Observes ShapeLocationsChangedEvent event) { if (isSameCanvas(event.getCanvasHandler()) && areSelected(event.getUuids())) { rebuildSelectionArea(); } } }
LienzoMultipleSelectionControl extends AbstractSelectionControl<H> { protected void onShapeLocationsChanged(@Observes ShapeLocationsChangedEvent event) { if (isSameCanvas(event.getCanvasHandler()) && areSelected(event.getUuids())) { rebuildSelectionArea(); } } @Inject  LienzoMultipleSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                          final Event<CanvasClearSelectionEvent> clearSelectionEvent);   LienzoMultipleSelectionControl(final MapSelectionControl<H> selectionControl,
                                   final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                   final Event<CanvasClearSelectionEvent> clearSelectionEvent,
                                   final CursoredSelectionShapeProvider selectionShapeProvider); }
LienzoMultipleSelectionControl extends AbstractSelectionControl<H> { protected void onShapeLocationsChanged(@Observes ShapeLocationsChangedEvent event) { if (isSameCanvas(event.getCanvasHandler()) && areSelected(event.getUuids())) { rebuildSelectionArea(); } } @Inject  LienzoMultipleSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                          final Event<CanvasClearSelectionEvent> clearSelectionEvent);   LienzoMultipleSelectionControl(final MapSelectionControl<H> selectionControl,
                                   final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                   final Event<CanvasClearSelectionEvent> clearSelectionEvent,
                                   final CursoredSelectionShapeProvider selectionShapeProvider);  }
LienzoMultipleSelectionControl extends AbstractSelectionControl<H> { protected void onShapeLocationsChanged(@Observes ShapeLocationsChangedEvent event) { if (isSameCanvas(event.getCanvasHandler()) && areSelected(event.getUuids())) { rebuildSelectionArea(); } } @Inject  LienzoMultipleSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                          final Event<CanvasClearSelectionEvent> clearSelectionEvent);   LienzoMultipleSelectionControl(final MapSelectionControl<H> selectionControl,
                                   final Event<CanvasSelectionEvent> canvasSelectionEvent,
                                   final Event<CanvasClearSelectionEvent> clearSelectionEvent,
                                   final CursoredSelectionShapeProvider selectionShapeProvider);   }