Example #1
1
 /** Removes the task. */
 public void remove() {
   startTask.cancel();
   endTask.cancel();
   calendarService.removeFromTaskMap(id);
   calendarService.removeFromCurrentItems(this);
   calendarService.updateStateFromCurrentItems();
 }
Example #2
0
 /** This method is executed in the end of the calendar item. */
 protected void stop() {
   calendarService.removeFromTaskMap(id);
   calendarService.removeFromCurrentItems(this);
   calendarService.updateStateFromCurrentItems();
   if (pattern != null) {
     CalendarItemTimerTask nextTask = pattern.next(startDate, endDate);
     this.pattern = null;
     nextTask.scheduleTasks();
   }
 }
Example #3
0
 /**
  * Constructs new <tt>CalendarItemTimerTask</tt> instance.
  *
  * @param state the state of the calendar item.
  * @param startDate the start date of the calendar item.
  * @param endDate the end date of the calendar item.
  * @param id the ID of the calendar item.
  * @param executeNow Indicates if the start task should be executed immediately or not
  * @param pattern the <tt>RecurringPattern</tt> instance associated with the calendar item. It
  *     must be <tt>null</tt> if the calendar item is not recurring.
  */
 public CalendarItemTimerTask(
     CalendarService.BusyStatusEnum state,
     Date startDate,
     Date endDate,
     String id,
     boolean executeNow,
     RecurringPattern pattern) {
   this.state = state;
   this.startDate = startDate;
   this.endDate = endDate;
   this.id = id;
   calendarService.addToTaskMap(id, this);
   this.executeNow = executeNow;
   this.pattern = pattern;
 }
Example #4
0
 /** This method is executed in the beginning of the calendar item. */
 protected void start() {
   calendarService.addToCurrentItems(this);
   calendarService.updateStateFromCurrentItems();
 }