Let provide a not after than constraint
This constraint comes from the deadline of the order. FEA: ItEr64OTS03PlanificacionHaciaAtras
This commit is contained in:
parent
403b98f416
commit
4c384cdbfb
4 changed files with 32 additions and 18 deletions
|
|
@ -21,6 +21,7 @@
|
|||
package org.zkoss.ganttz.adapters;
|
||||
|
||||
import static org.zkoss.ganttz.data.constraint.ConstraintOnComparableValues.biggerOrEqualThan;
|
||||
import static org.zkoss.ganttz.data.constraint.ConstraintOnComparableValues.lessOrEqualThan;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
@ -127,7 +128,9 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
|||
|
||||
private boolean editingDatesEnabled = true;
|
||||
|
||||
private Date notBeforeThan = null;
|
||||
private GanttDate notBeforeThan = null;
|
||||
|
||||
private GanttDate notAfterThan = null;
|
||||
|
||||
private boolean dependenciesConstraintsHavePriority = false;
|
||||
|
||||
|
|
@ -209,7 +212,11 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
|||
}
|
||||
|
||||
public void setNotBeforeThan(Date notBeforeThan) {
|
||||
this.notBeforeThan = new Date(notBeforeThan.getTime());
|
||||
this.notBeforeThan = GanttDate.createFrom(notBeforeThan);
|
||||
}
|
||||
|
||||
public void setNotAfterThan(Date notAfterThan) {
|
||||
this.notAfterThan = GanttDate.createFrom(notAfterThan);
|
||||
}
|
||||
|
||||
public void setGoingDownInLastArrowCommand(
|
||||
|
|
@ -271,22 +278,28 @@ public class PlannerConfiguration<T> implements IDisabilityConfiguration {
|
|||
this.editingDatesEnabled = editingDatesEnabled;
|
||||
}
|
||||
|
||||
public List<Constraint<GanttDate>> getStartConstraints() {
|
||||
return getStartConstraintsGiven(GanttDate
|
||||
.createFrom(this.notBeforeThan));
|
||||
}
|
||||
|
||||
public static List<Constraint<GanttDate>> getStartConstraintsGiven(
|
||||
GanttDate notBeforeThan) {
|
||||
if (notBeforeThan != null) {
|
||||
return Collections.singletonList(biggerOrEqualThan(notBeforeThan));
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public List<Constraint<GanttDate>> getStartConstraints() {
|
||||
return getStartConstraintsGiven(notBeforeThan);
|
||||
}
|
||||
|
||||
public static List<Constraint<GanttDate>> getEndConstraintsGiven(
|
||||
GanttDate notAfterThan) {
|
||||
if (notAfterThan != null) {
|
||||
return Collections.singletonList(lessOrEqualThan(notAfterThan));
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public List<Constraint<GanttDate>> getEndConstraints() {
|
||||
return Collections.emptyList();
|
||||
return getEndConstraintsGiven(notAfterThan);
|
||||
}
|
||||
|
||||
public boolean isDependenciesConstraintsHavePriority() {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ package org.navalplanner.web.common;
|
|||
import static org.navalplanner.business.i18n.I18nHelper._;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
|
@ -407,9 +406,9 @@ public class TemplateModel implements ITemplateModel {
|
|||
private GanttDiagramGraph<TaskElement, DependencyWithVisibility> createFor(
|
||||
Order order, IAdapter<TaskElement, DependencyWithVisibility> adapter) {
|
||||
List<Constraint<GanttDate>> startConstraints = PlannerConfiguration
|
||||
.getStartConstraintsGiven(GanttDate.createFrom(order
|
||||
.getInitDate()));
|
||||
List<Constraint<GanttDate>> endConstraints = Collections.emptyList();
|
||||
.getStartConstraintsGiven((GanttDate) GanttDate.createFrom(order.getInitDate()));
|
||||
List<Constraint<GanttDate>> endConstraints = PlannerConfiguration
|
||||
.getEndConstraintsGiven((GanttDate) GanttDate.createFrom(order.getDeadline()));
|
||||
GanttDiagramGraph<TaskElement, DependencyWithVisibility> result = GanttDiagramGraph
|
||||
.create(order.isScheduleBackwards(), adapter, startConstraints,
|
||||
endConstraints,
|
||||
|
|
|
|||
|
|
@ -1009,6 +1009,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
taskElementAdapter,
|
||||
new TaskElementNavigator(), planningState.getInitial());
|
||||
result.setNotBeforeThan(orderReloaded.getInitDate());
|
||||
result.setNotAfterThan(orderReloaded.getDeadline());
|
||||
result.setDependenciesConstraintsHavePriority(orderReloaded
|
||||
.getDependenciesConstraintsHavePriority());
|
||||
result.setScheduleBackwards(orderReloaded.isScheduleBackwards());
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import static org.navalplanner.web.planner.tabs.MultipleTabsPlannerController.BR
|
|||
import static org.navalplanner.web.planner.tabs.MultipleTabsPlannerController.PLANNIFICATION;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
|
@ -218,10 +217,12 @@ public class MonteCarloTabCreator {
|
|||
|
||||
private GanttDiagramGraph<TaskElement, DependencyWithVisibility> createFor(
|
||||
Order order, IAdapter<TaskElement, DependencyWithVisibility> adapter) {
|
||||
GanttDate orderStart = GanttDate.createFrom(order.getInitDate());
|
||||
List<Constraint<GanttDate>> startConstraints = PlannerConfiguration
|
||||
.getStartConstraintsGiven(GanttDate.createFrom(order
|
||||
.getInitDate()));
|
||||
List<Constraint<GanttDate>> endConstraints = Collections.emptyList();
|
||||
.getStartConstraintsGiven(orderStart);
|
||||
GanttDate deadline = GanttDate.createFrom(order.getDeadline());
|
||||
List<Constraint<GanttDate>> endConstraints = PlannerConfiguration
|
||||
.getEndConstraintsGiven(deadline);
|
||||
GanttDiagramGraph<TaskElement, DependencyWithVisibility> result = GanttDiagramGraph.create(
|
||||
order.isScheduleBackwards(), adapter,
|
||||
startConstraints, endConstraints,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue