@Test public void test_canRemoveFormItemClickHandlerWithHandlerRegistration() { final FormItemClickHandler handler = mock(FormItemClickHandler.class); final HandlerRegistration registration = formItemIcon.addFormItemClickHandler(handler); registration.removeHandler(); assertFalse(formItemIcon.getFormItemClickHandlers().contains(handler)); }
@Override protected void onUnbind() { super.onUnbind(); if (handlerRegistration != null) { handlerRegistration.removeHandler(); } }
private void resetScrollHandler() { if (isPaused) { if (scrollHandler != null) scrollHandler.removeHandler(); scrollHandler = null; return; } else if (scrollHandler != null) { return; } scrollHandler = scroller.addScrollHandler( new ScrollHandler() { @Override public void onScroll(ScrollEvent event) { Scheduler.get() .scheduleDeferred( new ScheduledCommand() { @Override public void execute() { if (isPaused) return; int newPosition = scroller.getVerticalScrollPosition(); if (lastPosition > newPosition) { isTemplePaused = true; } else if (newPosition == scroller.getMaximumVerticalScrollPosition()) { isTemplePaused = false; } lastPosition = newPosition; } }); } }); }
@Override public void removeHandler() { for (com.google.web.bindery.event.shared.HandlerRegistration handlerRegistration : collectedHandlers) { handlerRegistration.removeHandler(); } collectedHandlers.clear(); }
/** Force the Tooltip to be destroyed */ public void destroy() { call(widget.getElement(), DESTROY); if (clickHandler != null) { clickHandler.removeHandler(); clickHandler = null; } }
@Override public void hide() { super.hide(); for (HandlerRegistration hr : handlerRegistrations) { hr.removeHandler(); } Window.enableScrolling(false); }
@Override public void setOnLeaveConfirmation(String question) { if (question == null && onLeaveQuestion == null) { return; } if (question != null && onLeaveQuestion == null) { windowClosingHandlerRegistration = Window.addWindowClosingHandler(this); } if (question == null && onLeaveQuestion != null) { windowClosingHandlerRegistration.removeHandler(); } onLeaveQuestion = question; }
protected void release() { if (updateEventHandlerRegistration != null) { updateEventHandlerRegistration.removeHandler(); updateEventHandlerRegistration = null; } // empty the searchResult to speed up the container.remove() if (searchResults != null) { searchResults.html(""); } // remove method clean listener and cie container.remove(); $selectElement.removeClass(css.chznDone(), "chzn-done").show(); }
@Override public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) { ComponentConnector oldChild = null; ComponentConnector newChild = getContent(); for (ComponentConnector c : event.getOldChildren()) { if (!(c instanceof WindowConnector)) { oldChild = c; break; } } if (oldChild != newChild) { if (childStateChangeHandlerRegistration != null) { childStateChangeHandlerRegistration.removeHandler(); childStateChangeHandlerRegistration = null; } if (newChild != null) { getWidget().setWidget(newChild.getWidget()); childStateChangeHandlerRegistration = newChild.addStateChangeHandler(childStateChangeHandler); // Must handle new child here as state change events are already // fired onChildSizeChange(); } else { getWidget().setWidget(null); } } for (ComponentConnector c : getChildComponents()) { if (c instanceof WindowConnector) { WindowConnector wc = (WindowConnector) c; wc.setWindowOrderAndPosition(); } } // Close removed sub windows for (ComponentConnector c : event.getOldChildren()) { if (c.getParent() != this && c instanceof WindowConnector) { ((WindowConnector) c).getWidget().hide(); } } }
private void updateHandlers(boolean activate) { if (activate) { final HandlerRegistration placeReg = eventBus.addHandler(PlaceChangeEvent.TYPE, this); final HandlerRegistration placeRequestReg = eventBus.addHandler(PlaceChangeRequestEvent.TYPE, this); this.handlerRegistration = new HandlerRegistration() { public void removeHandler() { placeReg.removeHandler(); placeRequestReg.removeHandler(); } }; } else { if (handlerRegistration != null) { handlerRegistration.removeHandler(); handlerRegistration = null; } } }
@Override protected void onUnload() { handler.removeHandler(); handler = null; }
@Override protected void onUnload() { for (HandlerRegistration r : registrations) r.removeHandler(); registrations.clear(); super.onUnload(); }
@Override protected void onHide() { super.onHide(); handlerRegistration.removeHandler(); }
private void cleanUpEvents() { for (HandlerRegistration hr : handlers) { hr.removeHandler(); } handlers.clear(); }
private void unregisterNavigationHandler() { if (handlerRegistration != null) { handlerRegistration.removeHandler(); handlerRegistration = null; } }