ItEr37S08CUCreacionUnidadesPlanificacionItEr36S11: Adding hours column

This commit is contained in:
Óscar González Fernández 2009-11-30 21:19:37 +01:00
parent 65aa0b1fdb
commit 0de6d986c3
3 changed files with 23 additions and 1 deletions

View file

@ -75,6 +75,8 @@ class FormBinder {
private Map<AllocationDTO, Decimalbox> resourcesPerDayInputsByAllocationDTO = new HashMap<AllocationDTO, Decimalbox>();
private Map<AllocationDTO, Intbox> hoursIntboxesByAllocationDTO = new HashMap<AllocationDTO, Intbox>();
private EventListener onChangeEnableApply = new EventListener() {
@Override
@ -245,6 +247,10 @@ class FormBinder {
onChangeEnableApply(decimalbox);
}
public void setHoursIntboxFor(AllocationDTO data, Intbox hours) {
hoursIntboxesByAllocationDTO.put(data, hours);
}
public int getAssignedHours() {
Integer result = assignedHoursComponent.getValue();
if (result == null) {

View file

@ -481,7 +481,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
// Label fields are fixed, can only be viewed
appendLabel(item, data.getName());
bindHours(appendIntbox(item), data);
bindResourcesPerDay(appendDecimalbox(item), data);
// On click delete button
Button deleteButton = appendDeleteButton(item);
@ -550,6 +550,14 @@ public class ResourceAllocationController extends GenericForwardComposer {
return decimalbox;
}
private Intbox appendIntbox(Listitem item) {
Intbox result = new Intbox();
Listcell listcell = new Listcell();
listcell.appendChild(result);
item.appendChild(listcell);
return result;
}
private void bindResourcesPerDay(final Decimalbox decimalbox,
final AllocationDTO data) {
decimalbox.setConstraint(new SimpleConstraint(
@ -572,6 +580,12 @@ public class ResourceAllocationController extends GenericForwardComposer {
}
});
}
private void bindHours(Intbox hoursIntbox, AllocationDTO data) {
hoursIntbox.setDisabled(true);
formBinder.setHoursIntboxFor(data, hoursIntbox);
}
}
public ViewSwitcher getSwitcher() {

View file

@ -154,6 +154,8 @@
style="margin-bottom: 5px" fixedLayout="true" rows="4">
<listhead>
<listheader label="${i18n:_('Name')}" />
<listheader
label="${i18n:_('Hours')}" />
<listheader
label="${i18n:_('Resources Per Day')}" />
<listheader />