Change types to GanttDate in IDependenciesEnforcerHook and INotificationAfterDependenciesEnforcement

FEA: ItEr61S08TimeUnitConfigurablePlanning
This commit is contained in:
Óscar González Fernández 2010-10-06 16:57:08 +02:00
parent 5dd8420017
commit d5efa31def
3 changed files with 49 additions and 51 deletions

View file

@ -61,12 +61,12 @@ public class GanttDiagramGraph<V, D> {
return new IDependenciesEnforcerHook() {
@Override
public void setNewEnd(Date previousEnd, Date newEnd) {
public void setNewEnd(GanttDate previousEnd, GanttDate newEnd) {
}
@Override
public void setStartDate(Date previousStart, Date previousEnd,
Date newStart) {
public void setStartDate(GanttDate previousStart,
GanttDate previousEnd, GanttDate newStart) {
}
};
}
@ -408,10 +408,10 @@ public class GanttDiagramGraph<V, D> {
}
public interface IDependenciesEnforcerHook {
public void setStartDate(Date previousStart, Date previousEnd,
Date newStart);
public void setStartDate(GanttDate previousStart,
GanttDate previousEnd, GanttDate newStart);
public void setNewEnd(Date previousEnd, Date newEnd);
public void setNewEnd(GanttDate previousEnd, GanttDate newEnd);
}
public interface IDependenciesEnforcerHookFactory<T> {
@ -422,21 +422,21 @@ public class GanttDiagramGraph<V, D> {
}
public interface INotificationAfterDependenciesEnforcement {
public void onStartDateChange(Date previousStart, Date previousEnd,
Date newStart);
public void onStartDateChange(GanttDate previousStart,
GanttDate previousEnd, GanttDate newStart);
public void onEndDateChange(Date previousEnd, Date newEnd);
public void onEndDateChange(GanttDate previousEnd, GanttDate newEnd);
}
private static final INotificationAfterDependenciesEnforcement EMPTY_NOTIFICATOR = new INotificationAfterDependenciesEnforcement() {
@Override
public void onStartDateChange(Date previousStart, Date previousEnd,
Date newStart) {
public void onStartDateChange(GanttDate previousStart,
GanttDate previousEnd, GanttDate newStart) {
}
@Override
public void onEndDateChange(Date previousEnd, Date newEnd) {
public void onEndDateChange(GanttDate previousEnd, GanttDate newEnd) {
}
};
@ -501,13 +501,14 @@ public class GanttDiagramGraph<V, D> {
private class StartDateNofitication {
private final INotificationAfterDependenciesEnforcement notification;
private final Date previousStart;
private final Date previousEnd;
private final Date newStart;
private final GanttDate previousStart;
private final GanttDate previousEnd;
private final GanttDate newStart;
public StartDateNofitication(
INotificationAfterDependenciesEnforcement notification,
Date previousStart, Date previousEnd, Date newStart) {
GanttDate previousStart, GanttDate previousEnd,
GanttDate newStart) {
this.notification = notification;
this.previousStart = previousStart;
this.previousEnd = previousEnd;
@ -529,12 +530,12 @@ public class GanttDiagramGraph<V, D> {
private class LengthNotification {
private final INotificationAfterDependenciesEnforcement notification;
private final Date previousEnd;
private final Date newEnd;
private final GanttDate previousEnd;
private final GanttDate newEnd;
public LengthNotification(
INotificationAfterDependenciesEnforcement notification,
Date previousEnd, Date newEnd) {
GanttDate previousEnd, GanttDate newEnd) {
this.notification = notification;
this.previousEnd = previousEnd;
this.newEnd = newEnd;
@ -571,13 +572,13 @@ public class GanttDiagramGraph<V, D> {
private IDependenciesEnforcerHook onEntrance(final V task) {
return new IDependenciesEnforcerHook() {
public void setStartDate(Date previousStart, Date previousEnd,
Date newStart) {
public void setStartDate(GanttDate previousStart,
GanttDate previousEnd, GanttDate newStart) {
taskPositionModified(task);
}
@Override
public void setNewEnd(Date previousEnd, Date newEnd) {
public void setNewEnd(GanttDate previousEnd, GanttDate newEnd) {
taskPositionModified(task);
}
@ -589,8 +590,8 @@ public class GanttDiagramGraph<V, D> {
return new IDependenciesEnforcerHook() {
@Override
public void setStartDate(Date previousStart, Date previousEnd,
Date newStart) {
public void setStartDate(GanttDate previousStart,
GanttDate previousEnd, GanttDate newStart) {
StartDateNofitication startDateNotification = new StartDateNofitication(
notification, previousStart, previousEnd,
newStart);
@ -599,7 +600,7 @@ public class GanttDiagramGraph<V, D> {
}
@Override
public void setNewEnd(Date previousEnd, Date newEnd) {
public void setNewEnd(GanttDate previousEnd, GanttDate newEnd) {
LengthNotification lengthNotification = new LengthNotification(
notification, previousEnd, newEnd);
deferedNotifier.get().add(task, lengthNotification);
@ -614,8 +615,8 @@ public class GanttDiagramGraph<V, D> {
return new IDependenciesEnforcerHook() {
@Override
public void setStartDate(final Date previousStart,
final Date previousEnd, final Date newStart) {
public void setStartDate(final GanttDate previousStart,
final GanttDate previousEnd, final GanttDate newStart) {
positionsUpdatingGuard
.entranceRequested(new IReentranceCases() {
@ -645,7 +646,8 @@ public class GanttDiagramGraph<V, D> {
}
@Override
public void setNewEnd(final Date previousEnd, final Date newEnd) {
public void setNewEnd(final GanttDate previousEnd,
final GanttDate newEnd) {
positionsUpdatingGuard
.entranceRequested(new IReentranceCases() {

View file

@ -77,8 +77,8 @@ public abstract class Task implements ITaskFundamentalProperties {
private final INotificationAfterDependenciesEnforcement notifyDates = new INotificationAfterDependenciesEnforcement() {
@Override
public void onStartDateChange(Date previousStart, Date previousEnd,
Date newStart) {
public void onStartDateChange(GanttDate previousStart,
GanttDate previousEnd, GanttDate newStart) {
fundamentalPropertiesListeners.firePropertyChange("beginDate",
previousStart, fundamentalProperties.getBeginDate());
fireEndDate(previousEnd);
@ -86,11 +86,11 @@ public abstract class Task implements ITaskFundamentalProperties {
}
@Override
public void onEndDateChange(Date previousEnd, Date newEnd) {
public void onEndDateChange(GanttDate previousEnd, GanttDate newEnd) {
fireEndDate(previousEnd);
}
private void fireEndDate(Date previousEnd) {
private void fireEndDate(GanttDate previousEnd) {
fundamentalPropertiesListeners.firePropertyChange("endDate",
previousEnd, fundamentalProperties.getEndDate());
}
@ -159,14 +159,12 @@ public abstract class Task implements ITaskFundamentalProperties {
GanttDate previousValue = fundamentalProperties.getBeginDate();
GanttDate previousEnd = fundamentalProperties.getEndDate();
fundamentalProperties.setBeginDate(newStart);
Date newStartDate = newStart != null ? newStart.toDateApproximation()
: null;
dependenciesEnforcerHook.setStartDate(
previousValue.toDateApproximation(),
previousEnd.toDateApproximation(), newStartDate);
dependenciesEnforcerHook.setStartDate(previousValue, previousEnd,
newStart);
}
private void reloadResourcesTextIfChange(Date newDate, Date previousDate) {
private void reloadResourcesTextIfChange(GanttDate newDate,
GanttDate previousDate) {
if (!ObjectUtils.equals(newDate, previousDate)) {
reloadResourcesText();
}
@ -174,11 +172,9 @@ public abstract class Task implements ITaskFundamentalProperties {
public void fireChangesForPreviousValues(GanttDate previousStart,
GanttDate previousEnd) {
dependenciesEnforcerHook.setStartDate(previousStart
.toDateApproximation(), previousEnd.toDateApproximation(),
fundamentalProperties.getBeginDate().toDateApproximation());
dependenciesEnforcerHook.setNewEnd(previousEnd.toDateApproximation(),
getEndDate().toDateApproximation());
dependenciesEnforcerHook.setStartDate(previousStart, previousStart,
fundamentalProperties.getBeginDate());
dependenciesEnforcerHook.setNewEnd(previousEnd, getEndDate());
}
public GanttDate getBeginDate() {
@ -251,8 +247,8 @@ public abstract class Task implements ITaskFundamentalProperties {
}
GanttDate previousEnd = fundamentalProperties.getEndDate();
fundamentalProperties.setEndDate(value);
dependenciesEnforcerHook.setNewEnd(previousEnd.toDateApproximation(),
fundamentalProperties.getEndDate().toDateApproximation());
dependenciesEnforcerHook.setNewEnd(previousEnd,
fundamentalProperties.getEndDate());
}
public void resizeTo(LocalDate date) {
@ -304,11 +300,10 @@ public abstract class Task implements ITaskFundamentalProperties {
}
public void moveTo(GanttDate date) {
Date previousStart = getBeginDate().toDateApproximation();
Date previousEnd = getEndDate().toDateApproximation();
GanttDate previousStart = getBeginDate();
GanttDate previousEnd = getEndDate();
fundamentalProperties.moveTo(date);
dependenciesEnforcerHook.setStartDate(previousStart, previousEnd,
date.toDateApproximation());
dependenciesEnforcerHook.setStartDate(previousStart, previousEnd, date);
}
@Override

View file

@ -62,6 +62,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.zkoss.ganttz.adapters.PlannerConfiguration;
import org.zkoss.ganttz.data.DependencyType;
import org.zkoss.ganttz.data.GanttDate;
import org.zkoss.ganttz.data.GanttDiagramGraph;
import org.zkoss.ganttz.data.GanttDiagramGraph.IAdapter;
import org.zkoss.ganttz.data.GanttDiagramGraph.IDependenciesEnforcerHook;
@ -203,8 +204,8 @@ public class TemplateModel implements ITemplateModel {
};
}
private static Date convert(LocalDate date) {
return date.toDateTimeAtStartOfDay().toDate();
private static GanttDate convert(LocalDate date) {
return GanttDate.createFrom(date);
}
public class Adapter implements