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

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

Introduction

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

Prototype

public static <T> void fireIfNotEqual(HasValueChangeHandlers<T> source, T oldValue, T newValue) 

Source Link

Document

Fires value change event if the old value is not equal to the new value.

Usage

From source file:com.scurab.web.drifmaps.client.controls.Rating.java

License:Apache License

@Override
public void setValue(Integer value, boolean fireEvents) {
    if (value == null)
        value = 0;//from   w  w  w.java 2 s  .c  o m
    final Integer oldValue = currentRating;
    currentRating = value;
    if (null != input) {
        input.setValue("" + value);
    }
    setItemsState(-1);
    if (fireEvents) {
        ValueChangeEvent.fireIfNotEqual(this, oldValue, value);
    }
}

From source file:com.sencha.gxt.core.client.util.ToggleGroup.java

License:sencha.com license

@Override
public void setValue(HasValue<Boolean> value, boolean fireEvents) {
    if (!contains(value)) {
        value = null;/*ww  w. ja  v a  2  s.co m*/
    }
    HasValue<Boolean> oldValue = getValue();
    this.value = value;
    if (value != null && !value.getValue()) {
        value.setValue(true, fireEvents);
    }

    for (HasValue<Boolean> toggle : ToggleGroup.this) {
        if (toggle != value) {
            toggle.setValue(false, fireEvents);
        }
    }
    if (fireEvents) {
        ValueChangeEvent.fireIfNotEqual(this, oldValue, value);
    }
}

From source file:com.tractionsoftware.gwt.user.client.ui.InputWidget.java

License:Apache License

private void fireValueChangeHandler(String value) {
    ValueChangeEvent.fireIfNotEqual(this, lastValue, value);
    lastValue = value;
}

From source file:com.turbomanage.gwt.client.ui.widget.SelectOneListBox.java

License:Apache License

@Override
public void setValue(T value, boolean fireEvents) {
    T oldValue = getValue();//from  www . ja va2  s  .c  o  m
    this.setSelectedValue(value);
    if (fireEvents) {
        ValueChangeEvent.fireIfNotEqual(this, oldValue, value);
    }
}

From source file:com.wfairclough.foundation4gwt.client.ui.widget.ComboBox.java

License:Apache License

/**
 * Overridden to send ValueChangeEvents only when appropriate.
 *//*  w w w . j  av a  2 s .  c o m*/
@Override
public void onBrowserEvent(Event event) {
    switch (DOM.eventGetType(event)) {
    case Event.ONMOUSEUP:
    case Event.ONBLUR:
    case Event.ONKEYDOWN:
        // Note the old value for onValueChange purposes (in ONCLICK case)
        oldValue = getValue();
        break;

    case Event.ONCLICK:
        EventTarget target = event.getEventTarget();
        // TODO May need to add more isTarget checks
        if (Element.is(target) && currentAnchor.getElement().isOrHasChild(Element.as(target))) {

            // They clicked the label. Note our pre-click value, and
            // short circuit event routing so that other click handlers
            // don't hear about it
            oldValue = getValue();

            return;
        }

        for (ComboBoxItem item : getItems()) {
            if (Element.is(target) && item.getElement().isOrHasChild(Element.as(target))) {
                item.select();
                break;
            }
        }

        // It's not the label. Let our handlers hear about the
        // click...
        super.onBrowserEvent(event);
        // ...and now maybe tell them about the change
        ValueChangeEvent.fireIfNotEqual(ComboBox.this, oldValue, getValue());
        //            ValueChangeEvent.fire(ComboBox.this, getValue());
        return;
    }

    super.onBrowserEvent(event);
}

From source file:com.wfairclough.foundation4gwt.client.ui.widget.RadioButton.java

License:Apache License

/**
 * Overridden to send ValueChangeEvents only when appropriate.
 *//*w  ww  . j a va2s  .com*/
@Override
public void onBrowserEvent(Event event) {
    switch (DOM.eventGetType(event)) {
    case Event.ONMOUSEUP:
    case Event.ONBLUR:
    case Event.ONKEYDOWN:
        // Note the old value for onValueChange purposes (in ONCLICK case)
        oldValue = getValue();
        break;

    case Event.ONCLICK:
        EventTarget target = event.getEventTarget();
        if (Element.is(target) && radioInput.getElement().isOrHasChild(Element.as(target))) {

            // They clicked the label. Note our pre-click value, and
            // short circuit event routing so that other click handlers
            // don't hear about it
            oldValue = getValue();
            return;
        }

        // It's not the label. Let our handlers hear about the
        // click...
        super.onBrowserEvent(event);
        // ...and now maybe tell them about the change
        ValueChangeEvent.fireIfNotEqual(RadioButton.this, oldValue, getValue());
        return;
    }

    super.onBrowserEvent(event);
}

From source file:de.swm.commons.mobile.client.widgets.date.DateTextBox.java

License:Apache License

@Override
public void setValue(final Date value, boolean fireEvents) {
    this.changedByUser = false;

    Date oldValue = this.currentValue == null ? null : (Date) this.currentValue.clone();
    this.currentValue = value;
    this.setAsTextValue(value);
    if (fireEvents) {
        ValueChangeEvent.fireIfNotEqual(this, oldValue, this.currentValue);
    }/*from   w ww .  j a v a2s. c o  m*/
}

From source file:de.swm.commons.mobile.client.widgets.date.DateTextBoxReadOnly.java

License:Apache License

@Override
public void setValue(Date newValue, boolean fireEvents) {
    Date oldValue = this.value == null ? null : (Date) this.value.clone();
    this.setValue(newValue);
    if (fireEvents) {
        ValueChangeEvent.fireIfNotEqual(this, oldValue, newValue);
    }//from   w  ww.  ja  va 2s  .  c  o m
}

From source file:de.swm.commons.mobile.client.widgets.DropDownList.java

License:Apache License

@Override
public void setValue(T value, boolean fireEvents) {
    final T oldValue = currentValue;
    setValue(value);/* w  w w.  j  a  va  2  s.co m*/
    if (fireEvents) {
        ValueChangeEvent.fireIfNotEqual(this, oldValue, value);
    }

}

From source file:de.swm.commons.mobile.client.widgets.GenericRadioButtonGroup.java

License:Apache License

@Override
public void setValue(T value, boolean fireEvents) {
    final T oldValue = currentValue;
    setValue(value);/*from  w w w.ja v  a 2s  . c  o m*/
    if (fireEvents) {
        ValueChangeEvent.fireIfNotEqual(this, oldValue, value);
    }
}