Search in sources :

Example 96 with DefaultTableModel

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));
}
Also used : DefaultTableModel(javax.swing.table.DefaultTableModel) Test(org.junit.Test)

Example 97 with DefaultTableModel

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();
}
Also used : DefaultTableModel(javax.swing.table.DefaultTableModel) Vector(java.util.Vector)

Example 98 with DefaultTableModel

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();
}
Also used : DefaultTableModel(javax.swing.table.DefaultTableModel) VEditor(org.compiere.grid.ed.VEditor) VString(org.compiere.grid.ed.VString) GridField(org.compiere.model.GridField) Component(java.awt.Component)

Example 99 with DefaultTableModel

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--);
        }
    }
}
Also used : IDColumn(org.compiere.minigrid.IDColumn) Query(org.compiere.model.Query) MFactReconciliation(org.compiere.model.MFactReconciliation) Calendar(java.util.Calendar) DefaultTableModel(javax.swing.table.DefaultTableModel) SimpleDateFormat(java.text.SimpleDateFormat)

Example 100 with DefaultTableModel

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);
}
Also used : DefaultTableModel(javax.swing.table.DefaultTableModel)

Aggregations

DefaultTableModel (javax.swing.table.DefaultTableModel)119 Vector (java.util.Vector)12 JTable (javax.swing.JTable)12 JBTable (com.intellij.ui.table.JBTable)10 Dimension (java.awt.Dimension)9 JScrollPane (javax.swing.JScrollPane)9 TableColumn (javax.swing.table.TableColumn)9 ActionEvent (java.awt.event.ActionEvent)7 JButton (javax.swing.JButton)7 JPanel (javax.swing.JPanel)7 ListSelectionEvent (javax.swing.event.ListSelectionEvent)7 ListSelectionListener (javax.swing.event.ListSelectionListener)7 WebAppDetails (com.microsoft.azuretools.utils.WebAppUtils.WebAppDetails)6 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)5 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 DockerHost (com.microsoft.azure.docker.model.DockerHost)5 EditableDockerHost (com.microsoft.azure.docker.model.EditableDockerHost)5 Color (java.awt.Color)5 ActionListener (java.awt.event.ActionListener)5