@Override public final SelectionControl<H, Element> clearSelection() { selectionControl.clearSelection(); onClearSelection(); return this; }
private SelectionControl<H, Element> clearSelection(final boolean fireEvent) { deselect(getSelectedItems()); if (fireEvent) { fireCanvasClear(); } return this; }
@Override public final void register(final Element element) { selectionControl.register(element); onRegister(element); }
@Override public final void deregister(final Element element) { selectionControl.deregister(element); onDeregister(element); }
@Override public SelectionControl<H, Element> deselect(final String uuid) { selectionControl.deselect(uuid); return this; }
private static void clearSelection(final EditorSession session) { if (null != session.getSelectionControl()) { session.getSelectionControl().clearSelection(); } } }
@Override public void clear() { clearSelection(); }
@Override public void clear() { clearSelection(true); }
@Override public boolean isSelected(final Element element) { return selectionControl.isSelected(element); }
public static <H extends AbstractCanvasHandler> MapSelectionControl<H> build(final Consumer<CanvasSelectionEvent> selectionEventConsumer, final Consumer<CanvasClearSelectionEvent> clearSelectionEventConsumer) { return new MapSelectionControl<>(selectionEventConsumer, clearSelectionEventConsumer); }
protected void handleShapeRemovedEvent(final CanvasShapeRemovedEvent shapeRemovedEvent) { selectionControl.onShapeRemoved(shapeRemovedEvent); }
protected void handleCanvasClearSelectionEvent(final CanvasClearSelectionEvent event) { selectionControl.onCanvasClearSelection(event); }
@Override public Collection<String> getSelectedItems() { return selectionControl.getSelectedItems(); }
protected void handleCanvasElementSelectedEvent(final CanvasSelectionEvent event) { selectionControl.onCanvasElementSelected(event); }
@Inject public AbstractSelectionControl(final Event<CanvasSelectionEvent> canvasSelectionEvent, final Event<CanvasClearSelectionEvent> clearSelectionEvent) { this.canvasSelectionEvent = canvasSelectionEvent; this.canvasClearSelectionEvent = clearSelectionEvent; this.selectionControl = MapSelectionControl.build(this::fireSelectionEvent, this::fireClearSelectionEvent); }
private void onKeyDownEvent(final KeyboardEvent.Key... keys) { if (KeysMatcher.doKeysMatch(keys, KeyboardEvent.Key.ESC)) { clearSelection(); } }
@Override public SelectionControl<H, Element> clearSelection() { return clearSelection(true); }