ItEr22S12CUVistaRecursosTempoPorProxectoItEr21S07: Now context is responsible of removing the graphical component.
This commit is contained in:
parent
99d5c21a4a
commit
2ff7e7b5ee
3 changed files with 18 additions and 1 deletions
|
|
@ -112,4 +112,11 @@ public class DependencyComponent extends XulElement implements AfterCompose {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean hasSameSourceAndDestination(Dependency dependency) {
|
||||
Task sourceTask = source.getTask();
|
||||
Task destinationTask = destination.getTask();
|
||||
return sourceTask.equals(dependency.getSource())
|
||||
&& destinationTask.equals(dependency.getDestination());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.zkoss.ganttz.data.Dependency;
|
||||
import org.zkoss.ganttz.data.DependencyType;
|
||||
import org.zkoss.ganttz.data.Task;
|
||||
import org.zkoss.ganttz.util.MenuBuilder;
|
||||
|
|
@ -147,7 +148,6 @@ public class DependencyList extends XulElement implements AfterCompose {
|
|||
Event event) {
|
||||
context.removeDependency(choosen
|
||||
.getDependency());
|
||||
removeChild(choosen);
|
||||
}
|
||||
});
|
||||
contextMenuBuilder.item("Set End-Start",
|
||||
|
|
@ -227,4 +227,13 @@ public class DependencyList extends XulElement implements AfterCompose {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(Dependency dependency) {
|
||||
for (DependencyComponent dependencyComponent : DependencyList.this
|
||||
.getDependencyComponents()) {
|
||||
if (dependencyComponent.hasSameSourceAndDestination(dependency)) {
|
||||
this.removeChild(dependencyComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,6 +267,7 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
|||
public void removeDependency(Dependency dependency) {
|
||||
adapter.removeDependency(toDomainDependency(dependency));
|
||||
diagramGraph.remove(dependency);
|
||||
getDependencyList().remove(dependency);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue