Refresh infoboxes only when needed

Refresh infoboxes only when removeIf and remove actually removes
anything to avoid constant refreshing for no reason.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2019-01-24 21:47:05 +01:00
parent eacc548a74
commit 652bdb7341

View File

@@ -77,17 +77,19 @@ public class InfoBoxManager
public void removeInfoBox(InfoBox infoBox)
{
log.debug("Removing InfoBox {}", infoBox);
infoBoxes.remove(infoBox);
refreshInfoBoxes();
if (infoBoxes.remove(infoBox))
{
refreshInfoBoxes();
}
}
public void removeIf(Predicate<InfoBox> filter)
{
log.debug("Removing InfoBoxes for filter {}", filter);
infoBoxes.removeIf(filter);
refreshInfoBoxes();
if (infoBoxes.removeIf(filter))
{
refreshInfoBoxes();
}
}
public List<InfoBox> getInfoBoxes()