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))
{
searchItemsPanel.removeAll();
return;
}
@@ -198,18 +199,24 @@ class GrandExchangeSearchPanel extends JPanel
SwingUtilities.invokeLater(() ->
{
for (GrandExchangeItems item : ITEMS_LIST)
if (ITEMS_LIST.isEmpty())
{
GrandExchangeItemPanel panel = new GrandExchangeItemPanel(item.getIcon(), item.getName(),
item.getItemId(), item.getGePrice(), item.getHaPrice());
searchItemsPanel.add(panel);
showSearchString("No results found.");
}
else
{
for (GrandExchangeItems item : ITEMS_LIST)
{
GrandExchangeItemPanel panel = new GrandExchangeItemPanel(item.getIcon(), item.getName(),
item.getItemId(), item.getGePrice(), item.getHaPrice());
ITEMS_LIST.clear();
searchItemsPanel.add(panel);
}
// Remove searching label after search is complete
showSearchString(null);
// Remove searching label after search is complete
showSearchString(null);
ITEMS_LIST.clear();
}
});
}