The tutorial says...
A SortableTableModel will wrap your own model, handling the sorting. Your own tablemodel will never change when the user sorts a column!
You will have to take care of the conversion of rowIndexes of the table to the rowIndexes of your model.
You can use the getSelectedRow(JTable) and getSelectedRows(JTable) of the TableUtils utility class.
public class TestTableView extends AbstractView {
private ListTableModel model;
private JTable table;
protected JComponent createControl() {
model = …
table = TableUtils.createStandardSortableTable(model);
return new JScrollPane(table);
}
private Object getSelectedRow()
{
int rowIndex = TableUtils.getSelectedRow(table);
return model.getRow(rowIndex);
}
}
Any advice how to connect rowIndexes of the table to the rowIndexes of the model after sorting?
The "TableUtils.getSelectedRow(table)" does not exist.


Reply With Quote