com.google.web.bindery.event.shared.HandlerRegistration Java Examples

The following examples show how to use com.google.web.bindery.event.shared.HandlerRegistration. 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: InputBoolean.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public HandlerRegistration addDirtyHandler(Handler handler) {
	if (this.clickHandlerRegistration == null) {
		this.clickHandlerRegistration = this.addDomHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				if (!InputBoolean.this.eventTargetsLabelOrChild(event)) {
					InputBoolean.this.setInputValue(!InputBoolean.this.getInputValue());
				}
				DirtyEvent.fire(InputBoolean.this);
				ValueChangeEvent.fire(InputBoolean.this, InputBoolean.this.getInputValue());
			}
		}, ClickEvent.getType());
	}
	return super.addDirtyHandler(handler);
}
 
Example #2
Source File: AbstractEventBinder.java    From gwteventbinder with Apache License 2.0 5 votes vote down vote up
@Override
public final HandlerRegistration bindEventHandlers(T target, EventBus eventBus) {
  final List<HandlerRegistration> registrations = doBindEventHandlers(target, eventBus);
  return new HandlerRegistration() {
    @Override
    public void removeHandler() {
      for (HandlerRegistration registration : registrations) {
        registration.removeHandler();
      }
      registrations.clear();
    }
  };
}
 
Example #3
Source File: DefaultDirtyValidator.java    From gwt-material with Apache License 2.0 5 votes vote down vote up
@Override
public void setAllowDirtyValidation(boolean allowDirty) {
    this.allowDirty = allowDirty;

    if (allowDirty) {
        registrations = new ArrayList<>();
        detectDirtyFields(content);
    } else {
        if (registrations != null) {
            registrations.clear();
            registrations.forEach(HandlerRegistration::removeHandler);
            setDirty(false);
        }
    }
}
 
Example #4
Source File: InputCode.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public HandlerRegistration addDirtyHandler(Handler handler) {
	if (this.valueChangeRegistration == null) {
		// Hook to prevent blur on click on suggestion popup
		this.valueChangeRegistration = this.codeInput.addValueChangeHandler(new ChangeEvent<String>(InputCode.this));
	}
	return super.addDirtyHandler(handler);
}
 
Example #5
Source File: AbstractInputChoice.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public HandlerRegistration addDirtyHandler(Handler handler) {
	if (this.valueChangeRegistration == null) {
		this.valueChangeRegistration = this.addValueChangeHandler(new ChangeEvent<U>(AbstractInputChoice.this));
	}
	return super.addDirtyHandler(handler);
}
 
Example #6
Source File: InterceptorManagerImpl.java    From requestor with Apache License 2.0 5 votes vote down vote up
@Override
public HandlerRegistration register(final RequestInterceptor requestInterceptor) {
    requestInterceptors.add(requestInterceptor);
    updateRequestInterceptorsCopy(); // getRequestInterceptors returns this immutable copy

    return new HandlerRegistration() {
        @Override
        public void removeHandler() {
            removeRequestInterceptor(requestInterceptor);
        }
    };
}
 
Example #7
Source File: CircuitPresenter.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void onUnbind() {
    super.onUnbind();
    for (HandlerRegistration registration : registrations) {
        registration.removeHandler();
    }
}
 
Example #8
Source File: SerdesManagerImpl.java    From requestor with Apache License 2.0 5 votes vote down vote up
/**
 * Register a serializer/deserializer of the given type.
 *
 * @param serdes    The serializer/deserializer of T.
 * @param <T>       The type of the object to be serialized/deserialized.
 *
 * @return  The {@link HandlerRegistration} object, capable of cancelling this HandlerRegistration
 *          to the {@link SerdesManagerImpl}.
 */
public <T> HandlerRegistration register(Serdes<T> serdes) {
    final HandlerRegistration desReg = register((Deserializer<T>) serdes);
    final HandlerRegistration serReg = register((Serializer<T>) serdes);

    return new HandlerRegistration() {
        @Override
        public void removeHandler() {
            desReg.removeHandler();
            serReg.removeHandler();
        }
    };
}
 
Example #9
Source File: ProviderManagerImpl.java    From requestor with Apache License 2.0 5 votes vote down vote up
/**
 * Register a {@link Provider}.
 *
 * @param provider  the provider to register
 *
 * @return  the {@link HandlerRegistration} object, capable of cancelling this registration
 */
