@Test public void testSelect() { tested.init(canvasHandler); tested.register(element); tested.select(element.getUUID()); assertEquals(1, tested.getSelectedItems().size()); assertEquals(ELEMENT_UUID, tested.getSelectedItems().iterator().next()); verify(shape, times(1)).applyState(eq(ShapeState.SELECTED)); verify(shape, never()).applyState(eq(ShapeState.NONE)); verify(shape, never()).applyState(eq(ShapeState.INVALID)); verify(shape, never()).applyState(eq(ShapeState.HIGHLIGHT)); verify(canvas, times(1)).focus(); final ArgumentCaptor<CanvasSelectionEvent> elementSelectedEventArgumentCaptor = ArgumentCaptor.forClass(CanvasSelectionEvent.class); verify(elementSelectedEvent, times(1)).fire(elementSelectedEventArgumentCaptor.capture()); final CanvasSelectionEvent event = elementSelectedEventArgumentCaptor.getValue(); assertEquals(1, event.getIdentifiers().size()); assertEquals(ELEMENT_UUID, event.getIdentifiers().iterator().next()); }
@Override public SelectionControl<H, Element> select(final String uuid) { return select(Collections.singletonList(uuid)); }
MapSelectionControl extends AbstractCanvasHandlerControl<H> implements SelectionControl<H, Element>,
                   CanvasRegistrationControl<H, Element> { @Override public SelectionControl<H, Element> select(final String uuid) { return select(Collections.singletonList(uuid)); } }
MapSelectionControl extends AbstractCanvasHandlerControl<H> implements SelectionControl<H, Element>,
                   CanvasRegistrationControl<H, Element> { @Override public SelectionControl<H, Element> select(final String uuid) { return select(Collections.singletonList(uuid)); } MapSelectionControl(final Consumer<CanvasSelectionEvent> selectionEventConsumer,
                        final Consumer<CanvasClearSelectionEvent> clearSelectionEventConsumer); }
MapSelectionControl extends AbstractCanvasHandlerControl<H> implements SelectionControl<H, Element>,
                   CanvasRegistrationControl<H, Element> { @Override public SelectionControl<H, Element> select(final String uuid) { return select(Collections.singletonList(uuid)); } MapSelectionControl(final Consumer<CanvasSelectionEvent> selectionEventConsumer,
                        final Consumer<CanvasClearSelectionEvent> clearSelectionEventConsumer); static MapSelectionControl<H> build(final Consumer<CanvasSelectionEvent> selectionEventConsumer,
                                                                                 final Consumer<CanvasClearSelectionEvent> clearSelectionEventConsumer); @Override void clear(); @Override void register(final Element element); @Override void deregister(final Element element); @Override SelectionControl<H, Element> select(final String uuid); @Override SelectionControl<H, Element> deselect(final String uuid); @Override boolean isSelected(final Element element); @Override Collection<String> getSelectedItems(); @Override SelectionControl<H, Element> clearSelection(); @Override Optional<Object> getSelectedItemDefinition(); boolean isReadonly(); void setReadonly(boolean readonly); SelectionControl<H, Element> select(final Collection<String> uuids); SelectionControl<H, Element> deselect(final Collection<String> uuids); boolean isSelected(final String uuid); void onShapeRemoved(final CanvasShapeRemovedEvent shapeRemovedEvent); void onCanvasElementSelected(final CanvasSelectionEvent event); void onCanvasClearSelection(final CanvasClearSelectionEvent event); AbstractCanvasHandler getCanvasHandler(); Predicate<String> itemsRegistered(); AbstractCanvas getCanvas(); }
MapSelectionControl extends AbstractCanvasHandlerControl<H> implements SelectionControl<H, Element>,
                   CanvasRegistrationControl<H, Element> { @Override public SelectionControl<H, Element> select(final String uuid) { return select(Collections.singletonList(uuid)); } MapSelectionControl(final Consumer<CanvasSelectionEvent> selectionEventConsumer,
                        final Consumer<CanvasClearSelectionEvent> clearSelectionEventConsumer); static MapSelectionControl<H> build(final Consumer<CanvasSelectionEvent> selectionEventConsumer,
                                                                                 final Consumer<CanvasClearSelectionEvent> clearSelectionEventConsumer); @Override void clear(); @Override void register(final Element element); @Override void deregister(final Element element); @Override SelectionControl<H, Element> select(final String uuid); @Override SelectionControl<H, Element> deselect(final String uuid); @Override boolean isSelected(final Element element); @Override Collection<String> getSelectedItems(); @Override SelectionControl<H, Element> clearSelection(); @Override Optional<Object> getSelectedItemDefinition(); boolean isReadonly(); void setReadonly(boolean readonly); SelectionControl<H, Element> select(final Collection<String> uuids); SelectionControl<H, Element> deselect(final Collection<String> uuids); boolean isSelected(final String uuid); void onShapeRemoved(final CanvasShapeRemovedEvent shapeRemovedEvent); void onCanvasElementSelected(final CanvasSelectionEvent event); void onCanvasClearSelection(final CanvasClearSelectionEvent event); AbstractCanvasHandler getCanvasHandler(); Predicate<String> itemsRegistered(); AbstractCanvas getCanvas();  }