List of usage examples for org.joda.time DateTime minus
public DateTime minus(ReadablePeriod period)
From source file:TVShowTimelineMaker.timeConstraints.FieldChangeConstraint.java
public Event[] increaseWhat(DateTime inFirstDay, DateTime inSecondDay) { this.makeToPeriodIfNull(); DateTime minForFirstEvent = inSecondDay.minus(this.toPeriod); DateTime minForSecondEvent = inFirstDay.plus(this.toPeriod); if (this.lowerFields == null) { this.lowerFields = lowerFields(this.mDateTimeFieldType); }/* ww w . ja va 2s .c o m*/ for (DateTimeFieldType curDateTimeFieldType : this.lowerFields) { minForFirstEvent = minForFirstEvent.property(curDateTimeFieldType).withMinimumValue(); minForSecondEvent = minForSecondEvent.property(curDateTimeFieldType).withMinimumValue(); } if (inFirstDay.isBefore(minForFirstEvent)) { return new Event[] { this.firstEpisode }; } else if (inSecondDay.isBefore(minForSecondEvent)) { return new Event[] { this.secondEpisode }; } else { return new Event[] {}; } }
From source file:TVShowTimelineMaker.timeConstraints.Relation.java
@Override public boolean complexApplyConstraint() { boolean changed = this.applyConstraint(); if ((!this.firstEpisode.isMarkedForComplexEval()) && this.secondEpisode.isMarkedForComplexEval()) { if ((this.kind == RelationKind.FIXED_TIME_BEFORE) || (this.kind == RelationKind.SAME_DAY_OF_YEAR) || (this.kind == RelationKind.LESS_THEN_BEFORE) || (this.kind == RelationKind.SAME_TIME_AS) || (this.kind == RelationKind.BEFORE_SAME_DAY)) { this.firstEpisode.setUpForComplexEval(); }// ww w . ja v a2s . c om } if (this.firstEpisode.isMarkedForComplexEval() && (!this.secondEpisode.isMarkedForComplexEval())) { if ((this.kind == RelationKind.FIXED_TIME_BEFORE) || (this.kind == RelationKind.SAME_DAY_OF_YEAR) || (this.kind == RelationKind.LESS_THEN_BEFORE) || (this.kind == RelationKind.SAME_TIME_AS) || (this.kind == RelationKind.BEFORE_SAME_DAY)) { this.secondEpisode.setUpForComplexEval(); } } if (this.firstEpisode.isMarkedForComplexEval() && this.secondEpisode.isMarkedForComplexEval()) { NavigableSet<DateTime> firstEpisodeStartDates; NavigableSet<DateTime> firstEpisodeEndDates; NavigableSet<DateTime> secondEpisodeStartDates; NavigableSet<DateTime> secondEpisodeEndDates; if (this.firstEpisode instanceof OnceDayEvent) { OnceDayEvent firstEpisodeDayEvent = (OnceDayEvent) this.firstEpisode; firstEpisodeStartDates = firstEpisodeDayEvent.getPossibleDays(); firstEpisodeEndDates = firstEpisodeDayEvent.getPossibleDays(); } else if (this.firstEpisode instanceof OncePeriodEvent) { OncePeriodEvent firstEpisodePeriodEvent = (OncePeriodEvent) this.firstEpisode; firstEpisodeStartDates = firstEpisodePeriodEvent.getStartPossibleDays(); firstEpisodeEndDates = firstEpisodePeriodEvent.getEndPossibleDays(); } else { throw new UnsupportedOperationException( this.firstEpisode.getClass().getCanonicalName() + "Not supported yet"); } if (this.secondEpisode instanceof OnceDayEvent) { OnceDayEvent secondEpisodeDayEvent = (OnceDayEvent) this.secondEpisode; secondEpisodeStartDates = secondEpisodeDayEvent.getPossibleDays(); secondEpisodeEndDates = secondEpisodeDayEvent.getPossibleDays(); } else if (this.secondEpisode instanceof OncePeriodEvent) { OncePeriodEvent secondEpisodePeriodEvent = (OncePeriodEvent) this.secondEpisode; secondEpisodeStartDates = secondEpisodePeriodEvent.getStartPossibleDays(); secondEpisodeEndDates = secondEpisodePeriodEvent.getEndPossibleDays(); } else { throw new UnsupportedOperationException( this.firstEpisode.getClass().getCanonicalName() + "Not supported yet"); } Iterator<DateTime> firstEpisodeStartDatesIterator = firstEpisodeStartDates.iterator(); Iterator<DateTime> secondEpisodeStartDatesIterator = secondEpisodeStartDates.iterator(); DateTime curFirstEpisodeStartDate = firstEpisodeStartDatesIterator.next(); DateTime curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next(); Iterator<DateTime> firstEpisodeEndDatesIterator = firstEpisodeEndDates.iterator(); Iterator<DateTime> secondEpisodeEndDatesIterator = secondEpisodeEndDates.iterator(); DateTime curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next(); DateTime curSecondEpisodeEndDate = secondEpisodeEndDatesIterator.next(); boolean cont = true; if (this.kind == RelationKind.IMMEDIATELY_BEFORE) { DateTime startOfLastDay = secondEpisodeStartDates.last().withHourOfDay(1); /*while (indexInToFirstEpisodeDatesDates < firstEpisodeDates.size()) { if (firstEpisodeDates.get(indexInToFirstEpisodeDatesDates).isAfter(startOfLastDay)) { firstEpisodeDates.remove(indexInToFirstEpisodeDatesDates); changed = true; } else { indexInToFirstEpisodeDatesDates++; } }*/ while (!firstEpisodeEndDates.isEmpty()) { if (firstEpisodeEndDates.last().isAfter(startOfLastDay)) { firstEpisodeEndDates.pollLast(); changed = true; } else { break; } } DateTime endOfFirstPossibleDay = firstEpisodeEndDates.first().withHourOfDay(23); while (cont) { if (endOfFirstPossibleDay.isAfter(curSecondEpisodeStartDate)) { secondEpisodeStartDatesIterator.remove(); if (secondEpisodeStartDatesIterator.hasNext()) { curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next(); } else { cont = false; } changed = true; } else { //indexInToSecondEpisodeDatesDates++; break; } } } else if (this.kind == RelationKind.BEFORE) { DateTime startOfLastDay = secondEpisodeStartDates.last().withHourOfDay(1); /*while (indexInToFirstEpisodeDatesDates < firstEpisodeDates.size()) { if (firstEpisodeDates.get(indexInToFirstEpisodeDatesDates).isAfter(startOfLastDay)) { firstEpisodeDates.remove(indexInToFirstEpisodeDatesDates); changed = true; } else { indexInToFirstEpisodeDatesDates++; } }*/ while (!firstEpisodeEndDates.isEmpty()) { if (firstEpisodeEndDates.last().isAfter(startOfLastDay)) { firstEpisodeEndDates.pollLast(); changed = true; } else { break; } } DateTime endOfFirstPossibleDay = firstEpisodeEndDates.first().withHourOfDay(23); while (cont) { if (endOfFirstPossibleDay.isAfter(curSecondEpisodeStartDate)) { secondEpisodeStartDatesIterator.remove(); if (secondEpisodeStartDatesIterator.hasNext()) { curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next(); } else { cont = false; } changed = true; } else { //indexInToSecondEpisodeDatesDates++; break; } } } else if (this.kind == RelationKind.FIXED_TIME_BEFORE) { //while (indexInToFirstEpisodeDatesDates < firstEpisodeEndDates.size()) { while (cont) { //DateTime later = firstEpisodeEndDates.get(indexInToFirstEpisodeDatesDates).plus(time); DateTime later = curFirstEpisodeEndDate.plus(this.time); if (secondEpisodeStartDates.contains(later)) { if (firstEpisodeEndDatesIterator.hasNext()) { curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next(); } else { break; } } else { firstEpisodeEndDatesIterator.remove(); if (firstEpisodeEndDatesIterator.hasNext()) { curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next(); } else { cont = false; } changed = true; } } while (cont) { DateTime earlier = curSecondEpisodeStartDate.minus(this.time); if (firstEpisodeEndDates.contains(earlier)) { if (secondEpisodeStartDatesIterator.hasNext()) { curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next(); } else { break; } } else { secondEpisodeStartDatesIterator.remove(); if (secondEpisodeStartDatesIterator.hasNext()) { curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next(); } else { cont = false; } changed = true; } } } else if (this.kind == RelationKind.LESS_THEN_BEFORE) { DateTime startOfDay = curSecondEpisodeStartDate.withHourOfDay(1); DateTime tempEarliestPossibleDate = curSecondEpisodeStartDate.minus(this.time).withHourOfDay(1); while (cont) { if (curFirstEpisodeEndDate.isBefore(tempEarliestPossibleDate)) { firstEpisodeEndDatesIterator.remove(); if (firstEpisodeEndDatesIterator.hasNext()) { curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next(); } else { cont = false; } changed = true; } else if (curFirstEpisodeEndDate.isAfter(startOfDay)) { //if (indexInToSecondEpisodeDatesDates < secondEpisodeStartDates.size()) { if (secondEpisodeStartDatesIterator.hasNext()) { curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next(); startOfDay = curSecondEpisodeStartDate.withHourOfDay(1); tempEarliestPossibleDate = curSecondEpisodeStartDate.minus(this.time).withHourOfDay(1); } else { firstEpisodeEndDatesIterator.remove(); if (firstEpisodeEndDatesIterator.hasNext()) { curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next(); } else { cont = false; } changed = true; } } else { if (firstEpisodeEndDatesIterator.hasNext()) { curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next(); } else { cont = false; } } } firstEpisodeStartDatesIterator = firstEpisodeStartDates.iterator(); secondEpisodeStartDatesIterator = secondEpisodeStartDates.iterator(); curFirstEpisodeStartDate = firstEpisodeStartDatesIterator.next(); curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next(); firstEpisodeEndDatesIterator = firstEpisodeEndDates.iterator(); secondEpisodeEndDatesIterator = secondEpisodeEndDates.iterator(); curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next(); curSecondEpisodeEndDate = secondEpisodeEndDatesIterator.next(); cont = true; DateTime endOfDay = curFirstEpisodeEndDate.withHourOfDay(23); DateTime tempLatestPossibleDate = curFirstEpisodeEndDate.plus(this.time).withHourOfDay(23); while (cont) { if (curSecondEpisodeStartDate.isBefore(endOfDay)) { secondEpisodeStartDatesIterator.remove(); if (secondEpisodeStartDatesIterator.hasNext()) { curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next(); } else { cont = false; } changed = true; } else if (curSecondEpisodeStartDate.isAfter(tempLatestPossibleDate)) { //indexInToFirstEpisodeDatesDates++; //if (indexInToFirstEpisodeDatesDates < firstEpisodeEndDates.size()) { if (firstEpisodeEndDatesIterator.hasNext()) { curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next(); endOfDay = curFirstEpisodeEndDate.withHourOfDay(23); tempLatestPossibleDate = curFirstEpisodeEndDate.plus(this.time).withHourOfDay(23); } else { secondEpisodeStartDatesIterator.remove(); if (secondEpisodeStartDatesIterator.hasNext()) { curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next(); } else { cont = false; } changed = true; } } else { if (secondEpisodeStartDatesIterator.hasNext()) { curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next(); } else { cont = false; } } } } else if (this.kind == RelationKind.SAME_DAY_OF_YEAR) { changed |= this.mSameTimeOfYearConstraint.complexApplyConstraint(); } else if ((this.kind == RelationKind.SAME_TIME_AS) || (this.kind == RelationKind.BEFORE_SAME_DAY)) { Iterator<DateTime> iterator = firstEpisodeStartDates.iterator(); while (iterator.hasNext()) { DateTime next = iterator.next(); if (!secondEpisodeStartDates.contains(next)) { iterator.remove(); changed = true; } } iterator = secondEpisodeStartDates.iterator(); while (iterator.hasNext()) { DateTime next = iterator.next(); if (!firstEpisodeStartDates.contains(next)) { iterator.remove(); changed = true; } } iterator = firstEpisodeEndDates.iterator(); while (iterator.hasNext()) { DateTime next = iterator.next(); if (!secondEpisodeEndDates.contains(next)) { iterator.remove(); changed = true; } } iterator = secondEpisodeEndDates.iterator(); while (iterator.hasNext()) { DateTime next = iterator.next(); if (!firstEpisodeEndDates.contains(next)) { iterator.remove(); changed = true; } } } else if (this.kind == RelationKind.MORE_THEN_BEFORE) { DateTime tempEarliestPossibleDateForSecondEpisode = firstEpisodeEndDates.first().plus(this.time) .withHourOfDay(1); DateTime tempLatestPossibleDateForFirstEpisode = secondEpisodeStartDates.last().minus(this.time) .withHourOfDay(23); /*while (indexInToFirstEpisodeDatesDates < firstEpisodeDates.size()) { if (firstEpisodeDates.get(indexInToFirstEpisodeDatesDates).isAfter(tempLatestPossibleDateForFirstEpisode)) { firstEpisodeDates.remove(indexInToFirstEpisodeDatesDates); changed = true; } else { indexInToFirstEpisodeDatesDates++; } }*/ while (!firstEpisodeEndDates.isEmpty()) { if (firstEpisodeEndDates.last().isAfter(tempLatestPossibleDateForFirstEpisode)) { firstEpisodeEndDates.pollLast(); changed = true; } else { break; } } while (cont) { if (tempEarliestPossibleDateForSecondEpisode.isAfter(curSecondEpisodeStartDate)) { secondEpisodeStartDatesIterator.remove(); if (secondEpisodeStartDatesIterator.hasNext()) { curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next(); } else { cont = true; } changed = true; } else { //indexInToSecondEpisodeDatesDates++; break; } } } } return changed; }
From source file:TVShowTimelineMaker.timeConstraints.Relation.java
public boolean consistentWithConstraint(DateTime inFirstDay, DateTime inSecondDay) { if ((this.kind == RelationKind.IMMEDIATELY_BEFORE) || (this.kind == RelationKind.BEFORE)) { return inFirstDay.isBefore(inSecondDay.withHourOfDay(1)); } else if (this.kind == RelationKind.FIXED_TIME_BEFORE) { return inFirstDay.plus(this.time).equals(inSecondDay); } else if (this.kind == RelationKind.LESS_THEN_BEFORE) { DateTime tempEarliestPossibleDate = inSecondDay.minus(this.time).withHourOfDay(1); return inFirstDay.isAfter(tempEarliestPossibleDate) && inFirstDay.isBefore(inSecondDay.withHourOfDay(1)); } else if (this.kind == RelationKind.SAME_DAY_OF_YEAR) { return (inFirstDay.getMonthOfYear() == inSecondDay.getMonthOfYear()) && (inFirstDay.getDayOfMonth() == inSecondDay.getDayOfMonth()); } else if ((this.kind == RelationKind.SAME_TIME_AS) || (this.kind == RelationKind.BEFORE_SAME_DAY)) { return this.mSameTimeOfYearConstraint.consistentWithConstraint(inFirstDay, inSecondDay); } else if (this.kind == RelationKind.MORE_THEN_BEFORE) { DateTime earyer = inSecondDay.minus(this.time).withHourOfDay(1); return inFirstDay.isBefore(earyer); } else {/*from w w w. j a va2 s .co m*/ return true; } }
From source file:TVShowTimelineMaker.timeConstraints.Relation.java
@Override public boolean consistentWithConstraint(T inFirstPlacement, S inSecondPlacement) { DateTime inFirstStartTime;/*from w w w . j a va 2 s . co m*/ DateTime inFirstEndTime; DateTime inSecondStartTime; DateTime inSecondEndTime; if (this.firstEpisode instanceof OnceDayEvent) { OnceDayEvent.OnceDayEventPlacement curOnceDayEventPlacement = (OnceDayEvent.OnceDayEventPlacement) inFirstPlacement; inFirstStartTime = curOnceDayEventPlacement.day; inFirstEndTime = curOnceDayEventPlacement.day; } else { OncePeriodEvent.OncePeriodEventPlacement curOncePeriodEventPlacement = (OncePeriodEvent.OncePeriodEventPlacement) inFirstPlacement; inFirstStartTime = curOncePeriodEventPlacement.startDay; inFirstEndTime = curOncePeriodEventPlacement.endDay; } if (this.secondEpisode instanceof OnceDayEvent) { OnceDayEvent.OnceDayEventPlacement curOnceDayEventPlacement = (OnceDayEvent.OnceDayEventPlacement) inSecondPlacement; inSecondStartTime = curOnceDayEventPlacement.day; inSecondEndTime = curOnceDayEventPlacement.day; } else { OncePeriodEvent.OncePeriodEventPlacement curOncePeriodEventPlacement = (OncePeriodEvent.OncePeriodEventPlacement) inSecondPlacement; inSecondStartTime = curOncePeriodEventPlacement.startDay; inSecondEndTime = curOncePeriodEventPlacement.endDay; } if ((this.kind == RelationKind.IMMEDIATELY_BEFORE) || (this.kind == RelationKind.BEFORE)) { return inFirstEndTime.isBefore(inSecondStartTime.withHourOfDay(1)); } else if (this.kind == RelationKind.FIXED_TIME_BEFORE) { return inFirstEndTime.plus(this.time).equals(inSecondStartTime); } else if (this.kind == RelationKind.LESS_THEN_BEFORE) { DateTime tempEarliestPossibleDate = inSecondStartTime.minus(this.time).withHourOfDay(1); return inFirstEndTime.isAfter(tempEarliestPossibleDate) && inFirstEndTime.isBefore(inSecondStartTime.withHourOfDay(1)); } else if (this.kind == RelationKind.SAME_DAY_OF_YEAR) { return this.mSameTimeOfYearConstraint.consistentWithConstraint(inFirstPlacement, inSecondPlacement); } else if ((this.kind == RelationKind.SAME_TIME_AS) || (this.kind == RelationKind.BEFORE_SAME_DAY)) { return inFirstStartTime.equals(inSecondStartTime) && inFirstEndTime.equals(inSecondEndTime); } else if (this.kind == RelationKind.MORE_THEN_BEFORE) { DateTime earyer = inSecondStartTime.minus(this.time).withHourOfDay(1); return inFirstEndTime.isBefore(earyer); } else { return true; } }
From source file:TVShowTimelineMaker.timeConstraints.Relation.java
@Override public Event[] increaseWhat(Placement<?> inValues[]) { DateTime inFirstStartTime;//w w w . j av a 2s . c o m DateTime inFirstEndTime; DateTime inSecondStartTime; DateTime inSecondEndTime; if (this.firstEpisode instanceof OnceDayEvent) { OnceDayEvent.OnceDayEventPlacement curOnceDayEventPlacement = (OnceDayEvent.OnceDayEventPlacement) inValues[0]; inFirstStartTime = curOnceDayEventPlacement.day; inFirstEndTime = curOnceDayEventPlacement.day; } else { return new Event[] { this.firstEpisode, this.secondEpisode }; } if (this.secondEpisode instanceof OnceDayEvent) { OnceDayEvent.OnceDayEventPlacement curOnceDayEventPlacement = (OnceDayEvent.OnceDayEventPlacement) inValues[1]; inSecondStartTime = curOnceDayEventPlacement.day; inSecondEndTime = curOnceDayEventPlacement.day; } else { return new Event[] { this.firstEpisode, this.secondEpisode }; } if ((this.kind == RelationKind.IMMEDIATELY_BEFORE) || (this.kind == RelationKind.BEFORE)) { if (!inFirstEndTime.isBefore(inSecondStartTime.withHourOfDay(1))) { return new Event[] { this.secondEpisode }; } } else if (this.kind == RelationKind.FIXED_TIME_BEFORE) { //inFirstEndTime.plus(this.time).equals(inSecondStartTime); DateTime later = inFirstEndTime.plus(this.time); if (later.isBefore(inSecondStartTime)) { return new Event[] { this.firstEpisode }; } else if (later.isAfter(inSecondStartTime)) { return new Event[] { this.secondEpisode }; } } else if (this.kind == RelationKind.LESS_THEN_BEFORE) { DateTime tempEarliestPossibleDate = inSecondStartTime.minus(this.time).withHourOfDay(1); if (!inFirstEndTime.isAfter(tempEarliestPossibleDate)) { return new Event[] { this.firstEpisode }; } if (!inFirstEndTime.isBefore(inSecondStartTime.withHourOfDay(1))) { return new Event[] { this.secondEpisode }; } } else if (this.kind == RelationKind.SAME_DAY_OF_YEAR) { return this.mSameTimeOfYearConstraint.increaseWhat(inValues); } else if ((this.kind == RelationKind.SAME_TIME_AS) || (this.kind == RelationKind.BEFORE_SAME_DAY)) { //inFirstStartTime.equals(inSecondStartTime) && inFirstEndTime.equals(inSecondEndTime); if (inFirstStartTime.isBefore(inSecondStartTime) || inFirstEndTime.isBefore(inSecondEndTime)) { return new Event[] { this.firstEpisode }; } else if (inFirstStartTime.isAfter(inSecondStartTime) || inFirstEndTime.isAfter(inSecondEndTime)) { return new Event[] { this.secondEpisode }; } } else if (this.kind == RelationKind.MORE_THEN_BEFORE) { DateTime earyer = inSecondStartTime.minus(this.time).withHourOfDay(1); if (!inFirstEndTime.isBefore(earyer)) { return new Event[] { this.secondEpisode }; } } return new Event[] {}; }
From source file:ua.com.fielden.platform.example.swing.booking.BookingChartPanelExample.java
private static IBookingChartMouseEventListener<VehicleEntity, BookingEntity> createMouseListener( final JLabel taskBar, final Date now) { return new IBookingChartMouseEventListener<VehicleEntity, BookingEntity>() { private final Duration defaultDuration = Duration.standardDays(1); @Override//from w ww . ja v a2 s.co m public void mouseClick(final BookingMouseEvent<VehicleEntity, BookingEntity> event) { if (event.getTask() == null && event.getSourceEvent().getClickCount() == 2 && event.getX().after(now)) { addNewSubTask(event); } else if (event.getTask() != null) { taskBar.setText( event.getTask().getEntity() + ", " + event.getTask().getSubEntity().getBookingStart()); } } private void addNewSubTask(final BookingMouseEvent<VehicleEntity, BookingEntity> event) { final BookingTask<VehicleEntity, BookingEntity> firstBefore = event.getSource() .getFirstTaskBefore(bookingSeries, event.getX(), event.getY()); final BookingTask<VehicleEntity, BookingEntity> firstAfter = event.getSource() .getFirstTaskAfter(bookingSeries, event.getX(), event.getY()); final Date firstBeforeDate = firstBefore != null && firstBefore.getTo() != null && firstBefore.getTo().after(now) ? firstBefore.getTo() : now; final Date firstAfterDate = firstAfter != null && firstAfter.getFrom() != null ? firstAfter.getFrom() : new DateTime(event.getX().getTime()).plus(defaultDuration).toDate(); DateTime start = null; DateTime end = null; if (firstAfterDate.getTime() - firstBeforeDate.getTime() >= defaultDuration.getMillis()) { start = new DateTime(event.getX().getTime() - defaultDuration.getMillis() / 2); if (start.isBefore(firstBeforeDate.getTime())) { start = new DateTime(firstBeforeDate.getTime()); } end = start.plus(defaultDuration); if (end.isAfter(firstAfterDate.getTime())) { end = new DateTime(firstAfterDate.getTime()); start = end.minus(defaultDuration); } } else { start = new DateTime(firstBeforeDate.getTime()); end = new DateTime(firstAfterDate.getTime()); } final BookingEntity booking = new BookingEntity().// setVehicleEntity(event.getSource().getEntity(event.getY())).// setBookingStart(start.toDate()).setBookingFinish(end.toDate()); event.getSource().addTask(bookingSeries, event.getY(), booking); } @Override public void mouseMove(final BookingMouseEvent<VehicleEntity, BookingEntity> event) { // TODO Auto-generated method stub } }; }