List of usage examples for com.google.gwt.event.logical.shared ValueChangeEvent fireIfNotEqual
public static <T> void fireIfNotEqual(HasValueChangeHandlers<T> source, T oldValue, T newValue)
From source file:com.github.gwtbootstrap.client.ui.SubmitButton.java
License:Apache License
/** * {@inheritDoc}//from www . ja va 2 s. com */ @Override public void setValue(String value, boolean fireEvents) { String oldValue = getValue(); asInputElement().setValue(value); if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, oldValue, value); } }
From source file:com.google.gwt.sample.mobilewebapp.client.ui.DateButton.java
License:Apache License
public void setValue(Date value, boolean fireEvents) { Date oldValue = getValue();/*from w w w . ja va 2s. c o m*/ this.date = value; if (value == null) { button.setText("Set due date"); } else { button.setText(dateFormat.format(date)); } if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, oldValue, value); } }
From source file:com.google.gwt.uibinder.test.client.SimpleRenderable.java
License:Apache License
@Override public void setValue(Object newValue, boolean fireEvents) { Object oldValue = value;//w w w . j a va 2s. com value = newValue; ValueChangeEvent.fireIfNotEqual(this, oldValue, newValue); }
From source file:com.google.testing.testify.risk.frontend.client.view.widgets.EditableLabel.java
License:Apache License
@Override public void setValue(String value, boolean fireEvents) { // Set the value before we fire the event, so that consumers can normalize the text in any event // handlers.// ww w .j a v a 2 s.com String startingValue = getValue(); setValue(value); if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, startingValue, value); } }
From source file:com.google.testing.testify.risk.frontend.client.view.widgets.LabelWidget.java
License:Apache License
@Override public void setValue(String value, boolean fireEvents) { String old = label.getText(); label.setText(value);/* www.j av a2 s . co m*/ inputBox.setText(value); if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, old, value); } }
From source file:com.googlecode.gwtmock.client.MockHasValue.java
License:Apache License
@Override public void setValue(T value, boolean fireEvents) { T oldValue = this.value; this.value = value; if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, oldValue, value); }// w w w. j ava 2s . co m }
From source file:com.googlecode.mgwt.ui.client.widget.input.checkbox.MCheckBox.java
License:Apache License
@Override public void setValue(Boolean value, boolean fireEvents) { if (value == null) { throw new IllegalArgumentException("value can not be null"); }//from w w w . j a v a2 s . c o m boolean oldValue = this.value; this.value = value; clearStyles(); if (value) { addStyleName(appearance.css().checked()); removeStyleName(appearance.css().notChecked()); } else { addStyleName(appearance.css().notChecked()); removeStyleName(appearance.css().checked()); } if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, oldValue, this.value); } }
From source file:com.googlecode.mgwt.ui.client.widget.input.MDateBox.java
License:Apache License
public MDateBox(InputAppearance appearance) { super(appearance, new DateValueBoxBase(new DateRenderer(), new DateParser())); format = DEFAULT_FORMAT;//from w ww . ja v a2 s . c om setPlaceHolder(DEFAULT_FORMAT.getPattern()); addStyleName(appearance.css().textBox()); // fix ios issue with onchange event if (MGWT.getOsDetection().isAndroid4_4_OrHigher()) { // only set input type to date if there is a native picker impl.setType(box.getElement(), "date"); // use w3c format format = W3C_FORMAT; } if (MGWT.getOsDetection().isRetina()) { // IOS needs a workaround for empty date picker // Since it will not render them properly (iOS7) format = W3C_FORMAT; box.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { impl.setType(box.getElement(), "date"); } }); box.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { impl.setType(box.getElement(), "text"); } }); } if (MGWT.getOsDetection().isIPadRetina() || MGWT.getOsDetection().isIPad()) { // for iPad workaround does not work // adding default date, not happy about this impl.setType(box.getElement(), "date"); format = W3C_FORMAT; Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { box.setValue(new Date()); } }); } // apply format to parsers getBox().getDateParser().setFormat(format); getBox().getDateRenderer().setFormat(format); if (MGWT.getOsDetection().isIOs()) { addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { Date value = box.getValue(); ValueChangeEvent.fireIfNotEqual(box, lastValue, value); lastValue = value; } }); } }); lastValue = null; } }
From source file:com.googlecode.mgwt.ui.client.widget.input.slider.Slider.java
License:Apache License
protected void setValue(Integer value, boolean fireEvents, boolean updateSlider) { if (value == null) { throw new IllegalArgumentException("value can not be null"); }/* w w w. j a v a 2s . c om*/ if (value < 0) { throw new IllegalArgumentException("value >= 0"); } if (value >= max) { throw new IllegalArgumentException("value >= max"); } int oldValue = this.value; this.value = value; if (updateSlider) { setSliderPos(value); } if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, oldValue, value); } }
From source file:com.googlecode.mgwt.ui.client.widget.MCheckBox.java
License:Apache License
/** {@inheritDoc} */ @Override/*from ww w . j a v a2 s . c o m*/ public void setValue(Boolean value, boolean fireEvents) { if (value == null) { throw new IllegalArgumentException("value can not be null"); } boolean oldValue = this.value; this.value = value; clearStyles(); if (value) { addStyleName(css.checked()); removeStyleName(css.notChecked()); } else { addStyleName(css.notChecked()); removeStyleName(css.checked()); } if (fireEvents) ValueChangeEvent.fireIfNotEqual(this, oldValue, this.value); }