Example usage for com.google.gwt.event.logical.shared ValueChangeEvent shouldFire

List of usage examples for com.google.gwt.event.logical.shared ValueChangeEvent shouldFire

Introduction

In this page you can find the example usage for com.google.gwt.event.logical.shared ValueChangeEvent shouldFire.

Prototype

protected static <T> boolean shouldFire(HasValueChangeHandlers<T> source, T oldValue, T newValue) 

Source Link

Document

Convenience method to allow subtypes to know when they should fire a value change event in a null-safe manner.

Usage

From source file:net.cbtltd.client.field.datepicker.DateChangeEvent.java

License:Apache License

/**
 * 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.// w w w . j a  va  2 s .com
 * 
 * @param <I> the old value type
 * @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));
    }
}

From source file:org.cruxframework.crux.widgets.client.datepicker.GWTOverriddenDateChangeEvent.java

License:Apache License

/**
 * 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.//from   w  w w.ja  v  a  2  s. com
 * 
 * @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 GWTOverriddenDateChangeEvent(newValue));
    }
}