Ejemplo n.º 1
0
 /**
  * Removes the specified task from the view.
  *
  * @param task Task to be removed from the view.
  */
 public void removeTaskFromView(AbstractTask task) {
   taskViewer.findAndRemoveTask(task);
   singleTasksInView.remove(task);
   // iterate over list manually to avoid concurrent modification
   // exception.
   for (int i = groupTasksInView.size() - 1; i >= 0; i--) {
     groupTasksInView.get(i).remove(task);
     if (groupTasksInView.get(i).isEmpty()) {
       groupTasksInView.remove(i);
     }
   }
   checkTopTask();
 }
Ejemplo n.º 2
0
  /**
   * Adds the specified task to the view, stacking it with any adjacent tasks if possible.
   *
   * @param task Task to be added to the view.
   */
  @SuppressWarnings("unchecked")
  public void addTaskToView(AbstractTask task) {
    if (recordingTasks) {
      recordedTasks.add(task.copy());
    }
    for (ArrayList<AbstractTask> group : groupTasksInView) {
      for (AbstractTask groupTask : group) {
        if (groupTask.isAdjacent(task) && groupTask.getClass() == task.getClass()) {
          taskViewer.addToStackPane((ArrayList<AbstractTask>) group.clone(), task);
          group.add(task);
          checkTopTask();
          return;
        }
      }
    }
    // check all single tasks to see if they are adjacent
    // to this new task.
    for (AbstractTask viewTask : singleTasksInView) {
      // checks if tasks are adjacent;
      if (viewTask.isAdjacent(task) && viewTask.getClass() == task.getClass()) {
        // tasks are adjacent, so make a group.
        ArrayList<AbstractTask> newGroup = new ArrayList<AbstractTask>();
        newGroup.add(viewTask);
        taskViewer.addToStackPane(newGroup, task);
        newGroup.add(task);
        groupTasksInView.add(newGroup);
        checkTopTask();
        return;
      }
    }

    // check to see if there is already a group of tasks
    // that this task will fit.
    // no group for this task, so add it to the single list.
    singleTasksInView.add(task);
    taskViewer.addTaskPane(task);
    checkTopTask();
  }
Ejemplo n.º 3
0
 /**
  * takes all tasks in the recordedTasks list, generates a name for them and saves them as a macro
  * for future requeueing.
  */
 public void stopRecordingTasks() {
   recordingTasks = false;
   String name = "";
   boolean firstName = true;
   for (AbstractTask task : recordedTasks) {
     if (!name.contains(task.getName())) {
       if (firstName) {
         name = task.getName();
         firstName = false;
       } else {
         name += (" + " + task.getName());
       }
     }
   }
   if (recordedTasks.size() > 0) {
     recordedTaskMacros.put(name, recordedTasks);
     taskViewer.updateMacrosDropdown();
   }
   recordedTasks = new ArrayList<AbstractTask>();
 }
Ejemplo n.º 4
0
 public void updateTaskDropdowns() {
   taskViewer.updateAgentDropdowns();
 }