Util.ensureUniqueListeners(taskWorkableDays, Events.ON_CHANGE,
new EventListener() {
@Override
public void onEvent(Event event) {
Task task = getTask();
Integer workableDays = taskWorkableDays.getValue();
if (allocationRowsHandler.isForwardsAllocation()) {
IntraDayDate newEnd = ensureItIsAfterConsolidation(task
.calculateEndGivenWorkableDays(workableDays));
updateWorkableDaysIfNecessary(workableDays,
getTask().getIntraDayStartDate(),
newEnd);
taskPropertiesController
.updateTaskEndDate(newEnd.getDate());
showValueOfDateOn(labelTaskEnd,
newEnd.getDate());
} else {
IntraDayDate newStart = ensureItIsAfterConsolidation(task
.calculateStartGivenWorkableDays(workableDays));
updateWorkableDaysIfNecessary(workableDays,
newStart, task.getIntraDayEndDate());
taskPropertiesController
.updateTaskStartDate(newStart.getDate());
showValueOfDateOn(labelTaskStart,
newStart.getDate());
}