Search in sources :

Example 1 with ADWindow

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

the class GridTabListItemRenderer method getEditorCell.

private Listcell getEditorCell(GridField gridField, Object object, int i) {
    Listcell cell = new Listcell("", null);
    WEditor editor = editors.get(gridField);
    if (editor != null) {
        if (editor instanceof WButtonEditor) {
            Object window = SessionManager.getAppDesktop().findWindow(windowNo);
            if (window != null && window instanceof ADWindow) {
                AbstractADWindowPanel windowPanel = ((ADWindow) window).getADWindowPanel();
                ((WButtonEditor) editor).addActionListener(windowPanel);
            }
        } else {
            editor.addValueChangeListener(dataBinder);
        }
        cell.appendChild(editor.getComponent());
        if (editor.getComponent() instanceof Checkbox || editor.getComponent() instanceof Image) {
            cell.setStyle("text-align:center");
        } else if (DisplayType.isNumeric(gridField.getDisplayType())) {
            cell.setStyle("text-align:right");
        }
        gridField.addPropertyChangeListener(editor);
        editor.setValue(gridField.getValue());
        WEditorPopupMenu popupMenu = editor.getPopupMenu();
        if (popupMenu != null) {
            popupMenu.addMenuListener((ContextMenuListener) editor);
            cell.appendChild(popupMenu);
        }
        //streach component to fill grid cell
        editor.fillHorizontal();
    }
    return cell;
}
Also used : WButtonEditor(org.adempiere.webui.editor.WButtonEditor) Listcell(org.zkoss.zul.Listcell) ADWindow(org.adempiere.webui.window.ADWindow) AbstractADWindowPanel(org.adempiere.webui.panel.AbstractADWindowPanel) WEditor(org.adempiere.webui.editor.WEditor) Image(org.zkoss.zul.Image) WEditorPopupMenu(org.adempiere.webui.editor.WEditorPopupMenu)

Example 2 with ADWindow

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

the class GridTabRowRenderer method getEditorCell.

/**
	 * 
	 * @param gridField
	 * @param object
	 * @param i
	 * @return
	 */
private WEditor getEditorCell(GridField gridField, Object object, int i) {
    WEditor editor = editors.get(gridField);
    if (editor != null) {
        if (editor instanceof WButtonEditor) {
            if (m_windowPanel != null) {
                ((WButtonEditor) editor).addActionListener(m_windowPanel);
            } else {
                Object window = SessionManager.getAppDesktop().findWindow(windowNo);
                if (window != null && window instanceof ADWindow) {
                    AbstractADWindowPanel windowPanel = ((ADWindow) window).getADWindowPanel();
                    ((WButtonEditor) editor).addActionListener(windowPanel);
                }
            }
        } else {
            editor.addValueChangeListener(dataBinder);
        }
        gridField.removePropertyChangeListener(editor);
        gridField.addPropertyChangeListener(editor);
        editor.setValue(gridField.getValue());
        //streach component to fill grid cell
        if (editor.getComponent() instanceof Textbox)
            ((HtmlBasedComponent) editor.getComponent()).setWidth("98%");
        else
            editor.fillHorizontal();
    }
    return editor;
}
Also used : WButtonEditor(org.adempiere.webui.editor.WButtonEditor) ADWindow(org.adempiere.webui.window.ADWindow) AbstractADWindowPanel(org.adempiere.webui.panel.AbstractADWindowPanel) WEditor(org.adempiere.webui.editor.WEditor)

Example 3 with ADWindow

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

the class TabbedDesktop method openWindow.

/**
	 *
	 * @param windowId
     * @param query
	 * @return ADWindow
	 */
public ADWindow openWindow(int windowId, MQuery query) {
    ADWindow adWindow = new ADWindow(Env.getCtx(), windowId, query);
    DesktopTabpanel tabPanel = new DesktopTabpanel();
    if (adWindow.createPart(tabPanel) != null) {
        preOpenNewTab();
        windowContainer.addWindow(tabPanel, adWindow.getTitle(), true);
        return adWindow;
    } else {
        //user cancel
        return null;
    }
}
Also used : ADWindow(org.adempiere.webui.window.ADWindow) DesktopTabpanel(org.adempiere.webui.component.DesktopTabpanel)

Example 4 with ADWindow

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

the class TabbedDesktop method openWindow.

/**
	 *
	 * @param windowId
	 * @return ADWindow
	 */
public ADWindow openWindow(int windowId) {
    ADWindow adWindow = new ADWindow(Env.getCtx(), windowId);
    DesktopTabpanel tabPanel = new DesktopTabpanel();
    if (adWindow.createPart(tabPanel) != null) {
        preOpenNewTab();
        windowContainer.addWindow(tabPanel, adWindow.getTitle(), true);
        return adWindow;
    } else {
        //user cancel
        return null;
    }
}
Also used : ADWindow(org.adempiere.webui.window.ADWindow) DesktopTabpanel(org.adempiere.webui.component.DesktopTabpanel)

Example 5 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