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:fr.putnami.pwt.core.widget.client.InputDatePicker.java
License:Open Source License
@Override public void setValue(Date value, boolean fireEvents) { if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, this.value, value); this.setFocus(true); }//from w w w . j ava 2 s.c o m if (value == null) { this.value = null; this.cursor = new Date(this.today.getTime()); } else { this.value = new Date(value.getTime()); this.cursor = new Date(value.getTime()); } this.redraw(); }
From source file:gwt.material.design.addins.client.combobox.MaterialComboBox.java
License:Apache License
/** * Set the selected value using a single item, generally used * in single selection mode./*from ww w .j ava2s . c o m*/ */ public void setSingleValue(T value, boolean fireEvents) { int index = this.values.indexOf(value); if (index >= 0) { List<T> before = getValue(); setSelectedIndex(index); if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, before, Collections.singletonList(value)); } } }
From source file:gwt.material.design.client.ui.MaterialListValueBox.java
License:Apache License
@Override public void setValue(T value, boolean fireEvents) { int index = getIndex(value.toString()); if (index > 0 && values.contains(value)) { T before = getValue();// ww w .j av a2 s . co m setSelectedIndex(index); if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, before, value); } } }
From source file:io.apiman.manager.ui.client.local.pages.admin.PermissionSelector.java
License:Apache License
/** * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean) *//*w ww .j av a2 s . c om*/ @Override public void setValue(Set<PermissionType> value, boolean fireEvents) { Set<PermissionType> oldValue = this.value; this.value = value; refresh(); if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, oldValue, value); } }
From source file:io.apiman.manager.ui.client.local.pages.common.OrganizationSelector.java
License:Apache License
/** * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean) *//* w w w .j a v a 2 s . c o m*/ @Override public void setValue(OrganizationSummaryBean value, boolean fireEvents) { OrganizationSummaryBean oldValue = this.value; this.value = value; selectorLabel.setText(value.getName()); if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, oldValue, value); } }
From source file:io.apiman.manager.ui.client.local.pages.common.VersionSelector.java
License:Apache License
/** * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean) *///from w ww . jav a 2 s .c om @Override public void setValue(String value, boolean fireEvents) { String oldValue = this.value; this.value = value; button.setHTML(createLabel(value)); if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, oldValue, value); } }
From source file:io.apiman.manager.ui.client.local.widgets.InlineEditableLabel.java
License:Apache License
/** * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean) */// w ww . j a v a 2s . c o m @Override public void setValue(String value, boolean fireEvents) { String oldValue = this.value; this.value = value; if (value == null || value.trim().length() == 0) { valueLabel.getElement().addClassName("apiman-label-faded"); //$NON-NLS-1$ valueLabel.setText(getEmptyValueMessage()); } else { valueLabel.getElement().removeClassName("apiman-label-faded"); //$NON-NLS-1$ valueLabel.setText(value); } ValueChangeEvent.fireIfNotEqual(this, oldValue, value); }
From source file:io.apiman.manager.ui.client.local.widgets.SearchBox.java
License:Apache License
/** * Called when the user clicks the Search button or hits the ENTER key. */// www.ja va 2 s . c o m protected void doEnter() { String newValue = textBox.getValue(); ValueChangeEvent.fireIfNotEqual(SearchBox.this, oldValue, newValue); oldValue = newValue; hasValue = !newValue.isEmpty(); if (hasValue) { button.setHTML("<i class=\"fa fa-fw fa-times\"></i>"); //$NON-NLS-1$ } else { button.setHTML("<i class=\"fa fa-fw fa-search\"></i>"); //$NON-NLS-1$ } }
From source file:jsef.poc2.host.client.local.pages.details.TabBar.java
License:Apache License
/** * Adds a tab to the tab bar.//from w w w .j a va 2s. c o m * @param displayName * @param tabId */ public void addTab(String displayName, final String tabId) { String cname = null; if (this.getWidgetCount() == 0) { cname = "active"; this.selectedTabId = tabId; } Anchor a = new Anchor(displayName); a.setHref("#" + tabId); a.getElement().setAttribute("data-toggle", "tab"); this.add(a); if (cname != null) { setLiClass(a, cname); } a.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String oldTabId = selectedTabId; selectedTabId = tabId; ValueChangeEvent.fireIfNotEqual(TabBar.this, oldTabId, selectedTabId); } }); }
From source file:net.cscott.sdr.webapp.client.SliderBar.java
License:Apache License
/** * Set the current value and optionally fire the onValueChange event. * /*from ww w . j av a2 s .co m*/ * @param curValue the current value * @param fireEvent fire the onValue change event if true */ public void setCurrentValue(double curValue, boolean fireEvent) { double oldValue = this.curValue; // Confine the value to the range this.curValue = Math.max(minValue, Math.min(maxValue, curValue)); // Redraw the knob drawKnob(); // Fire the ValueChange event if (fireEvent) ValueChangeEvent.fireIfNotEqual(this, oldValue, curValue); }