예제 #1
0
  /**
   * This method adds the task to the current list of tasks
   *
   * @param newtask the task to be added into the list
   */
  public boolean addTask(Task newtask) {
    assert newtask != null;

    if (TaskCheckLogic.blockedDateCheck(newtask)) {
      ArrayList<Task> newList = modifier.getContentList();
      newList.add(newtask);
      updateFile(newList);
      LoggingLogic.logging(ADDING_SUCCESSFUL);
      return true;
    } else {
      FeedbackPane.displayInvalidAddBlocked();
      LoggingLogic.logging(ADDING_UNSUCCESSFUL);
      return false;
    }
  }
예제 #2
0
 /**
  * This method edits the entire timeline of the task, which must include both the start date as
  * well as the end date
  *
  * @param lineToBeEdit the line index of the task to be edited
  * @param startDate the start date object with or without time
  * @param endDate the end date object with or without time
  */
 public boolean editTimeline(int lineToBeEdit, String startDate, String endDate) {
   ArrayList<Task> taskList = modifier.getContentList();
   Task task = taskList.get(lineToBeEdit);
   if (startDate.contains(" ")) {
     task.setStartDateWithTime(startDate);
     task.setEndDateWithTime(endDate);
     task.setHasTime(true);
   } else {
     task.setStartDate(startDate);
     task.setEndDate(endDate);
     task.setHasTime(false);
   }
   if (TaskCheckLogic.blockedDateCheck(task)) {
     taskList.set(lineToBeEdit, task);
     updateFile(taskList);
     return true;
   } else {
     FeedbackPane.displayInvalidEditBlocked();
     return false;
   }
 }