Search in sources :

Example 1 with ValueChangeListener

use of org.adempiere.exceptions.ValueChangeListener in project adempiere by adempiere.

the class WGraph method loadData.

private void loadData() {
    list = builder.loadData();
    if (m_renderChart && m_chartSelection) {
        Toolbar toolbar = new Toolbar();
        panel.appendChild(toolbar);
        int AD_Reference_Value_ID = DB.getSQLValue(null, "SELECT AD_Reference_ID FROM AD_Reference WHERE Name = ?", "PA_Goal ChartType");
        MLookupInfo info = MLookupFactory.getLookup_List(Env.getLanguage(Env.getCtx()), AD_Reference_Value_ID);
        MLookup mLookup = new MLookup(info, 0);
        WTableDirEditor editor = new WTableDirEditor("ChartType", false, false, true, mLookup);
        toolbar.appendChild(editor.getComponent());
        editor.addValueChangeListener(new ValueChangeListener() {

            public void valueChange(ValueChangeEvent evt) {
                Object value = evt.getNewValue();
                if (value == null || value.toString().trim().length() == 0)
                    return;
                JFreeChart chart = null;
                chart = builder.createChart(value.toString());
                if (chart != null)
                    render(chart);
            }
        });
    }
}
Also used : WTableDirEditor(org.adempiere.webui.editor.WTableDirEditor) MLookupInfo(org.compiere.model.MLookupInfo) ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent) ValueChangeListener(org.adempiere.exceptions.ValueChangeListener) MLookup(org.compiere.model.MLookup) Point(java.awt.Point) JFreeChart(org.jfree.chart.JFreeChart) Toolbar(org.zkoss.zul.Toolbar)

Example 2 with ValueChangeListener

use of org.adempiere.exceptions.ValueChangeListener in project adempiere by adempiere.

the class WEditor method fireValueChange.

protected void fireValueChange(ValueChangeEvent event) {
    //copy to array to avoid concurrent modification exception
    ValueChangeListener[] vcl = new ValueChangeListener[listeners.size()];
    listeners.toArray(vcl);
    for (ValueChangeListener listener : vcl) {
        listener.valueChange(event);
    }
}
Also used : ValueChangeListener(org.adempiere.exceptions.ValueChangeListener)

Aggregations

ValueChangeListener (org.adempiere.exceptions.ValueChangeListener)2 Point (java.awt.Point)1 ValueChangeEvent (org.adempiere.exceptions.ValueChangeEvent)1 WTableDirEditor (org.adempiere.webui.editor.WTableDirEditor)1 MLookup (org.compiere.model.MLookup)1 MLookupInfo (org.compiere.model.MLookupInfo)1 JFreeChart (org.jfree.chart.JFreeChart)1 Toolbar (org.zkoss.zul.Toolbar)1