Fix display of "nothing found" label in thumb overviews

This commit is contained in:
0xb00bface 2021-03-27 18:46:13 +01:00
parent f57f36de05
commit 0e014f8d8d
1 changed files with 24 additions and 24 deletions

View File

@ -383,11 +383,6 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
// move models, which are tracked by the recorder to the front
moveActiveRecordingsToFront();
// show "empty" label, if grid is still empty
if (grid.getChildren().isEmpty()) {
nodes.add(noResultsFound);
}
} finally {
gridLock.unlock();
}
@ -795,31 +790,36 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
insert(thumbCell);
}
filteredThumbCells.clear();
return;
}
} else {
// remove the ones from grid, which don't match
for (Iterator<Node> iterator = grid.getChildren().iterator(); iterator.hasNext();) {
Node node = iterator.next();
if (node instanceof ThumbCell) {
ThumbCell cell = (ThumbCell) node;
Model m = cell.getModel();
if (!matches(m, filter)) {
iterator.remove();
filteredThumbCells.add(cell);
cell.setSelected(false);
}
}
}
// remove the ones from grid, which don't match
for (Iterator<Node> iterator = grid.getChildren().iterator(); iterator.hasNext();) {
Node node = iterator.next();
if (node instanceof ThumbCell) {
ThumbCell cell = (ThumbCell) node;
Model m = cell.getModel();
if (!matches(m, filter)) {
// add the ones, which might have been filtered before, but now match
for (Iterator<ThumbCell> iterator = filteredThumbCells.iterator(); iterator.hasNext();) {
ThumbCell thumbCell = iterator.next();
Model m = thumbCell.getModel();
if(matches(m, filter)) {
iterator.remove();
filteredThumbCells.add(cell);
cell.setSelected(false);
insert(thumbCell);
}
}
}
// add the ones, which might have been filtered before, but now match
for (Iterator<ThumbCell> iterator = filteredThumbCells.iterator(); iterator.hasNext();) {
ThumbCell thumbCell = iterator.next();
Model m = thumbCell.getModel();
if(matches(m, filter)) {
iterator.remove();
insert(thumbCell);
}
if (grid.getChildren().size() > 1 && grid.getChildren().contains(noResultsFound)) {
grid.getChildren().remove(noResultsFound);
} else if (grid.getChildren().isEmpty()) {
grid.getChildren().add(noResultsFound);
}
}