Bug #1354: Fix bug

Although the constraint is not applied it must be provided. Otherwise
the dominating forces would not take it into account. Normally this
wasn't a problem since if the secondary point date changes it was
provided. But it can happen that the secondary point doesn't change,
in that case the constraint must still be taken into account.
This commit is contained in:
Óscar González Fernández 2012-03-01 12:10:17 +01:00 committed by Jacobo Aragunde Pérez
parent d91016f532
commit 93d5667769

View file

@ -1746,15 +1746,17 @@ public class GanttDiagramGraph<V, D extends IDependency<V>> implements
.withConstraints(restrictions.getStartConstraints()) .withConstraints(restrictions.getStartConstraints())
.withConstraints(getStartConstraints()) .withConstraints(getStartConstraints())
.applyWithoutFinalCheck(); .applyWithoutFinalCheck();
if (result != null && !result.equals(getStartDate(task))) { if (result != null) {
return enforceRestrictions(result); enforceRestrictions(result);
return biggerThan(result, adapter.getEndDateFor(task));
} }
return restrictions; return restrictions;
} }
private PositionRestrictions enforceRestrictions(GanttDate result) { private void enforceRestrictions(GanttDate result) {
adapter.setStartDateFor(task, result); if (!result.equals(getStartDate(task))) {
return biggerThan(result, adapter.getEndDateFor(task)); adapter.setStartDateFor(task, result);
}
} }
} }
@ -1768,8 +1770,9 @@ public class GanttDiagramGraph<V, D extends IDependency<V>> implements
.withConstraints(restrictions.getEndConstraints()) .withConstraints(restrictions.getEndConstraints())
.withConstraints(getEndConstraints()) .withConstraints(getEndConstraints())
.applyWithoutFinalCheck(); .applyWithoutFinalCheck();
if (result != null && !result.equals(getEndDateFor(task))) { if (result != null) {
return enforceRestrictions(result); enforceRestrictions(result);
return lessThan(adapter.getStartDate(task), result);
} }
return restrictions; return restrictions;
} }
@ -1784,11 +1787,11 @@ public class GanttDiagramGraph<V, D extends IDependency<V>> implements
return adapter.getEndConstraintsFor(task); return adapter.getEndConstraintsFor(task);
} }
private PositionRestrictions enforceRestrictions(GanttDate newEnd) { private void enforceRestrictions(GanttDate newEnd) {
adapter.setEndDateFor(task, newEnd); if (!newEnd.equals(getEndDateFor(task))) {
return lessThan(adapter.getStartDate(task), newEnd); adapter.setEndDateFor(task, newEnd);
}
} }
} }
@Override @Override