ge search panel: show "No results found" if search is empty, clear on empty lookup

This commit is contained in:
Adam
2018-04-18 08:04:12 -04:00
parent e03defcdbb
commit 9252c02ac4

View File

@@ -126,6 +126,7 @@ class GrandExchangeSearchPanel extends JPanel
if (Strings.isNullOrEmpty(lookup)) if (Strings.isNullOrEmpty(lookup))
{ {
searchItemsPanel.removeAll();
return; return;
} }
@@ -197,6 +198,12 @@ class GrandExchangeSearchPanel extends JPanel
} }
SwingUtilities.invokeLater(() -> SwingUtilities.invokeLater(() ->
{
if (ITEMS_LIST.isEmpty())
{
showSearchString("No results found.");
}
else
{ {
for (GrandExchangeItems item : ITEMS_LIST) for (GrandExchangeItems item : ITEMS_LIST)
{ {
@@ -206,10 +213,10 @@ class GrandExchangeSearchPanel extends JPanel
searchItemsPanel.add(panel); searchItemsPanel.add(panel);
} }
ITEMS_LIST.clear();
// Remove searching label after search is complete // Remove searching label after search is complete
showSearchString(null); showSearchString(null);
ITEMS_LIST.clear();
}
}); });
} }