Search in sources :

Example 1 with WAssignmentDialog

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

the class WAssignmentEditor method onEvent.

public void onEvent(Event event) throws Exception {
    //
    if (Events.ON_CLICK.equalsIgnoreCase(event.getName())) {
        Integer oldValue = (Integer) getValue();
        int S_ResourceAssignment_ID = oldValue == null ? 0 : oldValue.intValue();
        MResourceAssignment ma = new MResourceAssignment(Env.getCtx(), S_ResourceAssignment_ID, null);
        if (S_ResourceAssignment_ID == 0) {
            if (gridField != null && gridField.getGridTab() != null) {
                // assign the resource of the document if any
                Object org = gridField.getGridTab().getValue("AD_Org_ID");
                if (org != null && org instanceof Integer)
                    ma.setAD_Org_ID((Integer) org);
            }
        }
        //	Start VAssignment Dialog
        if (S_ResourceAssignment_ID != 0) {
            WAssignmentDialog vad = new WAssignmentDialog(ma, true, true);
            ma = vad.getMResourceAssignment();
        } else //	Start InfoSchedule directly
        {
            InfoSchedule is = new InfoSchedule(ma, true);
            ma = is.getMResourceAssignment();
        }
        //	Set Value
        if (ma != null && ma.getS_ResourceAssignment_ID() != 0) {
            setValue(new Integer(ma.getS_ResourceAssignment_ID()));
            ValueChangeEvent vce = new ValueChangeEvent(this, gridField.getColumnName(), oldValue, getValue());
            fireValueChange(vce);
        }
    }
}
Also used : MResourceAssignment(org.compiere.model.MResourceAssignment) ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent) WAssignmentDialog(org.adempiere.webui.window.WAssignmentDialog) InfoSchedule(org.adempiere.webui.window.InfoSchedule)

Example 2 with WAssignmentDialog

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

the class WSchedule method onEvent.

public void onEvent(Event event) throws Exception {
    if (event instanceof MouseEvent) {
        MouseEvent me = (MouseEvent) event;
        if (me.getX() > 0) {
            MResourceAssignment assignment = new MResourceAssignment(Env.getCtx(), me.getX(), null);
            WAssignmentDialog wad = new WAssignmentDialog(assignment, false, infoSchedule.isCreateNew());
            if (!wad.isCancelled()) {
                _assignmentDialogResult = wad.getMResourceAssignment();
                Events.echoEvent("onAssignmentCallback", this, null);
            }
        }
    } else if (event instanceof BandScrollEvent) {
        BandScrollEvent e = (BandScrollEvent) event;
        Date end = e.getMax();
        Date start = e.getMin();
        Date mid = e.getCenter();
        if (mid != null) {
            m_center = mid;
            infoSchedule.dateCallback(mid);
        }
    }
}
Also used : MResourceAssignment(org.compiere.model.MResourceAssignment) MouseEvent(org.zkoss.zk.ui.event.MouseEvent) WAssignmentDialog(org.adempiere.webui.window.WAssignmentDialog) BandScrollEvent(org.zkforge.timeline.event.BandScrollEvent) Date(java.util.Date)

Aggregations

WAssignmentDialog (org.adempiere.webui.window.WAssignmentDialog)2 MResourceAssignment (org.compiere.model.MResourceAssignment)2 Date (java.util.Date)1 ValueChangeEvent (org.adempiere.exceptions.ValueChangeEvent)1 InfoSchedule (org.adempiere.webui.window.InfoSchedule)1 BandScrollEvent (org.zkforge.timeline.event.BandScrollEvent)1 MouseEvent (org.zkoss.zk.ui.event.MouseEvent)1