Java Code Examples for com.google.gwt.event.shared.HandlerRegistration#removeHandler()

The following examples show how to use com.google.gwt.event.shared.HandlerRegistration#removeHandler() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DateCellDayItem.java    From calendar-component with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDetach() {
    for (HandlerRegistration handler : handlers) {
        handler.removeHandler();
    }
    handlers.clear();
    super.onDetach();
}
 
Example 2
Source File: DateCell.java    From calendar-component with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDetach() {
    for (HandlerRegistration handler : handlers) {
        handler.removeHandler();
    }
    handlers.clear();

    super.onDetach();
}
 
Example 3
Source File: VLayoutDragDropMouseHandler.java    From cuba with Apache License 2.0 5 votes vote down vote up
/**
 * Stop listening to events
 */
private void detach() {
    for (HandlerRegistration reg : handlers) {
        reg.removeHandler();
    }
    handlers.clear();
}
 
Example 4
Source File: MaterialDropDown.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
@Override
public void unload() {
    for (HandlerRegistration handler : handlers) {
        handler.removeHandler();
    }

    // Hook for materialize bug on dropdown for not having closed once detach
    if (getElement() != null && isAttached()) {
        getElement().getStyle().setDisplay(Style.Display.NONE);
    }
    $(activatorElement).dropdown("remove");
}
 
Example 5
Source File: PluggableMap.java    From gwt-ol with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a map move listener for the given map.
 *
 * @param listener listener
 * @return handler registration
 */
@JsOverlay
public final HandlerRegistration addMapMoveListener(final EventListener<MapEvent> listener) {

    final HandlerRegistration handlerMap = OLUtil.observe(this, "moveend", listener);

    View view = getView();

    if (view == null)
        return handlerMap;

    // if we have a view, fire events while the map is moving
    // try to set up an event handler for the change of the view center
    // as "moveend" will be only fired when the map stops moving

    final HandlerRegistration handlerView = OLUtil.observe(view, "change:center", event -> {
        // create an artificial move event
        ol.events.Event e2 = OLUtil.createLinkedEvent(event, "move", PluggableMap.this);
        MapEvent mapEvent = OLUtil.initMapEvent(e2, PluggableMap.this);
        listener.onEvent(mapEvent);
    });

    // return a handler registration, which detaches both event handlers
    return () -> {
        handlerMap.removeHandler();
        handlerView.removeHandler();
    };

}
 
Example 6
Source File: GwtSynchronizers.java    From mapper with Apache License 2.0 5 votes vote down vote up
public static Synchronizer forRegistration(final HandlerRegistration r) {
  return new Synchronizer() {
    @Override
    public void attach(SynchronizerContext ctx) {
    }

    @Override
    public void detach() {
      r.removeHandler();
    }
  };
}
 
Example 7
Source File: SvgElementMapper.java    From jetpad-projectional-open-source with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDetach() {
  super.onDetach();
  if (myHandlerRegs != null) {
    for (HandlerRegistration registration : myHandlerRegs.values()) {
      registration.removeHandler();
    }
    myHandlerRegs.clear();
  }
}
 
Example 8
Source File: HTML5Support.java    From cuba with Apache License 2.0 4 votes vote down vote up
public void disable() {
    for (HandlerRegistration handlerRegistration : handlers) {
        handlerRegistration.removeHandler();
    }
    handlers.clear();
}
 
Example 9
Source File: DefaultHandlerRegistry.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
@Override
public void removeHandler(HandlerRegistration registration) {
    if (registration != null) {
        registration.removeHandler();
    }
}
 
Example 10
Source File: TimeGrid.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void destroy() {
	iMeetingClickHandlers.clear();
	for (HandlerRegistration reg: iHandlerRegistrations)
		reg.removeHandler();
}