ItEr37S08CUCreacionUnidadesPlanificacionItEr36S11: When activating recommended allocation previous allocations are removed

This commit is contained in:
Óscar González Fernández 2009-12-02 18:51:59 +01:00
parent 543c75b2c8
commit f011594686
2 changed files with 13 additions and 1 deletions

View file

@ -96,7 +96,7 @@ public class AllocationRowsHandler {
}
public List<AllocationRow> getCurrentRows() {
return new ArrayList<AllocationRow>(currentRows);
return currentRows;
}
private boolean alreadyExistsAllocationFor(Resource resource) {
@ -240,4 +240,13 @@ public class AllocationRowsHandler {
return date.toDateTimeAtStartOfDay().toDate();
}
public void removeAll() {
for (AllocationRow each : copyOfCurrentRowsToAvoidConcurrentModification()) {
remove(each);
}
}
private ArrayList<AllocationRow> copyOfCurrentRowsToAvoidConcurrentModification() {
return new ArrayList<AllocationRow>(currentRows);
}
}

View file

@ -39,6 +39,7 @@ import org.navalplanner.business.resources.entities.Criterion;
import org.navalplanner.business.resources.entities.Resource;
import org.navalplanner.web.common.IMessagesForUser;
import org.navalplanner.web.common.Level;
import org.navalplanner.web.common.Util;
import org.navalplanner.web.planner.allocation.IResourceAllocationModel.IResourceAllocationContext;
import org.navalplanner.web.resourceload.ResourceLoadModel;
import org.zkoss.util.Locales;
@ -380,6 +381,8 @@ class FormBinder {
}
private void activatingRecommendedAllocation() {
allocationRowsHandler.removeAll();
Util.reloadBindings(allocationsList);
}
private void deactivatingRecommendedAllocation() {