@Test @SuppressWarnings("unchecked") public void testDeregisterElement() { tested.init(canvasHandler); tested.register(element); tested.deregister(element); verify(shapeEventHandler, times(1)).removeHandler(any(ViewHandler.class)); assertFalse(tested.isRegistered(element)); }
@Override @SuppressWarnings("unchecked") public void register(final Element element) { if (checkNotRegistered(element) && supportsToolbox(element)) { final Shape shape = canvasHandler.getCanvas().getShape(element.getUUID()); final HasEventHandlers hasEventHandlers = (HasEventHandlers) shape.getShapeView(); if (hasEventHandlers.supports(ViewEventType.MOUSE_CLICK)) { final MouseClickHandler clickHandler = new MouseClickHandler() { @Override public void handle(final MouseClickEvent event) { if (event.isButtonLeft()) { show(element); } } }; hasEventHandlers.addHandler(ViewEventType.MOUSE_CLICK, clickHandler); registerHandler(element.getUUID(), clickHandler); } } }
ToolboxControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ToolboxControl<AbstractCanvasHandler, Element> { @Override @SuppressWarnings("unchecked") public void register(final Element element) { if (checkNotRegistered(element) && supportsToolbox(element)) { final Shape shape = canvasHandler.getCanvas().getShape(element.getUUID()); final HasEventHandlers hasEventHandlers = (HasEventHandlers) shape.getShapeView(); if (hasEventHandlers.supports(ViewEventType.MOUSE_CLICK)) { final MouseClickHandler clickHandler = new MouseClickHandler() { @Override public void handle(final MouseClickEvent event) { if (event.isButtonLeft()) { show(element); } } }; hasEventHandlers.addHandler(ViewEventType.MOUSE_CLICK, clickHandler); registerHandler(element.getUUID(), clickHandler); } } } }
ToolboxControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ToolboxControl<AbstractCanvasHandler, Element> { @Override @SuppressWarnings("unchecked") public void register(final Element element) { if (checkNotRegistered(element) && supportsToolbox(element)) { final Shape shape = canvasHandler.getCanvas().getShape(element.getUUID()); final HasEventHandlers hasEventHandlers = (HasEventHandlers) shape.getShapeView(); if (hasEventHandlers.supports(ViewEventType.MOUSE_CLICK)) { final MouseClickHandler clickHandler = new MouseClickHandler() { @Override public void handle(final MouseClickEvent event) { if (event.isButtonLeft()) { show(element); } } }; hasEventHandlers.addHandler(ViewEventType.MOUSE_CLICK, clickHandler); registerHandler(element.getUUID(), clickHandler); } } } ToolboxControlImpl(final Supplier<List<F>> toolboxFactories);   ToolboxControlImpl(final Supplier<List<F>> toolboxFactories,
                       final Predicate<String> showToolboxPredicate); }
ToolboxControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ToolboxControl<AbstractCanvasHandler, Element> { @Override @SuppressWarnings("unchecked") public void register(final Element element) { if (checkNotRegistered(element) && supportsToolbox(element)) { final Shape shape = canvasHandler.getCanvas().getShape(element.getUUID()); final HasEventHandlers hasEventHandlers = (HasEventHandlers) shape.getShapeView(); if (hasEventHandlers.supports(ViewEventType.MOUSE_CLICK)) { final MouseClickHandler clickHandler = new MouseClickHandler() { @Override public void handle(final MouseClickEvent event) { if (event.isButtonLeft()) { show(element); } } }; hasEventHandlers.addHandler(ViewEventType.MOUSE_CLICK, clickHandler); registerHandler(element.getUUID(), clickHandler); } } } ToolboxControlImpl(final Supplier<List<F>> toolboxFactories);   ToolboxControlImpl(final Supplier<List<F>> toolboxFactories,
                       final Predicate<String> showToolboxPredicate); @Override @SuppressWarnings("unchecked") void register(final Element element); @Override Iterator<Toolbox<?>> getToolboxes(final Element element); void destroyToolboxes(); void hideAndDestroyToolboxes(); @SuppressWarnings("unchecked") ToolboxControl<AbstractCanvasHandler, Element> show(final String uuid); ToolboxControl<AbstractCanvasHandler, Element> show(final Element element); AbstractCanvasHandler getCanvasHandler(); boolean isActive(final String uuid); }
ToolboxControlImpl extends AbstractCanvasHandlerRegistrationControl<AbstractCanvasHandler> implements ToolboxControl<AbstractCanvasHandler, Element> { @Override @SuppressWarnings("unchecked") public void register(final Element element) { if (checkNotRegistered(element) && supportsToolbox(element)) { final Shape shape = canvasHandler.getCanvas().getShape(element.getUUID()); final HasEventHandlers hasEventHandlers = (HasEventHandlers) shape.getShapeView(); if (hasEventHandlers.supports(ViewEventType.MOUSE_CLICK)) { final MouseClickHandler clickHandler = new MouseClickHandler() { @Override public void handle(final MouseClickEvent event) { if (event.isButtonLeft()) { show(element); } } }; hasEventHandlers.addHandler(ViewEventType.MOUSE_CLICK, clickHandler); registerHandler(element.getUUID(), clickHandler); } } } ToolboxControlImpl(final Supplier<List<F>> toolboxFactories);   ToolboxControlImpl(final Supplier<List<F>> toolboxFactories,
                       final Predicate<String> showToolboxPredicate); @Override @SuppressWarnings("unchecked") void register(final Element element); @Override Iterator<Toolbox<?>> getToolboxes(final Element element); void destroyToolboxes(); void hideAndDestroyToolboxes(); @SuppressWarnings("unchecked") ToolboxControl<AbstractCanvasHandler, Element> show(final String uuid); ToolboxControl<AbstractCanvasHandler, Element> show(final Element element); AbstractCanvasHandler getCanvasHandler(); boolean isActive(final String uuid); static final Predicate<String> ALWAYS_SHOW_PREDICATE; }