Search in sources :

Example 6 with ADWindow

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

the class WRequest method onEvent.

//	getZoomTargets
public void onEvent(Event e) throws Exception {
    if (e.getTarget() instanceof Menuitem) {
        MQuery query = null;
        if (e.getTarget() == m_active) {
            query = new MQuery("");
            String where = "(" + m_where + ") AND Processed='N'";
            query.addRestriction(where);
            query.setRecordCount(0);
        } else if (e.getTarget() == m_all) {
            query = new MQuery("");
            query.addRestriction(m_where.toString());
            query.setRecordCount(0);
        } else if (e.getTarget() == m_new) {
            query = new MQuery("");
            query.addRestriction("1=2");
            query.setRecordCount(0);
        }
        //	232=all - 201=my
        int AD_Window_ID = 232;
        ADWindow frame = SessionManager.getAppDesktop().openWindow(AD_Window_ID, query);
        if (frame == null)
            return;
        //	New - set Table/Record
        if (e.getTarget() == m_new) {
            GridTab tab = frame.getADWindowPanel().getActiveGridTab();
            tab.dataNew(false);
            tab.setValue("AD_Table_ID", new Integer(m_AD_Table_ID));
            tab.setValue("Record_ID", new Integer(m_Record_ID));
            //
            if (m_C_BPartner_ID != 0)
                tab.setValue("C_BPartner_ID", new Integer(m_C_BPartner_ID));
            //
            if (m_AD_Table_ID == I_C_BPartner.Table_ID)
                tab.setValue("C_BPartner_ID", new Integer(m_Record_ID));
            else if (m_AD_Table_ID == I_AD_User.Table_ID)
                tab.setValue("AD_User_ID", new Integer(m_Record_ID));
            else //
            if (m_AD_Table_ID == I_C_Project.Table_ID)
                tab.setValue("C_Project_ID", new Integer(m_Record_ID));
            else if (m_AD_Table_ID == I_A_Asset.Table_ID)
                tab.setValue("A_Asset_ID", new Integer(m_Record_ID));
            else //
            if (m_AD_Table_ID == I_C_Order.Table_ID)
                tab.setValue("C_Order_ID", new Integer(m_Record_ID));
            else if (m_AD_Table_ID == I_C_Invoice.Table_ID)
                tab.setValue("C_Invoice_ID", new Integer(m_Record_ID));
            else //
            if (m_AD_Table_ID == I_M_Product.Table_ID)
                tab.setValue("M_Product_ID", new Integer(m_Record_ID));
            else if (m_AD_Table_ID == I_C_Payment.Table_ID)
                tab.setValue("C_Payment_ID", new Integer(m_Record_ID));
            else //
            if (m_AD_Table_ID == I_M_InOut.Table_ID)
                tab.setValue("M_InOut_ID", new Integer(m_Record_ID));
            else if (m_AD_Table_ID == I_M_RMA.Table_ID)
                tab.setValue("M_RMA_ID", new Integer(m_Record_ID));
            else //
            if (m_AD_Table_ID == I_C_Campaign.Table_ID)
                tab.setValue("C_Campaign_ID", new Integer(m_Record_ID));
            else //
            if (m_AD_Table_ID == I_R_Request.Table_ID)
                tab.setValue(I_R_Request.COLUMNNAME_R_RequestRelated_ID, new Integer(m_Record_ID));
            else // FR [2842165] - Order Ref link from SO line creating new request
            if (m_AD_Table_ID == I_C_OrderLine.Table_ID) {
                MOrderLine oLine = new MOrderLine(Env.getCtx(), m_Record_ID, null);
                if (oLine != null) {
                    tab.setValue(I_C_OrderLine.COLUMNNAME_C_Order_ID, new Integer(oLine.getC_Order_ID()));
                }
            }
        }
        frame = null;
    }
}
Also used : Menuitem(org.zkoss.zul.Menuitem) GridTab(org.compiere.model.GridTab) ADWindow(org.adempiere.webui.window.ADWindow) MQuery(org.compiere.model.MQuery) MOrderLine(org.compiere.model.MOrderLine)

Aggregations

ADWindow (org.adempiere.webui.window.ADWindow)6 DesktopTabpanel (org.adempiere.webui.component.DesktopTabpanel)3 WButtonEditor (org.adempiere.webui.editor.WButtonEditor)2 WEditor (org.adempiere.webui.editor.WEditor)2 AbstractADWindowPanel (org.adempiere.webui.panel.AbstractADWindowPanel)2 WEditorPopupMenu (org.adempiere.webui.editor.WEditorPopupMenu)1 GridTab (org.compiere.model.GridTab)1 MOrderLine (org.compiere.model.MOrderLine)1 MQuery (org.compiere.model.MQuery)1 Image (org.zkoss.zul.Image)1 Listcell (org.zkoss.zul.Listcell)1 Menuitem (org.zkoss.zul.Menuitem)1