use of org.compiere.grid.ed.VPAttribute 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);
}
use of org.compiere.grid.ed.VPAttribute 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);
}
use of org.compiere.grid.ed.VPAttribute in project adempiere by adempiere.
the class InfoProduct method actionPerformed.
/**************************************************************************
* Action Listener
* @param e event
*/
public void actionPerformed(ActionEvent e) {
if (!p_loadedOK)
return;
String cmd = e.getActionCommand();
Object source = null;
if (e.getSource() != null) {
source = e.getSource();
if (cmd.equals(ConfirmPanel.A_PATTRIBUTE)) {
// when the attribute window is closed.
if (p_table.isMultiSelection()) {
int row = p_table.getSelectionModel().getLeadSelectionIndex();
p_table.setRowChecked(row, true);
}
MProduct mp = MProduct.get(Env.getCtx(), m_M_Product_ID);
// Set title and parameters for the PattributeInstance window
String title = "";
int wh_id = 0;
if (isValidVObject(fWarehouse_ID)) {
title = fWarehouse_ID.getDisplay() + " - " + mp.getName();
wh_id = ((Integer) (fWarehouse_ID.getValue())).intValue();
}
// Get the business partner from the context - it may be different than the Vendor
int bp_id = 0;
String s_bp_id = Env.getContext(Env.getCtx(), p_WindowNo, p_TabNo, "C_BPartner_ID", false);
if (s_bp_id != null && s_bp_id.length() != 0 && (new Integer(s_bp_id).intValue() > 0))
bp_id = new Integer(s_bp_id).intValue();
// Display the window
PAttributeInstance pai = new PAttributeInstance(this, title, wh_id, 0, p_table.getLeadRowKey(), bp_id);
if (!pai.wasCancelled()) {
// Get the results and update the fASI criteria field
m_M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID();
m_M_Locator_ID = pai.getM_Locator_ID();
if (m_M_AttributeSetInstance_ID > 0)
fASI_ID.setValue(m_M_AttributeSetInstance_ID);
else
// No instance
fASI_ID.setValue(0);
}
// looking around.
if (// If the results are saved, we can save now - an ASI is product specific
p_saveResults && m_M_AttributeSetInstance_ID != -1 && !pai.wasCancelled()) {
dispose(p_saveResults);
return;
}
return;
} else if (source instanceof VComboBox) {
if (((VComboBox) source).getParent() instanceof VLookup) {
// Works for VLookups using DisplayType.TableDir
source = ((VComboBox) source).getParent();
VLookup vl = ((VLookup) source);
m_heldLastFocus = vl;
if (cmd.equals("comboBoxEdited")) {
if (!vl.hasChanged() && !hasOutstandingChanges()) {
vl.requestFocus();
return;
}
p_triggerRefresh = true;
// perform field-specific changes
if (vl == fWarehouse_ID) {
if (!isValidVObject(fWarehouse_ID)) {
// Disable the stock button
checkOnlyStock.setSelected(false);
checkOnlyStock.setEnabled(false);
} else
checkOnlyStock.setEnabled(true);
}
}
}
} else if (source instanceof CTextField) {
CTextField tf = ((CTextField) source);
if (tf.getParent() instanceof VPAttribute) {
source = tf.getParent();
VPAttribute vpa = ((VPAttribute) source);
// The VPAttribute field can't hold the focus effectively
m_heldLastFocus = fieldValue;
if (vpa.hasChanged()) {
p_triggerRefresh = true;
}
}
} else if (e.getSource() instanceof VCheckBox) {
// Check box changes generally always cause a refresh
// Capture changes that don't
VCheckBox cb = (VCheckBox) e.getSource();
// ShowDetail check box
if (cb.getName().equals("ShowDetail")) {
// Refresh only the ATP tab
refreshAtpTab();
return;
}
}
}
// e.getSource() is null
// Let the info class decide what to do.
super.actionPerformed(e);
}
Aggregations