use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.
the class MarketTableModel method removeCols.
public static void removeCols(JTable marketTable) {
TableColumnModel tcm = marketTable.getColumnModel();
System.out.println("getColumnCount:" + tcm.getColumnCount());
if (tcm.getColumnCount() == 2) {
marketTable.removeColumn(tcm.getColumn(1));
}
}
use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.
the class NYMOutboxTableModel method setValue.
public void setValue(List values, JTable nymOutBox) {
data = new Object[values.size()][];
for (int i = 0; i < values.size(); i++) {
String[] row = (String[]) values.get(i);
data[i] = row;
}
TableColumnModel tcm = nymOutBox.getColumnModel();
System.out.println("nymbox.getColumn(2)" + tcm.getColumnCount());
if (tcm.getColumnCount() == 4) {
nymOutBox.removeColumn(tcm.getColumn(3));
}
fireTableDataChanged();
}
use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.
the class NYMTableModel method setValue.
@Override
public void setValue(Map values, JTable nymTable) {
clearValue();
Set set = values.keySet();
Iterator iterator = set.iterator();
int i = 0;
data = new Object[values.size()][];
while (iterator.hasNext()) {
Integer key = (Integer) iterator.next();
String[] rowData = new String[2];
rowData = (String[]) values.get(key);
/*rowData[0] = (String)values.get(key);
rowData[1] = String.valueOf(key);*/
data[i] = rowData;
i++;
}
/*RowSorter<TableModel> sorter =
new TableRowSorter<TableModel>(this);
nymTable.setRowSorter(sorter);*/
TableColumnModel tcm = nymTable.getColumnModel();
System.out.println("getColumnCount:" + tcm.getColumnCount());
if (tcm.getColumnCount() == 2) {
nymTable.removeColumn(tcm.getColumn(1));
}
fireTableDataChanged();
}
use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.
the class CheckBoxEditor method setValue.
/* public void setValueAt(Object aValue, int row, int column) {
System.out.println("setValueAt:"+aValue+"row:"+row+" col:"+column);
}*/
@Override
public void setValue(Map values, final JTable inbox) {
if (null == values) {
System.out.println("OTInboxTableModel.setValue: Failure: Map 'values' is null.");
return;
}
clearValue();
Set set = values.keySet();
if (null == set) {
System.out.println("OTInboxTableModel.setValue: Failure: values.keySet() returned null.");
return;
}
Iterator iterator = set.iterator();
int i = 0;
data = new Object[values.size()][];
while (iterator.hasNext()) {
try {
String key = (String) iterator.next();
String[] row = (String[]) values.get(key);
Object[] tableData = new Object[12];
for (int j = 0; j < tableData.length - 1; j++) {
tableData[j] = row[j];
}
tableData[7] = Boolean.FALSE;
tableData[8] = Boolean.FALSE;
tableData[9] = key;
tableData[10] = row[8];
tableData[11] = row[9];
data[i] = tableData;
i++;
} catch (Exception e) {
System.out.println("IIIIIII:" + e);
e.printStackTrace();
}
}
/*RowSorter<TableModel> sorter =
new TableRowSorter<TableModel>(this);
inbox.setRowSorter(sorter);*/
TableColumnModel tcm = inbox.getColumnModel();
System.out.println("inbox:" + tcm.getColumnCount());
if (tcm.getColumnCount() == 12) {
inbox.removeColumn(tcm.getColumn(11));
}
if (tcm.getColumnCount() == 11) {
inbox.removeColumn(tcm.getColumn(10));
}
if (tcm.getColumnCount() == 10) {
inbox.removeColumn(tcm.getColumn(9));
}
tcm.getColumn(7).setCellEditor(editorAccept);
// tcm.getColumn(7).setMaxWidth(20);
checkBoxAccept.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("In acion");
if (checkBoxAccept.isSelected()) {
setValueAt(false, inbox.getSelectedRow(), 8);
fireTableCellUpdated(inbox.getSelectedRow(), 8);
// finalReceipt
if ("finalReceipt".equalsIgnoreCase((String) getValueAt(inbox.getSelectedRow(), 3))) {
String finalReceiptRefNo = (String) getValueAt(inbox.getSelectedRow(), 1);
for (int i = 0; i < data.length; i++) {
Object[] row = (Object[]) data[i];
if (finalReceiptRefNo.equals(row[1].toString())) {
setValueAt(true, i, 7);
fireTableCellUpdated(i, 7);
}
}
}
} else {
if ("finalReceipt".equalsIgnoreCase((String) getValueAt(inbox.getSelectedRow(), 3))) {
String finalReceiptRefNo = (String) getValueAt(inbox.getSelectedRow(), 1);
for (int i = 0; i < data.length; i++) {
Object[] row = (Object[]) data[i];
if (finalReceiptRefNo.equals(row[1].toString())) {
setValueAt(false, i, 7);
fireTableCellUpdated(i, 7);
}
}
}
}
}
});
tcm.getColumn(8).setCellEditor(editorReject);
//tcm.getColumn(8).setMaxWidth(20);
checkBoxReject.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("In acion -- reject");
if (checkBoxReject.isSelected()) {
setValueAt(false, inbox.getSelectedRow(), 7);
fireTableCellUpdated(inbox.getSelectedRow(), 7);
}
}
});
fireTableDataChanged();
// tcm.getColumn(8).setCellRenderer(renderer);
}
use of javax.swing.table.TableColumnModel in project otapij by FellowTraveler.
the class ContactTableModel method removeCols.
public static void removeCols(JTable contactTable) {
TableColumnModel tcm = contactTable.getColumnModel();
System.out.println("getColumnCount:" + tcm.getColumnCount());
if (tcm.getColumnCount() == 2) {
contactTable.removeColumn(tcm.getColumn(1));
}
}
Aggregations