コード例 #1
0
 public void taskEvent(TaskEvent event) {
   synchronized (d_lock) {
     Task source = event.getSource();
     if (d_progress.containsKey(source)) {
       updateTaskProgress(source, event);
     }
   }
 }
コード例 #2
0
 private void updateTaskProgress(Task source, TaskEvent event) {
   EventType type = event.getType();
   switch (type) {
     case TASK_FINISHED:
       d_progress.put(source, 1.0);
       break;
     case TASK_PROGRESS:
       d_progress.put(source, calcProgress((TaskProgressEvent) event));
       break;
     case TASK_RESTARTED:
     case TASK_STARTED:
       d_progress.put(source, 0.0);
     default:
       break;
   }
   setProgress(calcProgress());
   setDeterminate(calcDeterminate());
 }