return;
}
if (objectEvent.getSource() == this)
return;
Object changedObject = objectEvent.getObject();
Task task = null;
if (changedObject instanceof Task) {
if (objectEvent.isCreate()) {
predecessorTaskList
.arrangeTask((Task) changedObject);
return; // let the hierarchy event that follow run the CP
} else if (objectEvent.isDelete()) {
Task removedTask = (Task) changedObject;
predecessorTaskList.removeTask(removedTask);
reset(); // Fix of bug 91 31/8/05. This ensures the ancestors of this task that are no longer parents will be replaced as single entries in pred list
} else if (objectEvent.isUpdate()) {
task = (Task)changedObject;
Field field = objectEvent.getField();
if (field != null && !fieldUpdater.inputContains(field))
return;
if (field == constraintTypeField) {
reset();
task.invalidateSchedules();
task.markTaskAsNeedingRecalculation();
}
}
calculate(true,task);
} else if (changedObject instanceof Dependency) { // dependency added or
// removed
Dependency dependency = (Dependency) changedObject;
if (!dependency.refersToDocument(project))
return;
if (!objectEvent.isUpdate()) {
reset(); // refresh predecssor list - the whold thing may change drastically no matter what the link because of parents
}
task = (Task)dependency.getPredecessor();
Task successor = (Task) dependency.getSuccessor(); // the successor needs to be scheduled
// to fix a bug, I am invalidating both early and late schedules
task.invalidateSchedules();
task.markTaskAsNeedingRecalculation();
if (successor.isSubproject()) { // special case for subprojects - need to reset all
SubProj sub = (SubProj)successor;
if (sub.isSubprojectOpen())
sub.getSubproject().markAllTasksAsNeedingRecalculation(true);
}
successor.invalidateSchedules();
successor.markTaskAsNeedingRecalculation();
// The line below fixes a bug with nested parents of the sort pred->grand par sib1->sib2. Of course, it means most of the code above is redundant (except for subproject stuff)
project.markAllTasksAsNeedingRecalculation(true);
calculate(true,null); // Run both passes, since the CP might be modified and it's hard to tell if so
} else if (changedObject == project) { // if whole project changed, such