private void addListenerIfNeeded(final DetailItem item,
final Component component) {
if (cannotBeEdited(item)) {
return;
}
final EffortDurationBox effortBox = (EffortDurationBox) component;
component.addEventListener(Events.ON_CHANGE, new EventListener() {
@Override
public void onEvent(Event event) {
EffortDuration value = effortBox.getEffortDurationValue();
LocalDate startDate = restriction.limitStartDate(item
.getStartDate().toLocalDate());
LocalDate endDate = restriction.limitEndDate(item.getEndDate()
.toLocalDate());
changeAssignmentFunctionToManual();
getAllocation().withPreviousAssociatedResources()
.onIntervalWithinTask(startDate, endDate)
.allocate(value);
fireCellChanged(item);
effortBox.setRawValue(getEffortForDetailItem(item));
reloadAllEffort();
}
});
}