} else if (this.infoMode == InfoMode.MARKED_MODE) {
for (Long unitID : unitIDs) {
if (this.markedFieldUnits.containsKey(unitID) ||
this.activeUnits.containsKey(unitID)) {
//unitInfo displayed
Group group = mainMapView.getActiveGroup();
boolean removeUnitInfo = true;
UnitInfoComponent unitInfo = null;
if (this.activeUnits.containsKey(unitID)) {
if (!group.getUnits().contains(unitID)) {
//remove unit from activeUnits as it isn't active
//any more
unitInfo = this.activeUnits.get(unitID);
this.activeUnits.remove(unitID);
} else {
removeUnitInfo = false;
}
}
if (this.markedFieldUnits.containsKey(unitID)) {
if (!group.getUnitsOnFields().contains(unitID)) {
//remove unit from markedUnits if it isn't on a
//marked field any more
unitInfo = this.markedFieldUnits.get(unitID);
this.markedFieldUnits.remove(unitID);
} else {
removeUnitInfo = false;
}
}
if (removeUnitInfo) {
this.markedInfoPanel.remove(unitInfo);
}
} else {
//unitInfo not displayed
Group group = mainMapView.getActiveGroup();
if (group.getUnits().contains(unitID) ||
group.getUnitsOnFields().contains(unitID)) {
//add unit to markedUnits if it is marked now
UnitInfoComponent unitInfo = new UnitInfoComponent(unitID,
this.unitInfoRuleset, false, this.gameData);
this.addUnitComponent(this.markedInfoPanel, unitInfo,
this.dummyMarkedPanel);
if (group.getUnits().contains(unitID)) {
this.activeUnits.put(unitID, unitInfo);
}
if (group.getUnitsOnFields().contains(unitID)) {
this.markedFieldUnits.put(unitID, unitInfo);
}
}
}
}