use of org.adempiere.exceptions.ValueChangeEvent in project adempiere by adempiere.
the class WSearchEditor method actionCombo.
// actionText
private void actionCombo(Object value) {
log.fine("Value=" + value);
m_settingValue = true;
Object oldValue = getValue();
// is the value updated ?
boolean updated = false;
Object updatedValue = value;
if (updatedValue != null && updatedValue instanceof Object[] && ((Object[]) updatedValue).length > 0) {
updatedValue = ((Object[]) updatedValue)[0];
}
// Avoid events if the value hasn't changed.
if (updatedValue == null && getValue() == null)
updated = true;
else if (updatedValue != null && updatedValue.equals(getValue()) && !m_needsUpdate)
updated = true;
if (!updated) {
setValue(updatedValue);
}
// Fire the change event after the change so listeners can react in the same thread.
// Pass value as it may be an array for multiple selection. updatedValue will be a single value.
ValueChangeEvent evt = new ValueChangeEvent(this, this.getColumnName(), oldValue, value);
// -> ADTabpanel - valuechange
fireValueChange(evt);
// last in the chain of changes.
m_settingValue = false;
m_needsUpdate = false;
}
use of org.adempiere.exceptions.ValueChangeEvent in project adempiere by adempiere.
the class WStringEditor method onEvent.
public void onEvent(Event event) {
if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName())) {
String newValue = getComponent().getValue();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent);
oldValue = newValue;
}
}
use of org.adempiere.exceptions.ValueChangeEvent in project adempiere by adempiere.
the class WTableDirEditor method onEvent.
public void onEvent(Event event) {
if (Events.ON_SELECT.equalsIgnoreCase(event.getName())) {
Object newValue = getValue();
if (isValueChange(newValue)) {
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent);
}
} else if (Events.ON_BLUR.equalsIgnoreCase(event.getName())) {
Comboitem item = getComponent().getSelectedItem();
if (item == null) {
setValue(oldValue);
} else {
//on select not fire for empty label item
if (item.getLabel().equals("")) {
Object newValue = getValue();
if (isValueChange(newValue)) {
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent);
oldValue = newValue;
}
}
}
}
}
use of org.adempiere.exceptions.ValueChangeEvent in project adempiere by adempiere.
the class WBinaryEditor method onEvent.
public void onEvent(Event event) throws Exception {
if (Events.ON_CLICK.equals(event.getName())) {
WMediaDialog dialog = new WMediaDialog(gridField.getHeader(), m_data);
if (!dialog.isCancel() && dialog.isChange()) {
Object oldValue = m_data;
Object newValue = dialog.getData();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent);
setValue(newValue);
}
}
}
use of org.adempiere.exceptions.ValueChangeEvent in project adempiere by adempiere.
the class WFilenameEditor method onEvent.
public void onEvent(Event event) {
if (Events.ON_CHANGE.equals(event.getName()) || Events.ON_OK.equals(event.getName())) {
String newValue = getComponent().getText();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
fireValueChange(changeEvent);
} else if (Events.ON_CLICK.equals(event.getName())) {
cmd_file();
String newValue = getComponent().getText();
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
fireValueChange(changeEvent);
}
}
Aggregations