ItEr22S12CUVistaRecursosTempoPorProxectoItEr21S07: When the type changes a new dependency is created.
This commit is contained in:
parent
2ff7e7b5ee
commit
25208ebe52
4 changed files with 15 additions and 16 deletions
|
|
@ -21,13 +21,10 @@ public class DependencyComponent extends XulElement implements AfterCompose {
|
|||
|
||||
private TaskComponent destination;
|
||||
|
||||
private DependencyType type;
|
||||
|
||||
private FunctionalityExposedForExtensions<?> context;
|
||||
|
||||
public DependencyComponent(FunctionalityExposedForExtensions<?> context,
|
||||
TaskComponent source, TaskComponent destination) {
|
||||
this.type = DependencyType.END_START;
|
||||
this.context = context;
|
||||
if (source == null)
|
||||
throw new IllegalArgumentException("source cannot be null");
|
||||
|
|
@ -105,11 +102,7 @@ public class DependencyComponent extends XulElement implements AfterCompose {
|
|||
}
|
||||
|
||||
public DependencyType getDependencyType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public void setType(DependencyType type) {
|
||||
this.type = type;
|
||||
return getDependency().getType();
|
||||
}
|
||||
|
||||
public boolean hasSameSourceAndDestination(Dependency dependency) {
|
||||
|
|
|
|||
|
|
@ -155,8 +155,8 @@ public class DependencyList extends XulElement implements AfterCompose {
|
|||
@Override
|
||||
public void onEvent(final DependencyComponent choosen,
|
||||
Event event) {
|
||||
choosen.setType(DependencyType.END_START);
|
||||
choosen.invalidate();
|
||||
context.changeType(choosen.getDependency(),
|
||||
DependencyType.END_START);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -165,8 +165,8 @@ public class DependencyList extends XulElement implements AfterCompose {
|
|||
@Override
|
||||
public void onEvent(final DependencyComponent choosen,
|
||||
Event event) {
|
||||
choosen.setType(DependencyType.START_START);
|
||||
choosen.invalidate();
|
||||
context.changeType(choosen.getDependency(),
|
||||
DependencyType.START_START);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -175,8 +175,8 @@ public class DependencyList extends XulElement implements AfterCompose {
|
|||
@Override
|
||||
public void onEvent(final DependencyComponent choosen,
|
||||
Event event) {
|
||||
choosen.setType(DependencyType.END_END);
|
||||
choosen.invalidate();
|
||||
context.changeType(choosen.getDependency(),
|
||||
DependencyType.END_END);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import org.zkoss.ganttz.adapters.IDomainAndBeansMapper;
|
|||
import org.zkoss.ganttz.adapters.IStructureNavigator;
|
||||
import org.zkoss.ganttz.adapters.PlannerConfiguration;
|
||||
import org.zkoss.ganttz.data.Dependency;
|
||||
import org.zkoss.ganttz.data.DependencyType;
|
||||
import org.zkoss.ganttz.data.GanttDiagramGraph;
|
||||
import org.zkoss.ganttz.data.ITaskFundamentalProperties;
|
||||
import org.zkoss.ganttz.data.Position;
|
||||
|
|
@ -270,4 +271,9 @@ public class FunctionalityExposedForExtensions<T> implements IContext<T> {
|
|||
getDependencyList().remove(dependency);
|
||||
}
|
||||
|
||||
public void changeType(Dependency dependency, DependencyType type) {
|
||||
removeDependency(dependency);
|
||||
addDependency(dependency.createWithType(type));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,8 +110,8 @@ public class Dependency {
|
|||
return visible;
|
||||
}
|
||||
|
||||
public void setType(DependencyType type) {
|
||||
this.type = type;
|
||||
public Dependency createWithType(DependencyType type) {
|
||||
return new Dependency(source, destination, type, visible);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue