}
private void atualizarFiltro() {
if (!itensFiltrados.isEmpty()) {
for (int i = 0; i < tableModelListeners.size(); i++) {
TableModelEvent event = new TableModelEvent(this, -1, itensFiltrados.size() - 1, TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE);
tableModelListeners.get(i).tableChanged(event);
}
}
itensFiltrados.clear();
String[] tokenFiltro = filtro.split(" ");
for (int i = 0; i < itens.size(); i++) {
E item = itens.get(i);
boolean todos = true;
for (int j = 0; todos && j < tokenFiltro.length; j++) {
todos &= item.getTextoParaPesquisa().contains(tokenFiltro[j]);
}
if (todos) {
itensFiltrados.add(item);
}
}
for (int i = 0; i < tableModelListeners.size(); i++) {
TableModelEvent event = new TableModelEvent(this);//, 0, itensFiltrados.size() - 1, TableModelEvent.ALL_COLUMNS, TableModelEvent.UPDATE);
if (!itensFiltrados.isEmpty()) {
// event = new TableModelEvent(this, 0, 0, TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE);
tableModelListeners.get(i).tableChanged(event);
}