This is not a GUI for Java's ProgressMonitor. Instead its a GUI component that works with the JProgressMonitor, MonitorableINF and MonitoringINF classes to replace Java's progress monitoring stuff.
This is a little frame with a JProgressBar to show the progress of some task. This traces the progresses of the MonitorableINF task, and informs the MonitoringINF class of the task's completion by calling MonitoringINF.done(). The MonitorableINF is a Thread, which does the actual work. This class has a Timer object, and at some time interval checks on the progress of the MonitorableINF task. It then updates the message in this GUI component and the JProgressBar.
This class is also a MonitorableListener. Completion and somtimes cancellation is handled by that listener code. If the MonitorableINF fires {@link com.visitrend.ndvis.event.MonitorableListener#taskCompleted(MonitorableEvent) taskCompleted(MonitorableEvent)}then this class removes itself as a listener and calls its done() method. If the MonitorableINF fires {@link com.visitrend.ndvis.event.MonitorableListener#taskCancelled(MonitorableEvent) taskCancelled(MonitorableEvent)}then this class removes itself as a listener and calls its cancel() method. The {@link com.visitrend.ndvis.event.MonitorableListener#taskCancelled(MonitorableEvent) taskCancelled(MonitorableEvent)}method will only be called if the task is cancelled by itself or something else other than by the user clicking this class's GUI component cancel button.
@author John T. Langton - jlangton at visitrend dot comThis interface does not define the visual representation of the current progress monitor state. It is intended as a mediator between data models and progress displays (like the J2ME-Lib class {@link ProgressView}.
@author esoIProgressMonitor
interface is implemented by objects that monitor the progress of an activity; the methods in this interface are invoked by code that performs the activity. All activity is broken down into a linear sequence of tasks against which progress is reported. When a task begins, a beginTask(String, int)
notification is reported, followed by any number and mixture of progress reports (worked()
) and subtask notifications (subTask(String)
). When the task is eventually completed, a done()
notification is reported. After the done()
notification, the progress monitor cannot be reused; i.e., beginTask(String, int)
cannot be called again after the call to done()
.
A request to cancel an operation can be signaled using the setCanceled
method. Operations taking a progress monitor are expected to poll the monitor (using isCanceled
) periodically and abort at their earliest convenience. Operation can however choose to ignore cancelation requests.
Since notification is synchronous with the activity itself, the listener should provide a fast and robust implementation. If the handling of notifications would involve blocking operations, or operations which might throw uncaught exceptions, the notifications should be queued, and the actual processing deferred (or perhaps delegated to a separate thread).
@author IBM @author Konstantin Komissarchikmonitor.beginTask() try { .. do some work monitor.worked() monitor.subTask()/monitor.intermediateTask() .. do some work monitor.worked() } finally { monitor.finishTask(); }{@link #subTask(String)} and {@link #indeterminateSubTask(String)} has nothing to do with logicalstructure of the work, they just show task title to the user. If task consists of multiple tasks then {@link #createSubTaskMonitor(int,boolean)} may be used. Itwill create new ProgressMonitor, then can be passed to the subtask. Subtask doesn't know whether it runs standalone or as a part of other task. Progressbar will be updated so that total progress is shown, not just progress of the subtask All ProgressMonitor implementations should be thread safe.
incrFinishedUnits()
. Then, all registered {@link IProgressMonitorDialog}s are asked to visualize this ongoing progress.
@author Kai Benjamin Joneleit
|
|
|
|
|
|