public interface IMonitor
Modifier and Type | Field and Description |
---|---|
static int |
EVENT_MONITOR_CANCEL
This constant is used to represent an event that signals
that the operation should be canceled.
|
static int |
EVENT_MONITOR_DONE
This constant is used to represent an event that signals
that the operation monitored by this monitor has called
the done method.
|
static int |
EVENT_MONITOR_NAME
This constant is used to represent an event that signals
a call to the set name method.
|
static int |
EVENT_MONITOR_START
This constant is used to represent an event that signals
a call to the start method.
|
static int |
EVENT_MONITOR_STEP
This constant is used to represent an event that signals
a call to the stop method.
|
static int |
STEP_UNKNOWN
This constant should be used if the total number of steps
performed by the operation is not known.
|
Modifier and Type | Method and Description |
---|---|
void |
addMonitorListener(int types,
IListener listener)
Adds the specified listener to the set of listeners that need
to be informed whenever the state of the monitor changes.
|
void |
cancel()
Sets the canceled state of the monitor to true.
|
void |
done()
Informs the monitor that the operation has finished.
|
boolean |
isCanceled()
Queries the monitor to determine whether the operation has
been canceled.
|
boolean |
isDone()
Determines whether the progress monitor assumes that the
operation is still running.
|
void |
join()
Waits until the monitor's state is set to done or an the
thread is interrupted.
|
boolean |
removeMonitorListener(int types,
IListener listener)
Removes the specified listener from the set of registered
listeners for the specified types of events.
|
void |
setName(java.lang.String operation)
Sets the name of the current operation.
|
void |
start(int total)
Begins an operation that has the specified total number of
steps to perform.
|
void |
step(int steps)
Informs the monitor that the specified number of steps has
been performed.
|
static final int EVENT_MONITOR_START
static final int EVENT_MONITOR_STEP
static final int EVENT_MONITOR_NAME
static final int EVENT_MONITOR_DONE
static final int EVENT_MONITOR_CANCEL
static final int STEP_UNKNOWN
void addMonitorListener(int types, IListener listener)
types
- The types of events to register for. The types
supported depend on the monitor implementation. However,
each monitor must implement at least the event constants
defined by this interface.listener
- The listener that listens to changes.boolean removeMonitorListener(int types, IListener listener)
types
- The types of events to unregister.listener
- The listener to unregister.void setName(java.lang.String operation)
operation
- The name of the current operation.void start(int total)
total
- The total number of steps to perform.void step(int steps)
steps
- The number of steps that has been performed.void done()
boolean isDone()
void cancel()
boolean isCanceled()
void join() throws java.lang.InterruptedException
java.lang.InterruptedException
- Thrown if the thread is
interrupted.