Revert "Bug #1320: Recalculate position of siblings when moving a task"
This reverts commit 125146ebd2 because of the
solution for bug #1320 was causing a new bug #1540.
This commit is contained in:
parent
46883c8cde
commit
82e18fb77d
3 changed files with 21 additions and 25 deletions
|
|
@ -24,8 +24,6 @@ package org.zkoss.ganttz;
|
|||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -375,24 +373,6 @@ public class TaskComponent extends Div implements AfterCompose {
|
|||
startBeforeMoving);
|
||||
if (remainsInOriginalPosition) {
|
||||
updateProperties();
|
||||
} else {
|
||||
recalculatePositionOfSiblings();
|
||||
}
|
||||
}
|
||||
|
||||
public void recalculatePositionOfSiblings() {
|
||||
Task task = getTask();
|
||||
|
||||
FunctionalityExposedForExtensions<?> context = getTaskList()
|
||||
.getFunctionalityExposedForExtensionsContext();
|
||||
List<TaskContainer> parents = new ArrayList<TaskContainer>(context
|
||||
.getMapper().getParents(task));
|
||||
for (TaskContainer parent : parents) {
|
||||
if (parent.contains(task)) {
|
||||
for (Task child : parent.getTasks()) {
|
||||
context.getDiagramGraph().enforceRestrictions(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -409,8 +409,4 @@ public class TaskList extends XulElement implements AfterCompose {
|
|||
reload(false);
|
||||
}
|
||||
|
||||
public FunctionalityExposedForExtensions<?> getFunctionalityExposedForExtensionsContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ package org.libreplan.web.planner.taskedition;
|
|||
|
||||
import static org.libreplan.web.I18nHelper._;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.libreplan.business.common.exceptions.ValidationException;
|
||||
import org.libreplan.business.planner.entities.ITaskPositionConstrained;
|
||||
import org.libreplan.business.planner.entities.Task;
|
||||
|
|
@ -40,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.zkoss.ganttz.TaskComponent;
|
||||
import org.zkoss.ganttz.data.TaskContainer;
|
||||
import org.zkoss.ganttz.extensions.IContextWithPlannerTask;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
|
|
@ -318,7 +322,23 @@ public class EditTaskController extends GenericForwardComposer {
|
|||
.getRelativeTo();
|
||||
taskComponent.updateProperties();
|
||||
taskComponent.invalidate();
|
||||
taskComponent.recalculatePositionOfSiblings();
|
||||
|
||||
recalculatePositionOfSiblings(taskComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void recalculatePositionOfSiblings(TaskComponent taskComponent) {
|
||||
org.zkoss.ganttz.data.Task task = taskComponent.getTask();
|
||||
|
||||
List<TaskContainer> parents = new ArrayList<TaskContainer>(context
|
||||
.getMapper().getParents(task));
|
||||
for (TaskContainer parent : parents) {
|
||||
if (parent.contains(task)) {
|
||||
for (org.zkoss.ganttz.data.Task child : parent.getTasks()) {
|
||||
context.recalculatePosition(context.getMapper()
|
||||
.findAssociatedDomainObject(child));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue