private void detachDataProviderListener() { if (dataProviderUpdateRegistration != null) { dataProviderUpdateRegistration.remove(); dataProviderUpdateRegistration = null; } }
@Override public void remove() { super.remove(); // this handler can be removed from the grid and cannot be added to // another grid, thus enough to just remove the listener if (sortListenerRegistration != null) { sortListenerRegistration.remove(); sortListenerRegistration = null; } } }
/** * Removes this binding from its binder and unregisters the * {@code ValueChangeListener} from any bound {@code HasValue}. It does * nothing if it is called for an already unbound binding. * * @since 8.2 */ @Override public void unbind() { if (onValueChange != null) { onValueChange.remove(); onValueChange = null; } if (binder != null) { binder.removeBindingInternal(this); binder = null; } field = null; }
@Override public void setNavigator(Navigator navigator) { if (this.navigator == null && navigator != null) { uriFragmentRegistration = page.addUriFragmentChangedListener( event -> navigator.navigateTo(getState())); } else if (this.navigator != null && navigator == null) { uriFragmentRegistration.remove(); } this.navigator = navigator; }
listenerList.remove(listenerMethod); if (!hasListeners(eventType)) { registration.remove();
@Override public void setNavigator(Navigator navigator) { if (popStateListenerRegistration != null) { popStateListenerRegistration.remove(); popStateListenerRegistration = null; } if (navigator != null) { popStateListenerRegistration = ui.getPage().addPopStateListener( event -> navigator.navigateTo(getState())); } }
/** * Adds a context click listener that gets notified when a context click * happens. * * @param listener * the context click listener to add, not null actual event * provided to the listener is {@link TreeContextClickEvent} * @return a registration object for removing the listener * * @since 8.1 * @see #addItemClickListener * @see Registration */ @Override public Registration addContextClickListener( ContextClickEvent.ContextClickListener listener) { Registration registration = addListener(EventId.CONTEXT_CLICK, ContextClickEvent.class, listener, ContextClickEvent.CONTEXT_CLICK_METHOD); setupContextClickListener(); return () -> { registration.remove(); setupContextClickListener(); }; }
private void setupContextClickListener() { if (hasListeners(ContextClickEvent.class)) { if (contextClickRegistration == null) { contextClickRegistration = treeGrid .addContextClickListener(event -> { T item = null; if (event instanceof Grid.GridContextClickEvent) { item = ((Grid.GridContextClickEvent<T>) event) .getItem(); } fireEvent(new TreeContextClickEvent<>(this, event.getMouseEventDetails(), item)); }); } } else if (contextClickRegistration != null) { contextClickRegistration.remove(); contextClickRegistration = null; } }
getState(true).hasResizeListeners = true; return () -> { registration.remove(); getState(true).hasResizeListeners = hasEventRouter() && eventRouter.hasListeners(BrowserWindowResizeEvent.class);
internalSetDropMode(cachedDropMode); sortListenerRegistration.remove(); sortListenerRegistration = null; cachedDropMode = null;
public void disableSelectionListener() { registration.remove(); }
@Override protected void prepareViewing() { if (drawRegistration != null) { drawRegistration.remove(); drawRegistration = null; } if (clickRegistration != null) { clickRegistration.remove(); clickRegistration = null; } if (markerRegisration != null) { markerRegisration.remove(); markerRegisration = null; } }
valueChangeListenerRegistration.remove();
@Override public void setContextHelpIconClickHandler(Consumer<ContextHelpIconClickEvent> handler) { if (!Objects.equals(this.contextHelpIconClickHandler, handler)) { this.contextHelpIconClickHandler = handler; if (handler == null) { contextHelpIconClickListener.remove(); contextHelpIconClickListener = null; } else if (contextHelpIconClickListener == null) { contextHelpIconClickListener = ((AbstractComponent) getComposition()) .addContextHelpIconClickListener(this::onContextHelpIconClick); } } }
@Override public void removeColumnCollapsingChangeListener(Consumer<ColumnCollapsingChangeEvent> listener) { unsubscribe(ColumnCollapsingChangeEvent.class, listener); if (!hasSubscriptions(ColumnCollapsingChangeEvent.class) && columnCollapsingChangeListenerRegistration != null) { columnCollapsingChangeListenerRegistration.remove(); columnCollapsingChangeListenerRegistration = null; } }
@Override public void removeEditorPostCommitListener(Consumer<EditorPostCommitEvent> listener) { unsubscribe(EditorPostCommitEvent.class, listener); if (!hasSubscriptions(EditorPostCommitEvent.class)) { editorSaveListener.remove(); editorSaveListener = null; } }
@Override public void removeContextClickListener(Consumer<ContextClickEvent> listener) { unsubscribe(ContextClickEvent.class, listener); if (!hasSubscriptions(ContextClickEvent.class) && contextClickListenerRegistration != null) { contextClickListenerRegistration.remove(); contextClickListenerRegistration = null; } }
@Override public void removeEditorOpenListener(Consumer<EditorOpenEvent> listener) { unsubscribe(EditorOpenEvent.class, listener); if (!hasSubscriptions(EditorOpenEvent.class)) { editorOpenListener.remove(); editorOpenListener = null; } }
@Override public void removeEditorPreCommitListener(Consumer<EditorPreCommitEvent> listener) { unsubscribe(EditorPreCommitEvent.class, listener); if (!hasSubscriptions(EditorPreCommitEvent.class)) { editorBeforeSaveListener.remove(); editorBeforeSaveListener = null; } }