@Test public void testOnSelectEvent() { final SelectionManager.SelectedItems selectedItems = mock(SelectionManager.SelectedItems.class); when(selectionManager.getSelectedItems()).thenReturn(selectedItems); tested.init(canvasHandler); tested.register(element); tested.onSelect(Collections.singletonList(ELEMENT_UUID)); verify(selectedItems, times(1)).add(eq(shapeView)); verify(selectionControl, never()).clearSelection(); }
@Override protected void onSelect(final Collection<String> uuids) { super.onSelect(uuids); final Collection<ShapeView> shapeViews = uuids.stream() .map(uuid -> getCanvasHandler().getCanvas().getShape(uuid)) .filter(Objects::nonNull) .map(org.kie.workbench.common.stunner.core.client.shape.Shape::getShapeView) .collect(Collectors.toList()); shapeViews.stream() .filter(view -> view instanceof WiresShapeView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresShape) view)); shapeViews.stream() .filter(view -> view instanceof WiresConnectorView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresConnector) view)); }
LienzoMultipleSelectionControl extends AbstractSelectionControl<H> { @Override protected void onSelect(final Collection<String> uuids) { super.onSelect(uuids); final Collection<ShapeView> shapeViews = uuids.stream() .map(uuid -> getCanvasHandler().getCanvas().getShape(uuid)) .filter(Objects::nonNull) .map(org.kie.workbench.common.stunner.core.client.shape.Shape::getShapeView) .collect(Collectors.toList()); shapeViews.stream() .filter(view -> view instanceof WiresShapeView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresShape) view)); shapeViews.stream() .filter(view -> view instanceof WiresConnectorView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresConnector) view)); } }
LienzoMultipleSelectionControl extends AbstractSelectionControl<H> { @Override protected void onSelect(final Collection<String> uuids) { super.onSelect(uuids); final Collection<ShapeView> shapeViews = uuids.stream() .map(uuid -> getCanvasHandler().getCanvas().getShape(uuid)) .filter(Objects::nonNull) .map(org.kie.workbench.common.stunner.core.client.shape.Shape::getShapeView) .collect(Collectors.toList()); shapeViews.stream() .filter(view -> view instanceof WiresShapeView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresShape) view)); shapeViews.stream() .filter(view -> view instanceof WiresConnectorView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresConnector) view)); } @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> { @Override protected void onSelect(final Collection<String> uuids) { super.onSelect(uuids); final Collection<ShapeView> shapeViews = uuids.stream() .map(uuid -> getCanvasHandler().getCanvas().getShape(uuid)) .filter(Objects::nonNull) .map(org.kie.workbench.common.stunner.core.client.shape.Shape::getShapeView) .collect(Collectors.toList()); shapeViews.stream() .filter(view -> view instanceof WiresShapeView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresShape) view)); shapeViews.stream() .filter(view -> view instanceof WiresConnectorView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresConnector) view)); } @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> { @Override protected void onSelect(final Collection<String> uuids) { super.onSelect(uuids); final Collection<ShapeView> shapeViews = uuids.stream() .map(uuid -> getCanvasHandler().getCanvas().getShape(uuid)) .filter(Objects::nonNull) .map(org.kie.workbench.common.stunner.core.client.shape.Shape::getShapeView) .collect(Collectors.toList()); shapeViews.stream() .filter(view -> view instanceof WiresShapeView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresShape) view)); shapeViews.stream() .filter(view -> view instanceof WiresConnectorView) .forEach(view -> getSelectionManager().getSelectedItems().add((WiresConnector) view)); } @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);   }