Search in sources :

Example 21 with ValueChangeEvent

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;
}
Also used : ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent)

Example 22 with ValueChangeEvent

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;
    }
}
Also used : ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent)

Example 23 with ValueChangeEvent

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;
                }
            }
        }
    }
}
Also used : ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent) Comboitem(org.zkoss.zul.Comboitem)

Example 24 with ValueChangeEvent

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);
        }
    }
}
Also used : WMediaDialog(org.adempiere.webui.window.WMediaDialog) ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent)

Example 25 with ValueChangeEvent

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);
    }
}
Also used : ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent)

Aggregations

ValueChangeEvent (org.adempiere.exceptions.ValueChangeEvent)25 Timestamp (java.sql.Timestamp)3 Date (java.util.Date)3 WTableModelEvent (org.adempiere.webui.event.WTableModelEvent)3 Event (org.zkoss.zk.ui.event.Event)3 WPAttributeEditor (org.adempiere.webui.editor.WPAttributeEditor)2 WSearchEditor (org.adempiere.webui.editor.WSearchEditor)2 MProduct (org.compiere.model.MProduct)2 Point (java.awt.Point)1 BigDecimal (java.math.BigDecimal)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1 ValueChangeListener (org.adempiere.exceptions.ValueChangeListener)1 WDateEditor (org.adempiere.webui.editor.WDateEditor)1 WTableDirEditor (org.adempiere.webui.editor.WTableDirEditor)1 InfoPAttributePanel (org.adempiere.webui.panel.InfoPAttributePanel)1 InfoProductPanel (org.adempiere.webui.panel.InfoProductPanel)1 InfoSchedule (org.adempiere.webui.window.InfoSchedule)1 WAccountDialog (org.adempiere.webui.window.WAccountDialog)1