Search in sources :

Example 1 with WLocationDialog

use of org.adempiere.webui.window.WLocationDialog in project adempiere by adempiere.

the class WLocationEditor method onEvent.

public void onEvent(Event event) throws Exception {
    //
    if ("onClick".equals(event.getName())) {
        if (((Button) event.getTarget()).getName().equals("bUrl")) {
            Env.startBrowser(DefaultContextProvider.GOOGLE_MAPS_URL_PREFIX + m_value.toString().replace(" ", "%"));
            return;
        } else {
            log.config("actionPerformed - " + m_value);
            WLocationDialog ld = new WLocationDialog(Msg.getMsg(Env.getCtx(), "Location"), m_value);
            ld.setVisible(true);
            AEnv.showWindow(ld);
            m_value = ld.getValue();
            //
            if (!ld.isChanged())
                return;
            //  Data Binding
            int C_Location_ID = 0;
            if (m_value != null)
                C_Location_ID = m_value.getC_Location_ID();
            Integer ii = new Integer(C_Location_ID);
            //  force Change - user does not realize that embedded object is already saved.
            ValueChangeEvent valuechange = new ValueChangeEvent(this, getColumnName(), null, null);
            //  resets m_mLocation
            fireValueChange(valuechange);
            if (C_Location_ID != 0) {
                ValueChangeEvent vc = new ValueChangeEvent(this, getColumnName(), null, ii);
                fireValueChange(vc);
            }
            setValue(ii);
        }
    }
}
Also used : ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent) WLocationDialog(org.adempiere.webui.window.WLocationDialog)

Aggregations

ValueChangeEvent (org.adempiere.exceptions.ValueChangeEvent)1 WLocationDialog (org.adempiere.webui.window.WLocationDialog)1