ItEr33S14CUCreacionUnidadesPlanificacion: PlannerConfiguration now returns globally applied constraints and lets set a notBeforeThanConstraint
This commit is contained in:
parent
84d531da01
commit
b5907632ac
1 changed files with 23 additions and 0 deletions
|
|
@ -22,9 +22,12 @@ package org.zkoss.ganttz.adapters;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.zkoss.ganttz.data.constraint.Constraint;
|
||||
import org.zkoss.ganttz.data.constraint.DateConstraint;
|
||||
import org.zkoss.ganttz.extensions.ICommand;
|
||||
import org.zkoss.ganttz.extensions.ICommandOnTask;
|
||||
import org.zkoss.ganttz.extensions.IContext;
|
||||
|
|
@ -91,6 +94,9 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
|||
|
||||
private boolean editingDatesEnabled = true;
|
||||
|
||||
private Date notBeforeThan = null;
|
||||
|
||||
|
||||
public PlannerConfiguration(IAdapterToTaskFundamentalProperties<T> adapter,
|
||||
IStructureNavigator<T> navigator, List<? extends T> data) {
|
||||
this.adapter = adapter;
|
||||
|
|
@ -132,6 +138,10 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
|||
return goingDownInLastArrowCommand;
|
||||
}
|
||||
|
||||
public void setNotBeforeThan(Date notBeforeThan) {
|
||||
this.notBeforeThan = new Date(notBeforeThan.getTime());
|
||||
}
|
||||
|
||||
public void setGoingDownInLastArrowCommand(
|
||||
ICommand<T> goingDownInLastArrowCommand) {
|
||||
Validate.notNull(goingDownInLastArrowCommand);
|
||||
|
|
@ -199,4 +209,17 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
|||
this.editingDatesEnabled = editingDatesEnabled;
|
||||
}
|
||||
|
||||
public List<Constraint<Date>> getStartConstraints() {
|
||||
if (notBeforeThan != null) {
|
||||
return Collections.singletonList(DateConstraint
|
||||
.biggerOrEqualThan(notBeforeThan));
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Constraint<Date>> getEndConstraints() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue