ItEr37S08CUCreacionUnidadesPlanificacionItEr36S11: Filling the hours column with the current hours
This commit is contained in:
parent
0de6d986c3
commit
b4e81de660
2 changed files with 26 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.joda.time.LocalDate;
|
||||
|
|
@ -222,11 +223,20 @@ class FormBinder {
|
|||
}
|
||||
|
||||
private void reloadValues() {
|
||||
loadHoursValues();
|
||||
loadValueForAssignedHoursComponent();
|
||||
loadValueForTaskStartDateBox();
|
||||
loadValueForEndDate();
|
||||
}
|
||||
|
||||
private void loadHoursValues() {
|
||||
for (Entry<AllocationDTO, Intbox> entry : hoursIntboxesByAllocationDTO.entrySet()) {
|
||||
Integer hours = resourceAllocationsBeingEdited.getHoursFor(entry
|
||||
.getKey());
|
||||
entry.getValue().setValue(hours);
|
||||
}
|
||||
}
|
||||
|
||||
public void setApplyButton(Button applyButton) {
|
||||
this.applyButton = applyButton;
|
||||
this.applyButton.setDisabled(true);
|
||||
|
|
@ -249,6 +259,7 @@ class FormBinder {
|
|||
|
||||
public void setHoursIntboxFor(AllocationDTO data, Intbox hours) {
|
||||
hoursIntboxesByAllocationDTO.put(data, hours);
|
||||
hours.setValue(resourceAllocationsBeingEdited.getHoursFor(data));
|
||||
}
|
||||
|
||||
public int getAssignedHours() {
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ public class ResourceAllocationsBeingEdited {
|
|||
|
||||
private Integer daysDuration;
|
||||
|
||||
private Map<AllocationDTO, ResourceAllocation<?>> fromDTOToCurrentAllocation = new HashMap<AllocationDTO, ResourceAllocation<?>>();
|
||||
|
||||
private ResourceAllocationsBeingEdited(Task task,
|
||||
List<AllocationDTO> initialAllocations) {
|
||||
this.task = task;
|
||||
|
|
@ -124,6 +126,15 @@ public class ResourceAllocationsBeingEdited {
|
|||
return new ArrayList<AllocationDTO>(currentAllocations);
|
||||
}
|
||||
|
||||
public Integer getHoursFor(AllocationDTO allocationDTO) {
|
||||
ResourceAllocation<?> origin = allocationDTO.getOrigin();
|
||||
if (fromDTOToCurrentAllocation.containsKey(allocationDTO)) {
|
||||
return fromDTOToCurrentAllocation.get(allocationDTO)
|
||||
.getAssignedHours();
|
||||
}
|
||||
return origin != null ? origin.getAssignedHours() : null;
|
||||
}
|
||||
|
||||
private boolean alreadyExistsAllocationFor(Resource resource) {
|
||||
return !getAllocationsFor(resource).isEmpty();
|
||||
}
|
||||
|
|
@ -232,7 +243,10 @@ public class ResourceAllocationsBeingEdited {
|
|||
for (Entry<AllocationDTO, ResourceAllocation<?>> entry : allocationsWithTheirRelatedAllocationsOnTask
|
||||
.entrySet()) {
|
||||
AllocationDTO key = entry.getKey();
|
||||
result.put(instantiate(key), entry.getValue());
|
||||
AllocationBeingModified instantiated = instantiate(key);
|
||||
result.put(instantiated, entry.getValue());
|
||||
fromDTOToCurrentAllocation
|
||||
.put(key, instantiated.getBeingModified());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue