/** * Adds the wrapped listener. * * @param <V> the type of value changed * * @param source the event source * @param listener the listener * @return the wrapped listener * * @deprecated will be removed in GWT 2.0 along with the listener classes */ @Deprecated public static <V> WrappedLogicalChangeListener<V> add( HasValueChangeHandlers<V> source, ChangeListener listener) { WrappedLogicalChangeListener<V> rtn = new WrappedLogicalChangeListener<V>( listener); source.addValueChangeHandler(rtn); return rtn; }
/** * Fires a value change event on all registered handlers in the handler * manager. If no such handlers exist, this method will do nothing. * * @param <T> the old value type * @param source the source of the handlers * @param value the value */ public static <T> void fire(HasValueChangeHandlers<T> source, T value) { if (TYPE != null) { ValueChangeEvent<T> event = new ValueChangeEvent<T>(value); source.fireEvent(event); } }
@Override public HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler) { return peerWithValueChangeHandlers.addValueChangeHandler(handler); }
/** * Fires value change event if the old value is not equal to the new value. * Use this call rather than making the decision to short circuit yourself for * safe handling of null. * * @param <T> the old value type * @param source the source of the handlers * @param oldValue the oldValue, may be null * @param newValue the newValue, may be null */ public static <T> void fireIfNotEqual(HasValueChangeHandlers<T> source, T oldValue, T newValue) { if (shouldFire(source, oldValue, newValue)) { ValueChangeEvent<T> event = new ValueChangeEvent<T>(newValue); source.fireEvent(event); } }
protected HandlerRegistration addHandlerToWidget(ValueChangeHandler<Date> handler) { return widget.addValueChangeHandler(handler); }
/** * Fires value change event if the old value is not equal to the new value. * Use this call rather than making the decision to short circuit yourself for * safe handling of null. * * @param <S> The event source * @param source the source of the handlers * @param oldValue the oldValue, may be null * @param newValue the newValue, may be null */ public static <S extends HasValueChangeHandlers<Date> & HasHandlers> void fireIfNotEqualDates( S source, Date oldValue, Date newValue) { if (ValueChangeEvent.shouldFire(source, oldValue, newValue)) { source.fireEvent(new DateChangeEvent(newValue)); } }
@Override protected HandlerRegistration hookUpRunnable(final Runnable runnable) { return changable.addValueChangeHandler(e -> runnable.run()); }
@Override public void fireEvent(GwtEvent<?> event) { peerWithValueChangeHandlers.fireEvent(event); }
@Override protected HandlerRegistration hookUpEventRunnable(final DomEventRunnable runnable) { return changable.addValueChangeHandler(e -> runnable.run(null)); } }
/** * Fires a value change event on all registered handlers in the handler * manager. If no such handlers exist, this method will do nothing. * * @param <T> the old value type * @param source the source of the handlers * @param value the value */ public static <T> void fire(HasValueChangeHandlers<T> source, T value) { if (TYPE != null) { ValueChangeEvent<T> event = new ValueChangeEvent<T>(value); source.fireEvent(event); } }
/** * add a change handler to clear error state on value change. * * @param pwidget widget to set the handler to */ protected void addValueChangeHandler(final HasValueChangeHandlers<T> pwidget) { pwidget.addValueChangeHandler(event -> clearErrors()); }
/** * Fires a value change event on all registered handlers in the handler * manager. If no such handlers exist, this method will do nothing. * * @param <T> the old value type * @param source the source of the handlers * @param value the value */ public static <T> void fire(HasValueChangeHandlers<T> source, T value) { if (TYPE != null) { ValueChangeEvent<T> event = new ValueChangeEvent<T>(value); source.fireEvent(event); } }
/** * Adds the wrapped listener. * * @param <V> the type of value changed * * @param source the event source * @param listener the listener * @return the wrapped listener * * @deprecated will be removed in GWT 2.0 along with the listener classes */ @Deprecated public static <V> WrappedLogicalChangeListener<V> add( HasValueChangeHandlers<V> source, ChangeListener listener) { WrappedLogicalChangeListener<V> rtn = new WrappedLogicalChangeListener<V>( listener); source.addValueChangeHandler(rtn); return rtn; }
/** * Fires value change event if the old value is not equal to the new value. * Use this call rather than making the decision to short circuit yourself for * safe handling of null. * * @param <S> The event source * @param source the source of the handlers * @param oldValue the oldValue, may be null * @param newValue the newValue, may be null */ public static <S extends HasValueChangeHandlers<Date> & HasHandlers> void fireIfNotEqualDates( S source, Date oldValue, Date newValue) { if (ValueChangeEvent.shouldFire(source, oldValue, newValue)) { source.fireEvent(new DateChangeEvent(newValue)); } }
/** * Adds the wrapped listener. * * @param <V> the type of value changed * * @param source the event source * @param listener the listener * @return the wrapped listener * * @deprecated will be removed in GWT 2.0 along with the listener classes */ @Deprecated public static <V> WrappedLogicalChangeListener<V> add( HasValueChangeHandlers<V> source, ChangeListener listener) { WrappedLogicalChangeListener<V> rtn = new WrappedLogicalChangeListener<V>( listener); source.addValueChangeHandler(rtn); return rtn; }
/** * Fires value change event if the old value is not equal to the new value. * Use this call rather than making the decision to short circuit yourself for * safe handling of null. * * @param <T> the old value type * @param source the source of the handlers * @param oldValue the oldValue, may be null * @param newValue the newValue, may be null */ public static <T> void fireIfNotEqual(HasValueChangeHandlers<T> source, T oldValue, T newValue) { if (shouldFire(source, oldValue, newValue)) { ValueChangeEvent<T> event = new ValueChangeEvent<T>(newValue); source.fireEvent(event); } }
/** * initialize one editor. * * @param editor editor to initialize */ @SuppressWarnings({"rawtypes", "unchecked"}) public void initializeEditors(final Object editor) { if (editor instanceof HasValueChangeHandlers && valueChangeHandler != null) { ((HasValueChangeHandlers) editor).addValueChangeHandler(valueChangeHandler); // if widget has a value change handler, validate on change if (validateOnVueChangeHandler != null) { ((HasValueChangeHandlers) editor).addValueChangeHandler(validateOnVueChangeHandler); } } // if widget has a key up handler, validate on key up if (editor instanceof HasKeyUpHandlers && validateOnKeyUpHandler != null) { ((HasKeyUpHandlers) editor).addKeyUpHandler(validateOnKeyUpHandler); } // try to submit form on return if (editor instanceof HasKeyPressHandlers && commitOnReturnHandler != null) { ((HasKeyPressHandlers) editor).addKeyPressHandler(commitOnReturnHandler); } } }
/** * Fires value change event if the old value is not equal to the new value. * Use this call rather than making the decision to short circuit yourself for * safe handling of null. * * @param <T> the old value type * @param source the source of the handlers * @param oldValue the oldValue, may be null * @param newValue the newValue, may be null */ public static <T> void fireIfNotEqual(HasValueChangeHandlers<T> source, T oldValue, T newValue) { if (shouldFire(source, oldValue, newValue)) { ValueChangeEvent<T> event = new ValueChangeEvent<T>(newValue); source.fireEvent(event); } }
/*************************************** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") protected HandlerRegistration initEventDispatching( Widget rWidget, EventType eEventType) { if (eEventType == EventType.ACTION && rWidget instanceof HasValueChangeHandlers<?>) { return ((HasValueChangeHandlers<Object>) rWidget) .addValueChangeHandler(this); } else { return super.initEventDispatching(rWidget, eEventType); } } }
public static <T> Observable<ValueChangeEvent<T>> valueChange(HasValueChangeHandlers<T> source) { return Observable.create(s -> register(s, source.addValueChangeHandler(s::onNext)), uiBackpressureMode()); } }