use of org.compiere.minigrid.MiniTable in project adempiere by adempiere.
the class VCreateFromShipmentUI method configureMiniTable.
@Override
protected void configureMiniTable(IMiniTable miniTable) {
super.configureMiniTable(miniTable);
// Set custom cell editor to enable editing locators
MiniTable swingTable = (MiniTable) miniTable;
TableColumn col = swingTable.getColumn(3);
col.setCellEditor(new InnerLocatorTableCellEditor());
}
use of org.compiere.minigrid.MiniTable in project adempiere by adempiere.
the class VMatch method actionPerformed.
// dispose
/**************************************************************************
* Action Listener
* @param e event
*/
public void actionPerformed(ActionEvent e) {
panel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
Integer product = onlyProduct.getValue() != null ? (Integer) onlyProduct.getValue() : null;
Integer vendor = onlyVendor.getValue() != null ? (Integer) onlyVendor.getValue() : null;
Timestamp from = dateFrom.getValue() != null ? (Timestamp) dateFrom.getValue() : null;
Timestamp to = dateTo.getValue() != null ? (Timestamp) dateTo.getValue() : null;
if (e.getSource() == matchFrom) {
String selection = (String) matchFrom.getSelectedItem();
matchTo.setModel(new DefaultComboBoxModel(cmd_matchFrom(selection)));
// Set Title
xMatchedBorder.setTitle(selection);
xMatchedScrollPane.repaint();
// Reset Table
xMatchedTable.setRowCount(0);
// sync To
cmd_matchTo();
} else if (e.getSource() == matchTo)
cmd_matchTo();
else if (e.getSource() == bSearch) {
xMatchedTable = (MiniTable) cmd_search(xMatchedTable, matchFrom.getSelectedIndex(), (String) matchTo.getSelectedItem(), product, vendor, from, to, matchMode.getSelectedIndex() == MODE_MATCHED);
xMatched.setValue(Env.ZERO);
// Status Info
statusBar.setStatusLine(matchFrom.getSelectedItem().toString() + "# = " + xMatchedTable.getRowCount(), xMatchedTable.getRowCount() == 0);
statusBar.setStatusDB(0);
} else if (e.getSource() == bProcess) {
cmd_process(xMatchedTable, xMatchedToTable, matchMode.getSelectedIndex(), matchFrom.getSelectedIndex(), matchTo.getSelectedItem(), m_xMatched);
xMatchedTable = (MiniTable) cmd_search(xMatchedTable, matchFrom.getSelectedIndex(), (String) matchTo.getSelectedItem(), product, vendor, from, to, matchMode.getSelectedIndex() == MODE_MATCHED);
xMatched.setValue(Env.ZERO);
// Status Info
statusBar.setStatusLine(matchFrom.getSelectedItem().toString() + "# = " + xMatchedTable.getRowCount(), xMatchedTable.getRowCount() == 0);
statusBar.setStatusDB(0);
} else if (e.getSource() == sameBPartner || e.getSource() == sameProduct || e.getSource() == sameQty)
xMatchedTable = (MiniTable) cmd_search(xMatchedTable, matchFrom.getSelectedIndex(), (String) matchTo.getSelectedItem(), product, vendor, from, to, matchMode.getSelectedIndex() == MODE_MATCHED);
panel.setCursor(Cursor.getDefaultCursor());
}
use of org.compiere.minigrid.MiniTable in project adempiere by adempiere.
the class InvoiceHistory method initUnconfirmedTab.
// initReservedOrderedTab
/**
* Query Unconfirmed
*/
private void initUnconfirmedTab() {
// Done already
if (m_modelUnconfirmed != null)
return;
// Header
Vector<String> columnNames = new Vector<String>();
columnNames.add(Msg.translate(Env.getCtx(), m_C_BPartner_ID == 0 ? "C_BPartner_ID" : "M_Product_ID"));
columnNames.add(Msg.translate(Env.getCtx(), "MovementQty"));
columnNames.add(Msg.translate(Env.getCtx(), "MovementDate"));
columnNames.add(Msg.translate(Env.getCtx(), "IsSOTrx"));
columnNames.add(Msg.translate(Env.getCtx(), "DocumentNo"));
columnNames.add(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
// Fill Data
String sql = null;
int parameter = 0;
if (m_C_BPartner_ID == 0) {
sql = "SELECT bp.Name," + " CASE WHEN io.IsSOTrx='Y' THEN iol.MovementQty*-1 ELSE iol.MovementQty END AS MovementQty," + " io.MovementDate,io.IsSOTrx," + " dt.PrintName || ' ' || io.DocumentNo As DocumentNo," + " w.Name " + "FROM M_InOutLine iol" + " INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)" + " INNER JOIN C_BPartner bp ON (io.C_BPartner_ID=bp.C_BPartner_ID)" + " INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID)" + " INNER JOIN M_Warehouse w ON (io.M_Warehouse_ID=w.M_Warehouse_ID)" + " INNER JOIN M_InOutLineConfirm lc ON (iol.M_InOutLine_ID=lc.M_InOutLine_ID) " + "WHERE iol.M_Product_ID=?" + " AND lc.Processed='N' " + "ORDER BY io.MovementDate,io.IsSOTrx";
parameter = m_M_Product_ID;
} else {
sql = "SELECT p.Name," + " CASE WHEN io.IsSOTrx='Y' THEN iol.MovementQty*-1 ELSE iol.MovementQty END AS MovementQty," + " io.MovementDate,io.IsSOTrx," + " dt.PrintName || ' ' || io.DocumentNo As DocumentNo," + " w.Name " + "FROM M_InOutLine iol" + " INNER JOIN M_InOut io ON (iol.M_InOut_ID=io.M_InOut_ID)" + " INNER JOIN M_Product p ON (iol.M_Product_ID=p.M_Product_ID)" + " INNER JOIN C_DocType dt ON (io.C_DocType_ID=dt.C_DocType_ID)" + " INNER JOIN M_Warehouse w ON (io.M_Warehouse_ID=w.M_Warehouse_ID)" + " INNER JOIN M_InOutLineConfirm lc ON (iol.M_InOutLine_ID=lc.M_InOutLine_ID) " + "WHERE io.C_BPartner_ID=?" + " AND lc.Processed='N' " + "ORDER BY io.MovementDate,io.IsSOTrx";
parameter = m_C_BPartner_ID;
}
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, parameter);
rs = pstmt.executeQuery();
while (rs.next()) {
Vector<Object> line = new Vector<Object>(6);
// 1-Name, 2-MovementQty, 3-MovementDate, 4-IsSOTrx, 5-DocumentNo
// Name
line.add(rs.getString(1));
// Qty
line.add(new Double(rs.getDouble(2)));
// Date
line.add(rs.getTimestamp(3));
// IsSOTrx
line.add(new Boolean("Y".equals(rs.getString(4))));
// DocNo
line.add(rs.getString(5));
// Warehouse
line.add(rs.getString(6));
data.add(line);
}
} catch (SQLException e) {
log.log(Level.SEVERE, sql, e);
} finally {
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
log.fine("#" + data.size());
// Table
m_modelUnconfirmed = new DefaultTableModel(data, columnNames);
m_tableUnconfirmed.setModel(m_modelUnconfirmed);
MiniTable table = m_tableUnconfirmed;
//
// Product/Partner
table.setColumnClass(0, String.class, true);
// MovementQty
table.setColumnClass(1, Double.class, true);
// MovementDate
table.setColumnClass(2, Timestamp.class, true);
// IsSOTrx
table.setColumnClass(3, Boolean.class, true);
// DocNo
table.setColumnClass(4, String.class, true);
// Warehouse
table.setColumnClass(5, String.class, true);
//
table.autoSize();
}
use of org.compiere.minigrid.MiniTable in project adempiere by adempiere.
the class VHRActionNotice method dynInit.
// jbInit
/**
* Fill Picks.
* Column_ID from C_Order
* @throws Exception if Lookups cannot be initialized
*/
public void dynInit() throws Exception {
// Process
fieldProcess = new VComboBox(getProcess());
fieldProcess.addActionListener(this);
fieldProcess.setMandatory(true);
// Employee
fieldEmployee.addActionListener(this);
fieldEmployee.setReadWrite(false);
fieldEmployee.setMandatory(true);
// Concept
fieldConcept.addActionListener(this);
fieldConcept.setReadWrite(false);
fieldConcept.setMandatory(true);
// ValidFrom
fieldValidFrom.setReadWrite(false);
fieldValidFrom.setMandatory(true);
fieldValidFrom.addVetoableChangeListener(this);
// Description
fieldDescription.setValue("");
fieldDescription.setReadWrite(false);
// ColumnType
fieldColumnType = new VLookup("ColumnType", true, true, false, getColumnTypeLookup());
fieldColumnType.setReadWrite(false);
// For Text Message like reference
fieldTextLookup.setReadWrite(true);
// Qty-Amount-Date-Text-RuleEngine
fieldQty.setReadWrite(false);
fieldQty.setDisplayType(DisplayType.Quantity);
fieldQty.setVisible(true);
fieldAmount.setDisplayType(DisplayType.Amount);
fieldAmount.setVisible(false);
fieldDate.setVisible(false);
fieldText.setVisible(false);
fieldTextLookup.setVisible(false);
fieldRuleE.setVisible(false);
//
bOk.addActionListener(this);
// Yamel Senih 2013-03-11
// Fixed columns increment in minitable
miniTable = new MiniTable();
// End Yamel Senih
configureMiniTable(miniTable);
}
use of org.compiere.minigrid.MiniTable in project lar_361 by comitsrl.
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"));
pickWarehouse.setBackground(AdempierePLAF.getInfoBackground());
labelPriceList.setText(Msg.getMsg(Env.getCtx(), "PriceListVersion"));
pickPriceList.setBackground(AdempierePLAF.getInfoBackground());
labelProductCategory.setText(Msg.translate(Env.getCtx(), "M_Product_Category_ID"));
pickProductCategory.setBackground(AdempierePLAF.getInfoBackground());
// @Trifon
labelAS.setText(Msg.translate(Env.getCtx(), "M_AttributeSet_ID"));
pickAS.setBackground(AdempierePLAF.getInfoBackground());
m_InfoPAttributeButton.setMargin(new Insets(2, 2, 2, 2));
m_InfoPAttributeButton.setToolTipText(Msg.getMsg(Env.getCtx(), "InfoPAttribute"));
m_InfoPAttributeButton.addActionListener(this);
labelVendor.setText(Msg.translate(Env.getCtx(), "Vendor"));
fieldVendor.setBackground(AdempierePLAF.getInfoBackground());
fieldVendor.addActionListener(this);
// Line 1
parameterPanel.setLayout(new ALayout());
parameterPanel.add(labelValue, new ALayoutConstraint(0, 0));
parameterPanel.add(fieldValue, null);
parameterPanel.add(labelUPC, null);
parameterPanel.add(fieldUPC, null);
parameterPanel.add(labelWarehouse, null);
parameterPanel.add(pickWarehouse, null);
parameterPanel.add(m_InfoPAttributeButton);
// Line 2
parameterPanel.add(labelName, new ALayoutConstraint(1, 0));
parameterPanel.add(fieldName, null);
parameterPanel.add(labelSKU, null);
parameterPanel.add(fieldSKU, null);
parameterPanel.add(labelVendor, null);
parameterPanel.add(fieldVendor, null);
// Line 3
parameterPanel.add(labelPriceList, new ALayoutConstraint(2, 0));
parameterPanel.add(pickPriceList, null);
parameterPanel.add(labelProductCategory, null);
parameterPanel.add(pickProductCategory, null);
// @Trifon
parameterPanel.add(labelAS, null);
// @Trifon
parameterPanel.add(pickAS, null);
// 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));
warehouseStockPanel.setTitle(Msg.translate(Env.getCtx(), "WarehouseStock"));
warehouseStockPanel.setUI(new AdempiereTaskPaneUI());
warehouseStockPanel.getContentPane().setBackground(new ColorUIResource(251, 248, 241));
warehouseStockPanel.getContentPane().setForeground(new ColorUIResource(251, 0, 0));
ColumnInfo[] s_layoutWarehouse = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "sum(QtyOnHand)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "sum(QtyReserved)", Double.class) };
/**
* From Clause
*/
String s_sqlFrom = " M_PRODUCT_STOCK_V ";
/**
* Where Clause
*/
String s_sqlWhere = "Value = ?";
m_sqlWarehouse = warehouseTbl.prepareTable(s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
m_sqlWarehouse += " Group By Warehouse, documentnote ";
warehouseTbl.setRowSelectionAllowed(true);
warehouseTbl.setMultiSelection(false);
warehouseTbl.addMouseListener(this);
warehouseTbl.getSelectionModel().addListSelectionListener(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(), "Value"), "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), 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.getSelectionModel().addListSelectionListener(this);
substituteTbl.autoSize();
ColumnInfo[] s_layoutRelated = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Value"), "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), 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.getSelectionModel().addListSelectionListener(this);
relatedTbl.autoSize();
// Available to Promise Tab
m_tableAtp.setRowSelectionAllowed(false);
m_tableAtp.setMultiSelection(false);
CTabbedPane jTab = new CTabbedPane();
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(), "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.addChangeListener(this);
tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110));
tablePanel.add(jTab);
warehouseStockPanel.setCollapsed(true);
warehouseStockPanel.add(tablePanel);
this.addonPanel.add(warehouseStockPanel);
this.p_table.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent ke) {
int row = ((MiniTable) ke.getSource()).getSelectedRow();
refresh(((MiniTable) ke.getSource()).getValueAt(row, 2), new BigDecimal(pickWarehouse.getValue().toString()).intValue(), new BigDecimal(pickPriceList.getValue().toString()).intValue());
warehouseStockPanel.setCollapsed(false);
}
});
this.p_table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent me) {
int row = ((MiniTable) me.getSource()).getSelectedRow();
refresh(((MiniTable) me.getSource()).getValueAt(row, 2), new BigDecimal(pickWarehouse.getValue().toString()).intValue(), new BigDecimal(pickPriceList.getValue().toString()).intValue());
warehouseStockPanel.setCollapsed(false);
}
});
// End - fer_luck @ centuryon
}
Aggregations