Show progress indicator and a label if nothing was found

This commit is contained in:
0xb00bface 2021-01-02 16:58:07 +01:00
parent 372fadf14e
commit 0df02b8c9d
2 changed files with 25 additions and 8 deletions

View File

@ -1,3 +1,7 @@
NEXT
========================
* Added config option to show the total number of models in the title bar
3.11.0 3.11.0
======================== ========================
* Added config option for faster scroll speed * Added config option for faster scroll speed

View File

@ -125,6 +125,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
double imageAspectRatio = 3.0 / 4.0; double imageAspectRatio = 3.0 / 4.0;
private final SimpleBooleanProperty preserveAspectRatio = new SimpleBooleanProperty(true); private final SimpleBooleanProperty preserveAspectRatio = new SimpleBooleanProperty(true);
ProgressIndicator progressIndicator; ProgressIndicator progressIndicator;
Label noResultsFound = new Label("Nothing found!");
private ComboBox<Integer> thumbWidth; private ComboBox<Integer> thumbWidth;
@ -367,6 +368,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
try { try {
ObservableList<Node> nodes = grid.getChildren(); ObservableList<Node> nodes = grid.getChildren();
nodes.remove(progressIndicator); nodes.remove(progressIndicator);
nodes.remove(noResultsFound);
// first remove models, which are not in the updated list // first remove models, which are not in the updated list
removeModelsMissingInUpdate(nodes, models); removeModelsMissingInUpdate(nodes, models);
@ -380,6 +382,11 @@ 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();
} }
@ -774,6 +781,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
// remove the ones from grid, which don't match // remove the ones from grid, which don't match
for (Iterator<Node> iterator = grid.getChildren().iterator(); iterator.hasNext();) { for (Iterator<Node> iterator = grid.getChildren().iterator(); iterator.hasNext();) {
Node node = iterator.next(); Node node = iterator.next();
if (node instanceof ThumbCell) {
ThumbCell cell = (ThumbCell) node; ThumbCell cell = (ThumbCell) node;
Model m = cell.getModel(); Model m = cell.getModel();
if (!matches(m, filter)) { if (!matches(m, filter)) {
@ -782,6 +790,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
cell.setSelected(false); cell.setSelected(false);
} }
} }
}
// add the ones, which might have been filtered before, but now match // add the ones, which might have been filtered before, but now match
for (Iterator<ThumbCell> iterator = filteredThumbCells.iterator(); iterator.hasNext();) { for (Iterator<ThumbCell> iterator = filteredThumbCells.iterator(); iterator.hasNext();) {
@ -887,6 +896,10 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
@Override @Override
public void selected() { public void selected() {
grid.getChildren().remove(noResultsFound);
if (grid.getChildren().isEmpty()) {
grid.getChildren().add(progressIndicator);
}
queue.clear(); queue.clear();
if (updateService != null) { if (updateService != null) {
State s = updateService.getState(); State s = updateService.getState();