ItEr19S08CUCreacionProxectoPlanificacionItEr18S08: Dependencies are not lost when replacing a task.
This commit is contained in:
parent
ee23eeb6ea
commit
56cafac54d
4 changed files with 22 additions and 3 deletions
|
|
@ -90,6 +90,7 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
|||
T data, TaskContainer parent) {
|
||||
ITaskFundamentalProperties adapted = adapter.adapt(data);
|
||||
accumulatedDependencies.addAll(adapter.getOutcomingDependencies(data));
|
||||
accumulatedDependencies.addAll(adapter.getIncomingDependencies(data));
|
||||
final Task result;
|
||||
if (navigator.isLeaf(data)) {
|
||||
result = new TaskLeaf(adapted);
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ public class Planner extends XulElement {
|
|||
}
|
||||
|
||||
public DependencyList getDependencyList() {
|
||||
if (ganttPanel == null)
|
||||
return null;
|
||||
List<Object> children = ganttPanel.getChildren();
|
||||
List<DependencyList> found = findComponentsOfType(DependencyList.class,
|
||||
children);
|
||||
|
|
@ -111,6 +113,17 @@ public class Planner extends XulElement {
|
|||
}
|
||||
}
|
||||
|
||||
void addDependencies(Collection<? extends Dependency> dependencies) {
|
||||
DependencyList dependencyList = getDependencyList();
|
||||
if (dependencyList == null) {
|
||||
return;
|
||||
}
|
||||
for (DependencyComponent d : getTaskList().asDependencyComponents(
|
||||
dependencies)) {
|
||||
dependencyList.addDependencyComponent(d);
|
||||
}
|
||||
}
|
||||
|
||||
private static class DependencyAdderAdapter<T> {
|
||||
|
||||
private final IAdapterToTaskFundamentalProperties<T> adapter;
|
||||
|
|
@ -236,7 +249,6 @@ public class Planner extends XulElement {
|
|||
|
||||
void dependencyRemoved(DependencyComponent dependencyComponent) {
|
||||
diagramGraph.remove(dependencyComponent);
|
||||
dependencyAdder.removeDependency(dependencyComponent
|
||||
.getDependency());
|
||||
dependencyAdder.removeDependency(dependencyComponent.getDependency());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package org.zkoss.ganttz;
|
|||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
|
@ -64,7 +65,8 @@ public class TaskList extends XulElement implements AfterCompose {
|
|||
return result;
|
||||
}
|
||||
|
||||
public List<DependencyComponent> asDependencyComponents(List<Dependency> dependencies) {
|
||||
public List<DependencyComponent> asDependencyComponents(
|
||||
Collection<? extends Dependency> dependencies) {
|
||||
List<? extends Object> children = getChildren();
|
||||
List<TaskComponent> taskComponents = Planner.findComponentsOfType(TaskComponent.class, children);
|
||||
Map<Task, TaskComponent> taskComponentByTask = new HashMap<Task, TaskComponent>();
|
||||
|
|
|
|||
|
|
@ -166,6 +166,10 @@ public class GanttDiagramGraph {
|
|||
getEnforcer(destination).enforce();
|
||||
}
|
||||
|
||||
public boolean contains(Dependency dependency) {
|
||||
return graph.containsEdge(dependency);
|
||||
}
|
||||
|
||||
private DependencyRulesEnforcer getEnforcer(Task destination) {
|
||||
return rulesEnforcersByTask.get(destination);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue