public void notifyComplete() { synchronized (syncObject) { monitor.notifyComplete(); } }
public void notifyComplete() { for (ProgressMonitor monitor : this.monitors) { monitor.notifyComplete(); } }
@Override public Object performTask(Object task, ProgressMonitor monitor) { System.out.print("Performing task: "); System.out.println(task); try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } monitor.notifyComplete(); return ((Integer) task) + 2; }
monitor.notifyCancelled(); } else { monitor.notifyComplete();
/** * Updates the <code>ProgressMonitor</code> according to the new * status of the job. * @param newStatus The <code>JobStatus</code> indicating the new * status of the job. */ public synchronized void updateStatus(JobStatus newStatus) { assert(status == null || newStatus.getJobId().equals(status.getJobId())); if (newStatus.isProgressIndeterminant()) { monitor.notifyIndeterminantProgress(); } else if (status == null || newStatus.getProgress() != status.getProgress()) { monitor.notifyProgress(newStatus.getProgress()); } if (status == null || !newStatus.getStatus().equals(status.getStatus())) { monitor.notifyStatusChanged(newStatus.getStatus()); } if (newStatus.isComplete() && (status == null || !status.isComplete())) { monitor.notifyComplete(); } if (newStatus.isCancelled() && (status == null || !status.isCancelled())) { monitor.notifyCancelled(); } status = newStatus; }