use of javax.swing.RowFilter in project omegat by omegat-org.
the class IssuesPanelController method updateFilter.
void updateFilter() {
int[] selection = panel.typeList.getSelectedIndices();
if (selection.length == 0) {
return;
}
TypeListModel model = ((TypeListModel) panel.typeList.getModel());
List<String> types = model.getTypesAt(selection);
@SuppressWarnings("unchecked") TableRowSorter<IssuesTableModel> sorter = (TableRowSorter<IssuesTableModel>) panel.table.getRowSorter();
sorter.setRowFilter(new RowFilter<IssuesTableModel, Integer>() {
@Override
public boolean include(RowFilter.Entry<? extends IssuesTableModel, ? extends Integer> entry) {
return types.contains(ALL_TYPES) || types.contains(entry.getStringValue(IssueColumn.TYPE.index));
}
});
int totalItems = panel.table.getModel().getRowCount();
if (types.contains(ALL_TYPES)) {
updateTitle(totalItems);
} else {
updateTitle((int) model.getCountAt(selection), totalItems);
}
panel.table.changeSelection(0, 0, false, false);
}
Aggregations