ItEr16S09RFComportamentoGraficoPlanificadorItEr15S12: When entering a startDate that is bigger than endDate, the endDate is the startDate plus the length of the task.

This commit is contained in:
Óscar González Fernández 2009-07-06 19:13:24 +02:00 committed by Javier Moran Rua
parent a8ea3911b7
commit 291b304fd7
2 changed files with 12 additions and 8 deletions

View file

@ -318,13 +318,14 @@ public class TaskDetail extends GenericForwardComposer {
}
public void updateBean() {
if (getEndDateBox().getValue().before(getStartDateBox().getValue())) {
updateComponents();
return;
Date begin = getStartDateBox().getValue();
Date end = getEndDateBox().getValue();
if (end.before(begin)) {
end = new Date(begin.getTime() + taskBean.getLengthMilliseconds());
}
taskBean.setName(getNameBox().getValue());
taskBean.setBeginDate(getStartDateBox().getValue());
taskBean.setEndDate(getEndDateBox().getValue());
taskBean.setBeginDate(begin);
taskBean.setEndDate(end);
}
private void updateComponents() {

View file

@ -8,9 +8,7 @@ import java.util.Date;
* This class contains the information of a task. It can be modified and
* notifies of the changes to the interested parties. <br/>
* Created at Apr 24, 2009
*
* @author Óscar González Fernández <ogonzalez@igalia.com>
*
*/
public class TaskBean {
@ -81,6 +79,10 @@ public class TaskBean {
}
public void setLengthMilliseconds(long lengthMilliseconds) {
if (lengthMilliseconds < 0)
throw new IllegalArgumentException(
"a task must not have a negative length. Received value: "
+ lengthMilliseconds);
long previousValue = this.lengthMilliseconds;
this.lengthMilliseconds = lengthMilliseconds;
fundamentalProperties.firePropertyChange("lengthMilliseconds",
@ -96,7 +98,8 @@ public class TaskBean {
this.visibilityProperties.addPropertyChangeListener(listener);
}
public void addFundamentalPropertiesChangeListener(PropertyChangeListener listener) {
public void addFundamentalPropertiesChangeListener(
PropertyChangeListener listener) {
this.fundamentalProperties.addPropertyChangeListener(listener);
}