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