Search in sources :

Example 21 with TableColumnModel

use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.

the class NYMBoxTableModel method setValue.

public void setValue(Map values, JTable nymBox) {
    clearValue();
    Set set = values.keySet();
    Iterator iterator = set.iterator();
    int i = 0;
    data = new Object[values.size()][];
    while (iterator.hasNext()) {
        String key = (String) iterator.next();
        String[] row = (String[]) values.get(key);
        String[] tableData = new String[6];
        for (int j = 0; j < tableData.length; j++) tableData[j] = row[j];
        data[i] = tableData;
        i++;
    }
    /*RowSorter<TableModel> sorter =
             new TableRowSorter<TableModel>(this);
           nymBox.setRowSorter(sorter);*/
    TableColumnModel tcm = nymBox.getColumnModel();
    System.out.println("col count:" + tcm.getColumnCount());
    if (tcm.getColumnCount() == 6) {
        nymBox.removeColumn(tcm.getColumn(5));
    }
    if (tcm.getColumnCount() == 5) {
        nymBox.removeColumn(tcm.getColumn(4));
    }
    if (tcm.getColumnCount() == 4) {
        nymBox.removeColumn(tcm.getColumn(3));
    }
    fireTableDataChanged();
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) TableColumnModel(javax.swing.table.TableColumnModel)

Example 22 with TableColumnModel

use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.

the class NYMOutboxTableModel method setValue.

public void setValue(Map values, JTable nymOutBox) {
    clearValue();
    Set set = values.keySet();
    Iterator iterator = set.iterator();
    int i = 0;
    data = new Object[values.size()][];
    while (iterator.hasNext()) {
        String key = (String) iterator.next();
        String[] row = (String[]) values.get(key);
        System.out.println("row len:" + row.length);
        String[] tableData = new String[6];
        for (int j = 0; j < tableData.length; j++) tableData[j] = row[j];
        data[i] = tableData;
        i++;
    }
    /* RowSorter<TableModel> sorter =
             new TableRowSorter<TableModel>(this);
           nymOutBox.setRowSorter(sorter);*/
    TableColumnModel tcm = nymOutBox.getColumnModel();
    if (tcm.getColumnCount() == 6) {
        nymOutBox.removeColumn(tcm.getColumn(5));
    }
    if (tcm.getColumnCount() == 5) {
        nymOutBox.removeColumn(tcm.getColumn(4));
    }
    if (tcm.getColumnCount() == 4) {
        nymOutBox.removeColumn(tcm.getColumn(3));
    }
    fireTableDataChanged();
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) TableColumnModel(javax.swing.table.TableColumnModel)

Example 23 with TableColumnModel

use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.

the class NYMTableModel method removeCols.

public static void removeCols(JTable nymTable) {
    TableColumnModel tcm = nymTable.getColumnModel();
    System.out.println("getColumnCount:" + tcm.getColumnCount());
    if (tcm.getColumnCount() == 2) {
        nymTable.removeColumn(tcm.getColumn(1));
    }
}
Also used : TableColumnModel(javax.swing.table.TableColumnModel)

Example 24 with TableColumnModel

use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.

the class BitcoinSentTableModel method setValue.

public void setValue(Map values, JTable sentTable) {
    clearValue();
    System.out.println("values.size():" + values.size());
    Set set = values.keySet();
    Iterator iterator = set.iterator();
    int i = 0;
    data = new Object[values.size()][];
    while (iterator.hasNext()) {
        String key = (String) iterator.next();
        String[] row = (String[]) values.get(key);
        data[i] = row;
        i++;
    }
    /*RowSorter<TableModel> sorter =
             new TableRowSorter<TableModel>(this);
           accountTable.setRowSorter(sorter);*/
    TableColumnModel tcm = sentTable.getColumnModel();
    System.out.println("sentTable.getColumn()" + tcm.getColumnCount());
    if (tcm.getColumnCount() == 6) {
        sentTable.removeColumn(tcm.getColumn(5));
    }
    fireTableDataChanged();
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) TableColumnModel(javax.swing.table.TableColumnModel)

Example 25 with TableColumnModel

use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.

the class CheckBoxEditorCell method setValue.

public void setValue(Map values, JTable cashPurseTable) {
    clearValue();
    System.out.println("In cash purse table mode---set values size:" + values.size());
    Set set = values.keySet();
    Iterator iterator = set.iterator();
    int i = 0;
    data = new Object[values.size()][columnNames.length];
    while (iterator.hasNext()) {
        String key = (String) iterator.next();
        String[] row = (String[]) values.get(key);
        System.out.println("row len:" + row.length);
        Object[] tableData = new Object[columnNames.length];
        for (int j = 0; j < row.length; j++) {
            tableData[j] = row[j];
        }
        tableData[5] = Boolean.FALSE;
        tableData[6] = key;
        data[i] = tableData;
        i++;
    }
    /*RowSorter<TableModel> sorter =
             new TableRowSorter<TableModel>(this);
           cashPurseTable.setRowSorter(sorter);*/
    TableColumnModel tcm = cashPurseTable.getColumnModel();
    System.out.println("cash purse getColumn() count:" + tcm.getColumnCount());
    if (tcm.getColumnCount() == 7) {
        cashPurseTable.removeColumn(tcm.getColumn(6));
    }
    fireTableDataChanged();
}
Also used : Set(java.util.Set) Iterator(java.util.Iterator) TableColumnModel(javax.swing.table.TableColumnModel)

Aggregations

TableColumnModel (javax.swing.table.TableColumnModel)168 TableColumn (javax.swing.table.TableColumn)66 JTable (javax.swing.JTable)34 JScrollPane (javax.swing.JScrollPane)31 JButton (javax.swing.JButton)30 BoxLayout (javax.swing.BoxLayout)24 TableCellEditor (javax.swing.table.TableCellEditor)23 ButtonEditor (jmri.util.table.ButtonEditor)23 ButtonRenderer (jmri.util.table.ButtonRenderer)23 JLabel (javax.swing.JLabel)22 JPanel (javax.swing.JPanel)22 ActionEvent (java.awt.event.ActionEvent)20 ActionListener (java.awt.event.ActionListener)16 FlowLayout (java.awt.FlowLayout)15 Border (javax.swing.border.Border)13 Iterator (java.util.Iterator)12 Set (java.util.Set)12 JTableHeader (javax.swing.table.JTableHeader)12 TableCellRenderer (javax.swing.table.TableCellRenderer)12 Container (java.awt.Container)10