Fix disparity between dates in task properties and allocation tab

FEA: ItEr74S04BugFixing
This commit is contained in:
Óscar González Fernández 2011-05-12 17:51:22 +02:00
parent 34369a92f3
commit 464ca82042
3 changed files with 34 additions and 2 deletions

View file

@ -23,6 +23,7 @@ package org.zkoss.ganttz;
import java.util.Date;
import org.joda.time.LocalDate;
import org.zkoss.ganttz.data.GanttDate;
import org.zkoss.ganttz.data.Task;
import org.zkoss.zk.ui.Component;
@ -104,14 +105,21 @@ public class TaskEditFormComposer extends GenericForwardComposer {
TaskDTO result = new TaskDTO();
result.name = task.getName();
result.beginDate = task.getBeginDate().toDayRoundedDate();
result.endDate = task.getEndDate().toDayRoundedDate();
result.beginDate = asDate(task.getBeginDate().toLocalDate());
result.endDate = asDate(task.getEndDate().asExclusiveEnd());
result.notes = task.getNotes();
result.deadlineDate = task.getDeadline();
return result;
}
private Date asDate(LocalDate localDate) {
if (localDate == null) {
return null;
}
return localDate.toDateTimeAtStartOfDay().toDate();
}
private void copyFromDTO(TaskDTO taskDTO, Task currentTask,
boolean copyDates) {
currentTask.setName(taskDTO.name);

View file

@ -130,6 +130,10 @@ public abstract class GanttDate implements Comparable<GanttDate> {
*/
public abstract Date toDayRoundedDate();
public abstract LocalDate toLocalDate();
public abstract LocalDate asExclusiveEnd();
public abstract int toPixels(IDatesMapper datesMapper);
public static class LocalDateBased extends GanttDate {
@ -170,6 +174,16 @@ public abstract class GanttDate implements Comparable<GanttDate> {
return localDate.toDateTimeAtStartOfDay().toDate();
}
@Override
public LocalDate toLocalDate() {
return localDate;
}
@Override
public LocalDate asExclusiveEnd() {
return localDate;
}
@Override
public boolean isEqualsTo(GanttDate other) {
return other.byCases(new ICases<Boolean>() {

View file

@ -290,6 +290,16 @@ public class TaskElementAdapter implements ITaskElementAdapter {
return date.toDateTimeAtStartOfDay().toDate();
}
@Override
public LocalDate toLocalDate() {
return date.getDate();
}
@Override
public LocalDate asExclusiveEnd() {
return date.asExclusiveEnd();
}
@Override
protected boolean isEqualsToCustom(CustomDate customType) {
if (customType instanceof GanttDateAdapter) {