Search in sources :

Example 1 with MPAttributeLookup

use of org.compiere.model.MPAttributeLookup 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 2 with MPAttributeLookup

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

the class InfoProductPanel method initComponents.

//	InfoProductPanel
/**
	 *	initialize fields
	 */
private void initComponents() {
    lblBlank.setValue(" ");
    lblValue = new Label();
    lblValue.setValue(Util.cleanAmp(Msg.translate(Env.getCtx(), "Value")));
    lblName = new Label();
    lblName.setValue(Util.cleanAmp(Msg.translate(Env.getCtx(), "Name")));
    lblUPC = new Label();
    lblUPC.setValue(Msg.translate(Env.getCtx(), "UPC"));
    lblSKU = new Label();
    lblSKU.setValue(Msg.translate(Env.getCtx(), "SKU"));
    lblPriceList = new Label();
    lblPriceList.setValue(Msg.getMsg(Env.getCtx(), "PriceListVersion"));
    // Elaine 2008/11/21
    lblProductCategory = new Label();
    lblProductCategory.setValue(Msg.translate(Env.getCtx(), "M_Product_Category_ID"));
    //
    lblAS = new Label();
    lblAS.setValue(Msg.translate(Env.getCtx(), "M_AttributeSet_ID"));
    lblASI = new Label();
    lblASI.setValue(Msg.translate(Env.getCtx(), "M_AttributeSetInstance_ID"));
    lblWarehouse = new Label();
    lblWarehouse.setValue(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Warehouse")));
    lblVendor = new Label();
    lblVendor.setValue(Msg.translate(Env.getCtx(), "Vendor"));
    checkOnlyStock = new Checkbox();
    checkOnlyStock.setAttribute("zk_component_ID", "Lookup_Criteria_checkOnlyStock");
    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 = new Checkbox();
    checkShowDetail.setAttribute("zk_component_ID", "Lookup_Criteria_checkShowDetail");
    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 = new Checkbox();
    checkAND.setAttribute("zk_component_ID", "Lookup_Criteria_checkAND");
    checkAND.setText(Msg.getMsg(Env.getCtx(), "SearchAND"));
    checkAND.setName("SearchAND");
    checkAND.setTooltiptext(Msg.getMsg(Env.getCtx(), "SearchANDInfo"));
    checkAND.setSelected(true);
    checkAND.addActionListener(this);
    m_InfoPAttributeButton.setImage(ServletFns.resolveThemeURL("~./images/PAttribute16.png"));
    m_InfoPAttributeButton.setTooltiptext(Msg.getMsg(Env.getCtx(), "PAttribute"));
    m_InfoPAttributeButton.addEventListener(Events.ON_CLICK, this);
    fieldValue = new Textbox();
    //fieldValue.setMaxlength(40);
    fieldValue.setAttribute("zk_component_ID", "Lookup_Criteria_fieldValue");
    fieldValue.addEventListener(Events.ON_CHANGE, this);
    //
    fieldName = new Textbox();
    //fieldName.setMaxlength(40);
    fieldName.setAttribute("zk_component_ID", "Lookup_Criteria_fieldName");
    fieldName.addEventListener(Events.ON_CHANGE, this);
    //
    fieldUPC = new Textbox();
    //fieldUPC.setMaxlength(40);
    fieldUPC.setAttribute("zk_component_ID", "Lookup_Criteria_fieldUPC");
    fieldUPC.addEventListener(Events.ON_CHANGE, this);
    //
    fieldSKU = new Textbox();
    //fieldSKU.setMaxlength(40);
    fieldSKU.setAttribute("zk_component_ID", "Lookup_Criteria_fieldSKU");
    fieldSKU.addEventListener(Events.ON_CHANGE, this);
    //
    // Elaine 2008/11/25
    fieldDescription.setMultiline(true);
    fieldDescription.setReadonly(true);
    fieldDescription.setAttribute("zk_component_ID", "Lookup_Field_Description");
    //
    fPriceList_ID = new WTableDirEditor("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.getComponent().addEventListener(Events.ON_CHANGE, this);
    fPriceList_ID.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_M_PriceList_Version_ID");
    fPriceList_ID.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fPriceList_ID.getComponent().setAttribute("IsDynamic", "True");
    fPriceList_ID.getComponent().setAttribute("fieldName", "fPriceList_ID");
    // Elaine 2008/11/21
    fProductCategory_ID = new WTableDirEditor("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.getComponent().addEventListener(Events.ON_CHANGE, this);
    fProductCategory_ID.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_M_ProductCategory_ID");
    fProductCategory_ID.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fProductCategory_ID.getComponent().setAttribute("IsDynamic", "True");
    fProductCategory_ID.getComponent().setAttribute("fieldName", "fProductCategory_ID");
    //
    fAS_ID = new WTableDirEditor("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.getComponent().addEventListener(Events.ON_CHANGE, this);
    fAS_ID.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_M_PAttributeSet_ID");
    fAS_ID.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fAS_ID.getComponent().setAttribute("IsDynamic", "False");
    fAS_ID.getComponent().setAttribute("fieldName", "fAS_ID");
    fAS_ID.getComponent().setWidth("200px");
    MPAttributeLookup mpaLookup = new MPAttributeLookup(Env.getCtx(), p_WindowNo);
    fASI_ID = new WPAttributeEditor(null, false, false, true, p_WindowNo, mpaLookup, true);
    fASI_ID.addValueChangeListener(this);
    fASI_ID.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_M_PAttributeSetInstance_ID");
    fASI_ID.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fASI_ID.getComponent().setAttribute("IsDynamic", "False");
    fASI_ID.getComponent().setAttribute("fieldName", "fASI_ID");
    fASI_ID.getComponent().setWidth("200px");
    fWarehouse_ID = new WTableDirEditor("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.getComponent().addEventListener(Events.ON_CHANGE, this);
    fWarehouse_ID.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_M_Warehouse_ID");
    fWarehouse_ID.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fWarehouse_ID.getComponent().setAttribute("IsDynamic", "True");
    fWarehouse_ID.getComponent().setAttribute("fieldName", "fWarehouse_ID");
    //fVendor_ID.getComponent().getTextbox().setMaxlength(30);
    // Override the isSOTrx context, Vendors only
    fVendor_ID.setIsSOTrx(true, false);
    fVendor_ID.addValueChangeListener(this);
    fVendor_ID.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_C_BPartner_ID");
    fVendor_ID.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fVendor_ID.getComponent().setAttribute("IsDynamic", "False");
    fVendor_ID.getComponent().setAttribute("fieldName", "fVendor_ID");
    fVendor_ID.getComponent().setWidth("200px");
    // Product Attribute Instance
    m_PAttributeButton = confirmPanel.createButton(ConfirmPanel.A_PATTRIBUTE);
    confirmPanel.addComponentsLeft(m_PAttributeButton);
    m_PAttributeButton.addActionListener(this);
    m_PAttributeButton.setEnabled(false);
    //
    fieldPAttributes.setMultiline(true);
    fieldPAttributes.setReadonly(true);
    fieldPAttributes.setAttribute("zk_component_ID", "Lookup_Field_PAAttributes");
    initAtpTab();
}
Also used : WTableDirEditor(org.adempiere.webui.editor.WTableDirEditor) Checkbox(org.adempiere.webui.component.Checkbox) Label(org.adempiere.webui.component.Label) Textbox(org.adempiere.webui.component.Textbox) MPAttributeLookup(org.compiere.model.MPAttributeLookup) WPAttributeEditor(org.adempiere.webui.editor.WPAttributeEditor)

Example 3 with MPAttributeLookup

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

the class VOrderReceiptIssue method fillPicks.

// init
/**
	 * Fill Picks Column_ID from C_Order This is only run as part of the windows
	 * initialization process
	 * 
	 * @throws Exception
	 *             if Lookups cannot be initialized
	 */
private void fillPicks() throws Exception {
    Properties ctx = Env.getCtx();
    // Base Language
    Language language = Language.getLoginLanguage();
    MLookup orderL = MLookupFactory.get(ctx, m_WindowNo, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_PP_Order_ID), DisplayType.Search, language, "PP_Order_ID", 0, false, "PP_Order.DocStatus = '" + MPPOrder.DOCACTION_Complete + "'");
    orderField = new VLookup("PP_Order_ID", false, false, true, orderL);
    orderField.setBackground(AdempierePLAF.getInfoBackground());
    orderField.addVetoableChangeListener(this);
    MLookup resourceL = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_S_Resource_ID), DisplayType.TableDir);
    resourceField = new VLookup("S_Resource_ID", false, false, false, resourceL);
    MLookup warehouseL = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_Warehouse_ID), DisplayType.TableDir);
    warehouseField = new VLookup("M_Warehouse_ID", false, false, false, warehouseL);
    MLookup productL = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_Product_ID), DisplayType.TableDir);
    productField = new VLookup("M_Product_ID", false, false, false, productL);
    MLookup uomL = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_C_UOM_ID), DisplayType.TableDir);
    uomField = new VLookup("C_UOM_ID", false, false, false, uomL);
    MLookup uomorderL = MLookupFactory.get(ctx, m_WindowNo, 0, MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_C_UOM_ID), DisplayType.TableDir);
    uomorderField = new VLookup("C_UOM_ID", false, false, false, uomorderL);
    MLocatorLookup locatorL = new MLocatorLookup(ctx, m_WindowNo);
    locatorField = new VLocator("M_Locator_ID", true, false, true, locatorL, m_WindowNo);
    MPAttributeLookup attributeL = new MPAttributeLookup(ctx, m_WindowNo);
    attribute = new VPAttribute(false, false, true, m_WindowNo, attributeL, false);
    attribute.setValue(0);
    // Tab, Window
    int m_Window = MWindow.getWindow_ID("Manufacturing Order");
    GridFieldVO vo = GridFieldVO.createStdField(ctx, m_WindowNo, 0, m_Window, MTab.getTab_ID(m_Window, "Order"), false, false, false);
    // M_AttributeSetInstance_ID
    vo.AD_Column_ID = MColumn.getColumn_ID(MPPOrder.Table_Name, MPPOrder.COLUMNNAME_M_AttributeSetInstance_ID);
    GridField field = new GridField(vo);
    attribute.setField(field);
    // 4Layers - Further init
    scrapQtyField.setValue(Env.ZERO);
    rejectQty.setValue(Env.ZERO);
    // 4Layers - end
    pickcombo.addItem(new KeyNamePair(1, Msg.parseTranslation(Env.getCtx(), "@IsBackflush@")));
    pickcombo.addItem(new KeyNamePair(2, Msg.parseTranslation(Env.getCtx(), "@OnlyIssue@")));
    pickcombo.addItem(new KeyNamePair(3, Msg.parseTranslation(Env.getCtx(), "@OnlyReceiptProduct@")));
    pickcombo.addActionListener(this);
    Process.addActionListener(this);
    toDeliverQty.addActionListener(this);
    scrapQtyField.addActionListener(this);
}
Also used : MLocatorLookup(org.compiere.model.MLocatorLookup) VPAttribute(org.compiere.grid.ed.VPAttribute) Language(org.compiere.util.Language) GridFieldVO(org.compiere.model.GridFieldVO) MLookup(org.compiere.model.MLookup) VLookup(org.compiere.grid.ed.VLookup) VLocator(org.compiere.grid.ed.VLocator) GridField(org.compiere.model.GridField) KeyNamePair(org.compiere.util.KeyNamePair) Properties(java.util.Properties) MPAttributeLookup(org.compiere.model.MPAttributeLookup)

Aggregations

MPAttributeLookup (org.compiere.model.MPAttributeLookup)3 VLookup (org.compiere.grid.ed.VLookup)2 VPAttribute (org.compiere.grid.ed.VPAttribute)2 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 Properties (java.util.Properties)1 JScrollPane (javax.swing.JScrollPane)1 Checkbox (org.adempiere.webui.component.Checkbox)1 Label (org.adempiere.webui.component.Label)1 Textbox (org.adempiere.webui.component.Textbox)1 WPAttributeEditor (org.adempiere.webui.editor.WPAttributeEditor)1 WTableDirEditor (org.adempiere.webui.editor.WTableDirEditor)1 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)1 VLocator (org.compiere.grid.ed.VLocator)1 ColumnInfo (org.compiere.minigrid.ColumnInfo)1 GridField (org.compiere.model.GridField)1 GridFieldVO (org.compiere.model.GridFieldVO)1 GridTab (org.compiere.model.GridTab)1 MLocatorLookup (org.compiere.model.MLocatorLookup)1 MLookup (org.compiere.model.MLookup)1