use of javax.swing.table.DefaultTableModel in project Info-Evaluation by TechnionYP5777.
the class FilterByTest method filterByReasonTest.
@Test
public void filterByReasonTest() throws Exception {
final DefaultTableModel expectedTable = new DefaultTableModel(new String[][] { { "Austin Chumlee Russell", "2014-01-09", "sexual assault" }, { "Ben Stiller", "2016-02-12", "sexual assault" }, { "Ben Stiller", "2014-01-09", "sexual assault" }, { "Hugh Jackman", "2014-01-09", "sexual assault" }, { "Austin Chumlee Russell", "2013-03-09", "sexual assault charges" } }, new String[] { "Name", "Date", "Reason" });
final DefaultTableModel outputTable = new DefaultTableModel(new Object[][] { { "" } }, new String[] { "Name", "Date", "Reason" });
rt.filterBy(outputTable, "Reason", "assault", FilterType.CHOOSE_FROM_LIST);
for (int i = 0; i < outputTable.getRowCount(); ++i) for (int j = 0; j < outputTable.getColumnCount(); ++j) assertEquals(expectedTable.getValueAt(i, j), outputTable.getValueAt(i, j));
final DefaultTableModel rightClickExpectedTable = new DefaultTableModel(new String[][] { { "Austin Chumlee Russell", "2013-03-09", "sexual assault charges" } }, new String[] { "Name", "Date", "Reason" });
final DefaultTableModel rightClickOutputTable = new DefaultTableModel(new Object[][] { { "" } }, new String[] { "Name", "Date", "Reason" });
rt.filterBy(rightClickOutputTable, "Reason", "sexual assault charges", FilterType.RIGHT_CLICK);
for (int i = 0; i < rightClickOutputTable.getRowCount(); ++i) for (int j = 0; j < rightClickOutputTable.getColumnCount(); ++j) assertEquals(rightClickExpectedTable.getValueAt(i, j), rightClickOutputTable.getValueAt(i, j));
}
use of javax.swing.table.DefaultTableModel in project adempiere by adempiere.
the class VAllocation method loadBPartner.
// vetoableChange
public void loadBPartner() {
checkBPartner();
Vector<Vector<Object>> data = getPaymentData(multiCurrency.isSelected(), dateField.getValue(), paymentTable);
Vector<String> columnNames = getPaymentColumnNames(multiCurrency.isSelected());
// Remove previous listeners
paymentTable.getModel().removeTableModelListener(this);
// Set Model
DefaultTableModel modelP = new DefaultTableModel(data, columnNames);
modelP.addTableModelListener(this);
paymentTable.setModel(modelP);
setPaymentColumnClass(paymentTable, multiCurrency.isSelected());
//
data = getInvoiceData(multiCurrency.isSelected(), dateField.getValue(), invoiceTable);
columnNames = getInvoiceColumnNames(multiCurrency.isSelected());
// Remove previous listeners
invoiceTable.getModel().removeTableModelListener(this);
// Set Model
DefaultTableModel modelI = new DefaultTableModel(data, columnNames);
modelI.addTableModelListener(this);
invoiceTable.setModel(modelI);
setInvoiceColumnClass(invoiceTable, multiCurrency.isSelected());
//
calculate(multiCurrency.isSelected());
// Calculate Totals
calculate();
}
use of javax.swing.table.DefaultTableModel in project adempiere by adempiere.
the class GridController method dispose.
// jbInit
/**
* Displose
*/
public void dispose() {
log.config("(" + m_mTab.toString() + ")");
// clear info
stopEditor(false);
if (m_mTab.isLoadComplete()) {
if (m_mTab.needSave(true, false))
m_mTab.dataIgnore();
}
// Listeners
if (m_mTab.isLoadComplete()) {
m_mTab.getTableModel().removeDataStatusListener(this);
m_mTab.getTableModel().removeVetoableChangeListener(this);
}
vTable.getSelectionModel().removeListSelectionListener(this);
m_mTab.removePropertyChangeListener(vTable);
// editors
Component[] comp = vPanel.getComponentsRecursive();
for (int i = 0; i < comp.length; i++) {
if (comp[i] instanceof VEditor) {
VEditor vEditor = (VEditor) comp[i];
vEditor.removeVetoableChangeListener(this);
String columnName = comp[i].getName();
GridField mField = m_mTab.getField(columnName);
if (mField != null)
mField.removePropertyChangeListener(vEditor);
vEditor.dispose();
}
}
/** @todo Remove APanel Button listeners */
vTable.removeAll();
// remove reference
vTable.setModel(new DefaultTableModel());
vTable = null;
vPanel.removeAll();
vPanel = null;
//srPane.removeAll();
//srPane = null;
splitPane.removeAll();
splitPane = null;
m_mTab = null;
m_tree = null;
this.removeAll();
}
use of javax.swing.table.DefaultTableModel in project adempiere by adempiere.
the class VFactReconcile method generateReconciliation.
// calculateSelection
/**
* Generate Reconciliation record
*/
private void generateReconciliation() {
log.info("");
//
miniTable.stopEditor(true);
if (miniTable.getRowCount() == 0)
return;
miniTable.setRowSelectionInterval(0, 0);
calculateSelection();
if (m_noSelected == 0)
return;
String format = "yyyy-MM-dd HH:mm:ss.SSS";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(format);
String time = sdf.format(cal.getTime());
String matchcode = "Manual: " + Env.getContext(Env.getCtx(), "#AD_User_Name") + " " + time;
for (int r = 0; r < miniTable.getModel().getRowCount(); r++) {
if (((IDColumn) miniTable.getModel().getValueAt(r, idColIndex)).isSelected()) {
int factId = ((IDColumn) miniTable.getModel().getValueAt(r, idColIndex)).getRecord_ID();
MFactReconciliation rec = new Query(Env.getCtx(), MFactReconciliation.Table_Name, "Fact_Acct_ID = ?", null).setParameters(new Object[] { factId }).first();
if (rec == null) {
rec = new MFactReconciliation(Env.getCtx(), 0, null);
rec.setFact_Acct_ID(factId);
}
rec.setMatchCode(matchcode);
rec.setIsDirectLoad(true);
rec.saveEx();
((DefaultTableModel) miniTable.getModel()).removeRow(r--);
}
}
}
use of javax.swing.table.DefaultTableModel in project adempiere by adempiere.
the class VCreateFromStatementUI method loadTableOIS.
/**
* Load Table Columns
* @param data
*/
private void loadTableOIS(Vector<?> data) {
// Remove previous listeners
v_CreateFromPanel.getMiniTable().removeMiniTableSelectionListener(v_CreateFromPanel);
//dialog.getMiniTable().getModel().removeTableModelListener(dialog);
// Set Model
DefaultTableModel model = new DefaultTableModel(data, getOISColumnNames());
v_CreateFromPanel.getMiniTable().setModel(model);
//
configureMiniTable(v_CreateFromPanel.getMiniTable());
v_CreateFromPanel.getMiniTable().addMiniTableSelectionListener(v_CreateFromPanel);
}
Aggregations