public HandlerRegistration register(Provider<?> provider) {
    final String typeName = provider.getType().getName();
    providers.put(typeName, provider);

    return new HandlerRegistration() {
        @Override
        public void removeHandler() {
            providers.remove(typeName);
        }
    };
}
 
Example #10
Source File: AbstractEventBinder.java    From gwteventbinder with Apache License 2.0 5 votes vote down vote up
/**
 * Registers the given handler for the given event class on the given event bus. Factored out
 * into a method here instead of generated directly in order to simplify the generated code and
 * save a little space.
 */
protected final <U extends GenericEvent> void bind(
    EventBus eventBus,
    List<HandlerRegistration> registrations,
    Class<U> type,
    GenericEventHandler handler) {
  registrations.add(eventBus.addHandler(GenericEventType.getTypeOf(type), handler));
}
 
Example #11
Source File: HandlerRegistrationCollection.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void removeHandler() {
	for (HandlerRegistration handler : this.handlers) {
		handler.removeHandler();
	}
	this.handlers.clear();
}
 
Example #12
Source File: InputSlider.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public HandlerRegistration addDirtyHandler(Handler handler) {
	if (this.valueChangeRegistration == null) {
		this.valueChangeRegistration = this.addValueChangeHandler(new ChangeEvent<T>(InputSlider.this));
	}
	return EventBus.get().addHandlerToSource(DirtyEvent.TYPE, this, handler);
}
 
Example #13
Source File: ApplicationCache.java    From gwt-appcache with Apache License 2.0 4 votes vote down vote up
@Nonnull
public final HandlerRegistration addObsoleteHandler( @Nonnull ObsoleteEvent.Handler handler )
{
  return _eventBus.addHandler( ObsoleteEvent.getType(), handler );
}
 
Example #14
Source File: InputCode.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(ValueChangeHandler<String> handler) {
	return this.codeInput.addValueChangeHandler(handler);
}
 
Example #15
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
	return this.addDomHandler(handler, KeyUpEvent.getType());
}
 
Example #16
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
	return this.addDomHandler(handler, MouseDownEvent.getType());
}
 
Example #17
Source File: RequestorImpl.java    From requestor with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration register(Provider<?> provider) {
    return providerManager.register(provider);
}
 
Example #18
Source File: AbstractInputBox.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addChangeHandler(ChangeHandler handler) {
	return this.input.addChangeHandler(handler);
}
 
Example #19
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addBlurHandler(BlurHandler handler) {
	return this.addDomHandler(handler, BlurEvent.getType());
}
 
Example #20
Source File: WebTarget.java    From requestor with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration register(RequestFilter requestFilter) {
    return filterManager.register(requestFilter);
}
 
Example #21
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addDirtyHandler(Handler handler) {
	return EventBus.get().addHandlerToSource(DirtyEvent.TYPE, this, handler);
}
 
Example #22
Source File: AbstractForm.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addResetDisplayHandler(ResetDisplayEvent.Handler handler) {
	return EventBus.get().addHandlerToSource(ResetDisplayEvent.TYPE, this, handler);
}
 
Example #23
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
	return this.addDomHandler(handler, MouseOverEvent.getType());
}
 
Example #24
Source File: AbstractForm.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addFlushErrorHandler(FlushErrorEvent.Handler handler) {
	return EventBus.get().addHandlerToSource(FlushErrorEvent.TYPE, this, handler);
}
 
Example #25
Source File: InputBoolean.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(ValueChangeHandler<Boolean> handler) {
	return this.addHandler(handler, ValueChangeEvent.getType());
}
 
Example #26
Source File: RolloutRendererConnector.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected HandlerRegistration addClickHandler(final RendererClickHandler<JsonObject> handler) {
    return getRenderer().addClickHandler(handler);
}
 
Example #27
Source File: Button.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addButtonHandler(final Handler handler) {
	this.registerClickHandler(this);
	this.registrations.add(this.addHandler(handler, ButtonEvent.TYPE));
	return this.registrations;
}
 
Example #28
Source File: DefaultCommandController.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addCommandResponseHandler(CommandResponseEvent.Handler handler) {
	return EventBus.get().addHandlerToSource(CommandResponseEvent.TYPE, this, handler);
}
 
Example #29
Source File: DefaultCommandController.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addCommandRequestHandler(CommandRequestEvent.Handler handler) {
	return EventBus.get().addHandlerToSource(CommandRequestEvent.TYPE, this, handler);
}
 
Example #30
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addClickHandler(ClickHandler handler) {
	return this.addDomHandler(handler, ClickEvent.getType());
}