Search in sources :

Example 16 with GridTab

use of org.compiere.model.GridTab in project adempiere by adempiere.

the class InfoProduct method statInit.

/**
	 *	Static Setup - add fields to parameterPanel
	 */
private void statInit() {
    labelValue.setText(Msg.getMsg(Env.getCtx(), "Value"));
    fieldValue.setBackground(AdempierePLAF.getInfoBackground());
    fieldValue.addActionListener(this);
    labelName.setText(Msg.getMsg(Env.getCtx(), "Name"));
    fieldName.setBackground(AdempierePLAF.getInfoBackground());
    fieldName.addActionListener(this);
    labelUPC.setText(Msg.translate(Env.getCtx(), "UPC"));
    fieldUPC.setBackground(AdempierePLAF.getInfoBackground());
    fieldUPC.addActionListener(this);
    labelSKU.setText(Msg.translate(Env.getCtx(), "SKU"));
    fieldSKU.setBackground(AdempierePLAF.getInfoBackground());
    fieldSKU.addActionListener(this);
    labelWarehouse.setText(Msg.getMsg(Env.getCtx(), "Warehouse"));
    fWarehouse_ID = new VLookup("M_Warehouse_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MWarehouse.Table_Name, MWarehouse.COLUMNNAME_M_Warehouse_ID), DisplayType.TableDir));
    fWarehouse_ID.setBackground(AdempierePLAF.getInfoBackground());
    fWarehouse_ID.addActionListener(this);
    checkOnlyStock.setText(Msg.getMsg(Env.getCtx(), "OnlyStock"));
    checkOnlyStock.setName("OnlyStock");
    checkOnlyStock.setToolTipText(Msg.getMsg(Env.getCtx(), "OnlyStockTip"));
    // Info may open when searching for non-stock as well.
    checkOnlyStock.setSelected(false);
    checkOnlyStock.addActionListener(this);
    checkShowDetail.setText(Msg.getMsg(Env.getCtx(), "ShowDetail"));
    checkShowDetail.setName("ShowDetail");
    checkShowDetail.setToolTipText(Msg.getMsg(Env.getCtx(), "ShowAttributeDetails"));
    checkShowDetail.setSelected(false);
    checkShowDetail.setEnabled(false);
    checkShowDetail.addActionListener(this);
    checkAND.setText(Msg.getMsg(Env.getCtx(), "SearchAND"));
    checkAND.setName("SearchAND");
    checkAND.setToolTipText(Msg.getMsg(Env.getCtx(), "SearchANDInfo"));
    checkAND.setSelected(true);
    checkAND.addActionListener(this);
    labelPriceList.setText(Msg.getMsg(Env.getCtx(), "PriceListVersion"));
    fPriceList_ID = new VLookup("M_PriceList_Version_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPriceListVersion.Table_Name, MPriceListVersion.COLUMNNAME_M_PriceList_Version_ID), DisplayType.TableDir));
    fPriceList_ID.setBackground(AdempierePLAF.getInfoBackground());
    fPriceList_ID.addActionListener(this);
    labelProductCategory.setText(Msg.translate(Env.getCtx(), "M_Product_Category_ID"));
    fProductCategory_ID = new VLookup("M_Product_Category_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MProductCategory.Table_Name, MProductCategory.COLUMNNAME_M_Product_Category_ID), DisplayType.TableDir));
    fProductCategory_ID.setBackground(AdempierePLAF.getInfoBackground());
    fProductCategory_ID.addActionListener(this);
    // @Trifon
    labelAS.setText(Msg.translate(Env.getCtx(), "M_AttributeSet_ID"));
    fAS_ID = new VLookup("M_AttributeSet_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MAttributeSet.Table_Name, MAttributeSet.COLUMNNAME_M_AttributeSet_ID), DisplayType.TableDir));
    fAS_ID.setBackground(AdempierePLAF.getInfoBackground());
    fAS_ID.addActionListener(this);
    //
    labelASI.setText(Msg.translate(Env.getCtx(), "M_AttributeSetInstance_ID"));
    MPAttributeLookup mpaLookup = new MPAttributeLookup(Env.getCtx(), p_WindowNo);
    fASI_ID = new VPAttribute((GridTab) null, false, false, true, p_WindowNo, mpaLookup, true);
    fASI_ID.setBackground(AdempierePLAF.getInfoBackground());
    fASI_ID.addActionListener(this);
    labelVendor.setText(Msg.translate(Env.getCtx(), "Vendor"));
    fVendor_ID = new VLookup("C_BPartner_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MProductPO.Table_Name, MProductPO.COLUMNNAME_C_BPartner_ID), DisplayType.Search));
    fVendor_ID.setBackground(AdempierePLAF.getInfoBackground());
    fVendor_ID.addActionListener(this);
    // Override the isSOTrx context, Vendors only
    fVendor_ID.setIsSOTrx(true, false);
    //  Setup the Grid
    //	Line 1
    p_criteriaGrid.add(labelValue, new ALayoutConstraint(0, 0));
    p_criteriaGrid.add(fieldValue, null);
    p_criteriaGrid.add(labelWarehouse, null);
    p_criteriaGrid.add(fWarehouse_ID, null);
    p_criteriaGrid.add(checkOnlyStock, new ALayoutConstraint(0, 5));
    //	Line 2
    p_criteriaGrid.add(labelName, new ALayoutConstraint(1, 0));
    p_criteriaGrid.add(fieldName, null);
    p_criteriaGrid.add(labelPriceList, null);
    p_criteriaGrid.add(fPriceList_ID, null);
    // @Trifon
    p_criteriaGrid.add(labelAS, null);
    // @Trifon
    p_criteriaGrid.add(fAS_ID, null);
    // Line 3
    p_criteriaGrid.add(labelUPC, new ALayoutConstraint(2, 0));
    p_criteriaGrid.add(fieldUPC, null);
    p_criteriaGrid.add(labelProductCategory, null);
    p_criteriaGrid.add(fProductCategory_ID, null);
    p_criteriaGrid.add(labelASI, null);
    p_criteriaGrid.add(fASI_ID, null);
    //  Line 4
    p_criteriaGrid.add(labelSKU, new ALayoutConstraint(3, 0));
    p_criteriaGrid.add(fieldSKU, null);
    p_criteriaGrid.add(labelVendor, null);
    p_criteriaGrid.add(fVendor_ID, null);
    p_criteriaGrid.add(checkAND, new ALayoutConstraint(3, 5));
    //	Product Attribute Instance
    m_PAttributeButton = ConfirmPanel.createPAttributeButton(true);
    confirmPanel.addButton(m_PAttributeButton);
    m_PAttributeButton.addActionListener(this);
    m_PAttributeButton.setEnabled(false);
    //Begin - fer_luck @ centuryon
    //add taskpane
    fieldDescription.setBackground(AdempierePLAF.getInfoBackground());
    fieldDescription.setEditable(false);
    fieldDescription.setPreferredSize(new Dimension(INFO_WIDTH - 100, 100));
    fieldPAttributes.setBackground(AdempierePLAF.getInfoBackground());
    fieldPAttributes.setEditable(false);
    fieldPAttributes.setPreferredSize(new Dimension(INFO_WIDTH - 100, 100));
    ColumnInfo[] s_layoutWarehouse = new ColumnInfo[] { new ColumnInfo(" ", "M_Warehouse_ID", IDColumn.class), new ColumnInfo(Msg.translate(Env.getCtx(), "WarehouseName"), "WarehouseName", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class, true, true, null), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "sum(QtyOnHand)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "sum(QtyReserved)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOrdered"), "sum(QtyOrdered)", Double.class) };
    //        		new ColumnInfo(Msg.translate(Env.getCtx(), "DocumentNote"), "DocumentNote", String.class)};
    /**	From Clause							*/
    String s_sqlFrom = " M_PRODUCT_STOCK_V ";
    /** Where Clause						*/
    String s_sqlWhere = "(QtyOnHand <> 0 OR QtyAvailable <> 0 OR QtyReserved <> 0 OR QtyOrdered <> 0) AND M_Product_ID = ?";
    m_sqlWarehouse = warehouseTbl.prepareTable(s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
    m_sqlWarehouse += " Group By M_Warehouse_ID, WarehouseName ";
    m_sqlWarehouse += " Order By sum(QtyOnHand) DESC, WarehouseName ";
    warehouseTbl.setRowSelectionAllowed(true);
    warehouseTbl.setMultiSelection(false);
    warehouseTbl.addMouseListener(this);
    warehouseTbl.setShowTotals(true);
    warehouseTbl.autoSize();
    ColumnInfo[] s_layoutSubstitute = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Description"), "description", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), "value", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class, true, true, null), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class) };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'S'";
    m_sqlSubstitute = substituteTbl.prepareTable(s_layoutSubstitute, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    substituteTbl.setRowSelectionAllowed(false);
    substituteTbl.setMultiSelection(false);
    substituteTbl.addMouseListener(this);
    substituteTbl.setShowTotals(false);
    substituteTbl.autoSize();
    ColumnInfo[] s_layoutRelated = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Description"), "description", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), "value", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class, true, true, null), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class) };
    s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
    s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'R'";
    m_sqlRelated = relatedTbl.prepareTable(s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
    relatedTbl.setRowSelectionAllowed(false);
    relatedTbl.setMultiSelection(false);
    relatedTbl.addMouseListener(this);
    relatedTbl.setShowTotals(false);
    relatedTbl.autoSize();
    //Available to Promise Tab
    initAtpTab();
    m_tableAtp.setRowSelectionAllowed(false);
    m_tableAtp.setMultiSelection(false);
    //Vendor tab
    ColumnInfo[] s_layoutVendor = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Vendor"), "(SELECT bp.Name FROM C_BPartner bp WHERE bp.C_BPartner_ID = M_PRODUCT_PO.C_BPartner_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "IsCurrentVendor"), "IsCurrentVendor", Boolean.class), new ColumnInfo(Msg.translate(Env.getCtx(), "C_UOM_ID"), "(SELECT Name FROM C_UOM WHERE C_UOM_ID = M_PRODUCT_PO.C_UOM_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "C_Currency_ID"), "(SELECT iso_code FROM C_Currency WHERE C_Currency_ID = M_PRODUCT_PO.C_Currency_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceList"), "PriceList", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PricePO"), "PricePO", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "VendorProductNo"), "VendorProductNo", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Order_Min"), "Order_Min", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "DeliveryTime_Promised"), "DeliveryTime_Promised", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "DeliveryTime_Actual"), "DeliveryTime_Actual", Double.class) };
    s_sqlFrom = "M_PRODUCT_PO";
    s_sqlWhere = "M_Product_ID = ?";
    m_sqlVendor = vendorTbl.prepareTable(s_layoutVendor, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_PO");
    vendorTbl.setRowSelectionAllowed(false);
    vendorTbl.setMultiSelection(false);
    vendorTbl.addMouseListener(this);
    vendorTbl.setShowTotals(false);
    vendorTbl.autoSize();
    jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl));
    jTab.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 250 : 105));
    jTab.addTab(Msg.translate(Env.getCtx(), "Description"), new JScrollPane(fieldDescription));
    jTab.addTab(Msg.translate(Env.getCtx(), "ProductAttribute"), new JScrollPane(fieldPAttributes));
    jTab.addTab(Msg.translate(Env.getCtx(), "Substitute_ID"), new JScrollPane(substituteTbl));
    jTab.addTab(Msg.translate(Env.getCtx(), "RelatedProduct_ID"), new JScrollPane(relatedTbl));
    jTab.addTab(Msg.getMsg(Env.getCtx(), "ATP"), new JScrollPane(m_tableAtp));
    jTab.addTab(Msg.translate(Env.getCtx(), "Vendor"), new JScrollPane(vendorTbl));
    jTab.addChangeListener(this);
    tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110));
    tablePanel.setLayout(new BorderLayout());
    tablePanel.add(jTab, BorderLayout.CENTER);
    //  Add the details to the p_detailPanel
    p_detailTaskPane.setTitle(Msg.translate(Env.getCtx(), "WarehouseStock"));
    p_detailTaskPane.add(checkShowDetail, BorderLayout.NORTH);
    p_detailTaskPane.add(tablePanel, BorderLayout.CENTER);
    p_detailTaskPane.setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) VPAttribute(org.compiere.grid.ed.VPAttribute) BorderLayout(java.awt.BorderLayout) GridTab(org.compiere.model.GridTab) VLookup(org.compiere.grid.ed.VLookup) ALayoutConstraint(org.compiere.apps.ALayoutConstraint) ColumnInfo(org.compiere.minigrid.ColumnInfo) Dimension(java.awt.Dimension) MPAttributeLookup(org.compiere.model.MPAttributeLookup)

Example 17 with GridTab

use of org.compiere.model.GridTab in project adempiere by adempiere.

the class WWindow method getSR_Form.

//  getFieldValue
/**************************************************************************
	 *	Return SingleRow Form details
	 *  @param action action
	 *  @param wsc web session context
	 *  @param ws window status
	 *  @return Form
	 */
public MobileDoc getSR_Form(String action, MobileSessionCtx wsc, WWindowStatus ws) {
    log.fine("Tab=" + ws.curTab.getTabNo());
    form line = new form("WWindow");
    line.addAttribute("selected", "true");
    line.setClass("panel");
    line.setMethod("post");
    line.setTitle(ws.curTab.getName());
    // line.setTarget("_self");
    fs = new fieldset();
    line.addElement(fs);
    /**********************
		 *  For all Fields
		 */
    StringBuffer scriptSrc = new StringBuffer();
    MRole role = MRole.getDefault(wsc.ctx, false);
    //
    //Modified by Rob Klein 4/29/07
    m_searchField = null;
    boolean isTabRO = ws.isReadOnlyView();
    if (ws.curTab.isDisplayed()) {
        int noFields = ws.curTab.getFieldCount();
        for (int i = 0; i < noFields; i++) {
            GridField field = ws.curTab.getField(i);
            String columnName = field.getColumnName();
            /**
				 *  Get Data and convert to String (singleRow)
				 */
            Object oData = ws.curTab.getValue(field);
            //Modified by Rob Klein 4/29/07
            /**
				 *  Get Record ID and Table ID for Processes
				 */
            int recordID = ws.curTab.getRecord_ID();
            int tableID = ws.curTab.getAD_Table_ID();
            /**
				 *  Display field
				 */
            if (field.isDisplayed(true) && field.getDisplayType() != DisplayType.Button) {
                /* todo chart support
					if ( ws.isReadOnlyView() && field.getDisplayType()== 53370 )
					{
						img chart = getChart(field.getAD_Chart_ID(), sess);
						div div = new div();
						div.setClass("row");
						if ( chart != null )
						{
							div.addElement(chart);
							fs.addElement(div);
						}
					}
					else */
                {
                    //
                    boolean hasDependents = ws.curTab.hasDependants(columnName);
                    //Modified by Rob Klein 4/29/07
                    addField(wsc, line, field, oData, hasDependents, recordID, tableID, isTabRO, i, ws.curTab, role);
                    //  Additional Values
                    String dispLogic = field.getDisplayLogic();
                    if (dispLogic != null && dispLogic.length() > 0) {
                        //  replace ' with "
                        dispLogic = dispLogic.replace('\'', '"');
                        scriptSrc.append("document.").append(FORM_NAME).append(".").append(columnName).append(".displayLogic='").append(dispLogic).append("';\n");
                    }
                }
            }
        }
    //	for all fields			
    }
    //	displayed
    /*if (scriptSrc.length() > 0)
			table.addElement(new script(scriptSrc.toString()));*/
    //  Status Line
    int rowNo = ws.curTab.getCurrentRow();
    String statusDB = String.valueOf(rowNo + 1) + " / " + ws.curTab.getRowCount();
    // return createLayout (action, new ul(), wsc, ws, ws.curTab.getDescription(), statusDB);
    if (ws.isReadOnlyView()) {
        for (int i = ws.curTab.getTabNo() + 1; i < ws.mWindow.getTabCount(); i++) {
            GridTab tab = ws.mWindow.getTab(i);
            if (tab.getTabNo() >= ws.curTab.getTabNo() && tab.getTabLevel() <= ws.curTab.getTabLevel())
                // past all children of curTab
                break;
            if (tab.getTabLevel() != ws.curTab.getTabLevel() + 1)
                // not direct child
                continue;
            if (tab.isSortTab())
                continue;
            //Modified by Rob Klein 4/29/07
            a big = new a("WWindow?tab=" + i, tab.getName());
            big.setClass("whiteButton");
            big.setTarget("_self");
            line.addElement(big);
        }
    }
    if (!ws.isReadOnlyView()) {
        a button = new a("#", "Save");
        button.addAttribute("type", "submit");
        button.setClass("redButton");
        // a.setTarget("_self");
        line.addElement(button);
    }
    MobileDoc doc = createPage(ws);
    doc.getBody().addElement(line);
    div div = new div();
    div.setClass("toolbar");
    h1 header = new h1();
    header.setID("pageTitle");
    div.addElement(header);
    a anchor = new a();
    anchor.setClass("button");
    anchor.setHref(MobileEnv.getBaseDirectory("WMenu"));
    anchor.setTarget("_self");
    anchor.addElement("Menu");
    div.addElement(anchor);
    anchor = new a("WWindow?action=list", "Back");
    anchor.setID("previousButton");
    anchor.setClass("button");
    anchor.setTarget("_self");
    div.addElement(anchor);
    doc.getBody().addElement(div);
    if (!ws.curTab.isReadOnly() && ws.isReadOnlyView()) {
        div = new div();
        div.setClass("footer");
        a a = new a("WWindow?action=edit", "Edit");
        a.setClass("redButton");
        a.setTarget("_self");
        div.addElement(a);
        doc.getBody().addElement(div);
    }
    return doc;
}
Also used : org.apache.ecs.xhtml.a(org.apache.ecs.xhtml.a) MRole(org.compiere.model.MRole) org.apache.ecs.xhtml.fieldset(org.apache.ecs.xhtml.fieldset) org.apache.ecs.xhtml.h1(org.apache.ecs.xhtml.h1) GridField(org.compiere.model.GridField) org.apache.ecs.xhtml.div(org.apache.ecs.xhtml.div) org.apache.ecs.xhtml.form(org.apache.ecs.xhtml.form) GridTab(org.compiere.model.GridTab)

Example 18 with GridTab

use of org.compiere.model.GridTab in project adempiere by adempiere.

the class GridTabWrapper method save.

public static void save(Object model) {
    GridTab gridTab = getGridTab(model);
    // We save the GridTab because else, even if there is no change it will return false
    boolean manualCmd = false;
    boolean ok = gridTab.dataSave(manualCmd);
    if (!ok)
        // TODO: fetch the actual error message
        throw new AdempiereException("Error saving " + model);
}
Also used : GridTab(org.compiere.model.GridTab) AdempiereException(org.adempiere.exceptions.AdempiereException)

Example 19 with GridTab

use of org.compiere.model.GridTab in project adempiere by adempiere.

the class GridTabWrapper method create.

public static <T> T create(Object model, Class<T> cl) {
    if (model == null)
        return null;
    GridTab gridTab = null;
    if (model instanceof GridTab)
        gridTab = (GridTab) model;
    if (gridTab == null)
        gridTab = getGridTab(model);
    if (gridTab == null) {
        throw new AdempiereException("Cannot wrap " + model + " (class:" + model.getClass());
    }
    //
    // Check if given interface is compatible with gridTab, i.e.
    // * interface does not define a Table_Name field
    // * interface has a Table_Name static field, which is equal with gridTab's Table_Name
    final String interfaceTableName = InterfaceWrapperHelper.getTableNameOrNull(cl);
    if (interfaceTableName != null && !interfaceTableName.equals(gridTab.getTableName())) {
        throw new AdempiereException("Interface " + cl + " (tableName=" + interfaceTableName + ") is not compatible with " + gridTab + " (tableName=" + gridTab.getTableName() + ")");
    }
    @SuppressWarnings("unchecked") final T result = (T) Proxy.newProxyInstance(cl.getClassLoader(), new Class<?>[] { cl }, new GridTabWrapper(gridTab));
    return result;
}
Also used : GridTab(org.compiere.model.GridTab) AdempiereException(org.adempiere.exceptions.AdempiereException)

Example 20 with GridTab

use of org.compiere.model.GridTab 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

GridTab (org.compiere.model.GridTab)38 GridField (org.compiere.model.GridField)10 MQuery (org.compiere.model.MQuery)8 AdempiereException (org.adempiere.exceptions.AdempiereException)4 Point (java.awt.Point)3 MRole (org.compiere.model.MRole)3 PO (org.compiere.model.PO)3 Dimension (java.awt.Dimension)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 MBrowse (org.adempiere.model.MBrowse)2 ProcessModalDialog (org.adempiere.webui.apps.ProcessModalDialog)2 org.apache.ecs.xhtml.a (org.apache.ecs.xhtml.a)2 org.apache.ecs.xhtml.div (org.apache.ecs.xhtml.div)2 org.apache.ecs.xhtml.form (org.apache.ecs.xhtml.form)2 GridController (org.compiere.grid.GridController)2 ICreateFrom (org.compiere.grid.ICreateFrom)2 GridTable (org.compiere.model.GridTable)2 MOrderLine (org.compiere.model.MOrderLine)2