|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.progeeks.util.ProgressManager
public class ProgressManager
Provides thread-context sensitive access to progress reporters. A lot of times, deeply nested code will want to report progress to the user or caller or whomever. The idea is that this should be a global resource similar to logging or stdout, etc.. Furthermore, progress reporting is very specific to the thread in which the code is being run. On the swing thread, for example, there is little point to opening up a progress dialog since it will never be updated. ProgressManager provides a mechanism whereby the thread creators can determine what method should be used when reporting progress. Code that does lengthy processing can simply access the static getProgressReporter() methods on this class and the appropriate factory will be used to construct one.
Nested Class Summary | |
---|---|
static class |
ProgressManager.ReporterFactory
Base implementation of the ProgressReporterFactory. |
static class |
ProgressManager.UserRequestReporterFactory
ProgressReporter factory that wraps a UserRequestHAndler to provide access to progress reporter instances. |
Constructor Summary | |
---|---|
ProgressManager()
|
Method Summary | |
---|---|
protected static ProgressManager.ReporterFactory |
getFactory()
Returns the progress reporter factory for this thread. |
static ProgressReporter |
getProgressReporter(java.lang.String title,
java.lang.String message,
int min,
int max)
Returns a ProgressReporter that can be used to report status to the user. |
static void |
setDefaultFactory(ProgressManager.ReporterFactory factory)
Sets the default ReporterFactory that will be used when a thread has no other factory specified. |
static void |
setFactory(ProgressManager.ReporterFactory factory)
Registers the specified ReporterFactory as the context factory for this thread. |
static void |
setUserRequestHandler(UserRequestHandler reqHandler)
Convenience method for registering a factory for this thread by wrapping the specified UserRequestHandler using UserRequestReporterFactory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProgressManager()
Method Detail |
---|
public static void setDefaultFactory(ProgressManager.ReporterFactory factory)
public static void setFactory(ProgressManager.ReporterFactory factory)
public static void setUserRequestHandler(UserRequestHandler reqHandler)
protected static ProgressManager.ReporterFactory getFactory()
public static ProgressReporter getProgressReporter(java.lang.String title, java.lang.String message, int min, int max)
title
- The main operation being performed or some descriptive title.
Depending on the underlying implementation, status may be grouped
by title.message
- The current status message of the operation.min
- The initial minimum value.max
- The initial maximum value. If min and max are -1 then the progress
reporter is in an indeterminate state. For example, a swing dialog
will just swish back and forth until a real min/max are provided.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |