use of org.compiere.minigrid.IDColumn in project adempiere by adempiere.
the class VInOutInvoiceGen method tableChanged.
// stateChanged
/**
* Table Model Listener
* @param e event
*/
public void tableChanged(TableModelEvent e) {
int rowsSelected = 0;
int rows = miniTable.getRowCount();
for (int i = 0; i < rows; i++) {
// ID in column 0
IDColumn id = (IDColumn) miniTable.getValueAt(i, 0);
if (id != null && id.isSelected())
rowsSelected++;
}
statusBar.setStatusDB(" " + rowsSelected + " ");
}
use of org.compiere.minigrid.IDColumn in project adempiere by adempiere.
the class VInOutInvoiceGen method executeQuery.
/**
* Query Info
*/
private void executeQuery() {
log.info("");
int AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
String sql = "";
KeyNamePair docTypeKNPair = (KeyNamePair) cmbDocType.getSelectedItem();
if (docTypeKNPair.getKey() == MRMA.Table_ID) {
sql = getRMASql();
} else {
sql = getOrderSQL();
}
log.fine(sql);
// reset table
int row = 0;
miniTable.setRowCount(row);
// Execute
try {
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, AD_Client_ID);
ResultSet rs = pstmt.executeQuery();
//
while (rs.next()) {
// extend table
miniTable.setRowCount(row + 1);
// set values
// C_Order_ID
miniTable.setValueAt(new IDColumn(rs.getInt(1)), row, 0);
// Org
miniTable.setValueAt(rs.getString(2), row, 1);
// DocType
miniTable.setValueAt(rs.getString(3), row, 2);
// Doc No
miniTable.setValueAt(rs.getString(4), row, 3);
// BPartner
miniTable.setValueAt(rs.getString(5), row, 4);
// DateOrdered
miniTable.setValueAt(rs.getTimestamp(6), row, 5);
// TotalLines
miniTable.setValueAt(rs.getBigDecimal(7), row, 6);
// prepare next
row++;
}
rs.close();
pstmt.close();
} catch (SQLException e) {
log.log(Level.SEVERE, sql.toString(), e);
}
//
miniTable.autoSize();
// statusBar.setStatusDB(String.valueOf(miniTable.getRowCount()));
}
use of org.compiere.minigrid.IDColumn in project lar_361 by comitsrl.
the class InvoiceGen method saveSelection.
// executeQuery
/**
* Save Selection & return selecion Query or ""
* @return where clause like C_Order_ID IN (...)
*/
public void saveSelection(IMiniTable miniTable) {
log.info("");
// Array of Integers
ArrayList<Integer> results = new ArrayList<Integer>();
setSelection(null);
// Get selected entries
int rows = miniTable.getRowCount();
for (int i = 0; i < rows; i++) {
// ID in column 0
IDColumn id = (IDColumn) miniTable.getValueAt(i, 0);
// log.fine( "Row=" + i + " - " + id);
if (id != null && id.isSelected())
results.add(id.getRecord_ID());
}
if (results.size() == 0)
return;
log.config("Selected #" + results.size());
setSelection(results);
}
use of org.compiere.minigrid.IDColumn in project lar_361 by comitsrl.
the class Info method actionPerformed.
// getSelectedSQL;
/**
************************************************************************
* (Button) Action Listener & Popup Menu
* @param e event
*/
public void actionPerformed(ActionEvent e) {
// Popup => Calculator
if (e.getSource().equals(calcMenu)) {
BigDecimal number = null;
Object data = p_table.getSelectedValue();
try {
if (data != null) {
if (data instanceof BigDecimal)
number = (BigDecimal) data;
else
number = new BigDecimal(data.toString());
}
} catch (Exception ex) {
}
Calculator c = new Calculator(null, number);
c.setVisible(true);
return;
}
// popup
// Confirm Panel
String cmd = e.getActionCommand();
if (cmd.equals(ConfirmPanel.A_OK)) {
dispose(true);
} else if (cmd.equals(ConfirmPanel.A_CANCEL)) {
m_cancel = true;
dispose(false);
} else //
if (cmd.equals(ConfirmPanel.A_HISTORY))
showHistory();
else if (cmd.equals(ConfirmPanel.A_CUSTOMIZE))
customize();
else if (cmd.equals(ConfirmPanel.A_ZOOM))
zoom();
else if (cmd.equals(ConfirmPanel.A_RESET))
doReset();
else if (cmd.equals(ConfirmPanel.A_PRINT))
PrintScreenPainter.printScreen(this);
else // @fchiappano Boton seleccionar todo
if (cmd.equals(SELECT_DESELECT_ALL)) {
TableModel model = p_table.getModel();
int rows = model.getRowCount() - 1;
Boolean selectAll = selectDeselectAllAction.isPressed() ? Boolean.FALSE : Boolean.TRUE;
for (int i = 0; i < rows; i++) {
Object linea = model.getValueAt(i, 0);
if (linea != null)
((IDColumn) linea).setSelected(selectAll);
else
rows++;
}
p_table.updateUI();
} else
// Default
executeQuery();
}
Aggregations