Bug #1320: Recalculate position of siblings closing task properties pop-up
It is needed if a constraint is removed in one of the siblings and because of that the parent element is moved. FEA: ItEr77S04BugFixing
This commit is contained in:
parent
8a98bf4666
commit
1bde8c76be
1 changed files with 25 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
@ -314,8 +318,27 @@ public class EditTaskController extends GenericForwardComposer {
|
|||
org.zkoss.ganttz.data.Task.reloadResourcesText(context);
|
||||
context.reloadCharts();
|
||||
if (context.getRelativeTo() instanceof TaskComponent) {
|
||||
((TaskComponent) context.getRelativeTo()).updateProperties();
|
||||
((TaskComponent) context.getRelativeTo()).invalidate();
|
||||
TaskComponent taskComponent = (TaskComponent) context
|
||||
.getRelativeTo();
|
||||
taskComponent.updateProperties();
|
||||
taskComponent.invalidate();
|
||||
|
||||
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