/** * Notifies the progress monitor that the status has changed. * @param status A <code>String</code> describing the status. */ private void notifyStatusChanged(String status) { synchronized (monitor) { this.monitor.notifyStatusChanged(status); } }
public void notifyStatusChanged(String status) { for (ProgressMonitor monitor : this.monitors) { monitor.notifyStatusChanged(status); } }
public void notifyStatusChanged(String status) { synchronized (syncObject) { monitor.notifyStatusChanged(status); } }
public void notifyStatusChanged(String status) { monitor.notifyStatusChanged(status); }
@Override public Object performTask(Object task, ProgressMonitor monitor) { int value = (Integer) task; String msg = String.format("Processing task %d.", value); monitor.notifyStatusChanged(msg); System.out.println(msg); int sleepTime = minSleepTime + random.nextInt(maxSleepTime - minSleepTime + 1); try { Thread.sleep(sleepTime); } catch (InterruptedException e) { // nothing to do. } msg = String.format("Done task %d.", value); monitor.notifyStatusChanged(msg); System.out.println(msg); return value; }
/** * 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; }