|
JIU 0.12.0 Homepage | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jiu.ops.Operation
Base class for all operations.
It supports progress notification.
All classes that want to be notified by a new progress level of the operation
(defined as value between 0.0f (nothing has been done so far) to 1.0f
(operation finished)) must implement the ProgressListener
interface.
An abortion state is stored in each Operation object.
It should be queried by a running operation from time to time
(via getAbort()
- if it returns true
,
the operation should terminate and return control to the caller.
The abort state can be modified using setAbort(boolean)
.
Constructor Summary | |
Operation()
This constructor creates two internal empty lists for progress listeners and parameters. |
Method Summary | |
void |
addProgressListener(ProgressListener progressListener)
Adds the argument progress listener to the internal list of progress listeners. |
void |
addProgressListeners(Vector progressListeners)
Adds several progress listeners to this operation object. |
boolean |
getAbort()
Returns the current abort status. |
void |
process()
This method does the actual work of the operation. |
void |
removeProgressListener(ProgressListener progressListener)
Removes the argument progress listener from the internal list of progress listeners. |
void |
setAbort(boolean newAbortStatus)
Sets a new abort status. |
void |
setProgress(float progress)
This method will notify all registered progress listeners about a new progress level. |
void |
setProgress(int zeroBasedIndex,
int totalItems)
This method will notify all registered progress listeners about a new progress level. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Operation()
Method Detail |
public void addProgressListener(ProgressListener progressListener)
progressListener
- the progress listener to be addedpublic void addProgressListeners(Vector progressListeners)
progressListeners
- contains zero or more objects implementing ProgressListener;
each will be added by calling addProgressListener(net.sourceforge.jiu.ops.ProgressListener)
on itpublic boolean getAbort()
true
, a running operation should terminate what it is doing
(return from process()
).
setAbort(boolean)
public void process() throws MissingParameterException, OperationFailedException, WrongParameterException
WrongParameterException
- if at least one of the input parameters was
not initialized appropriately (values out of the valid interval, etc.)
MissingParameterException
- if any mandatory parameter was not given to the operation
OperationFailedException
public void removeProgressListener(ProgressListener progressListener)
progressListener
- the progress listener to be removedpublic void setAbort(boolean newAbortStatus)
newAbortStatus
- the new statusgetAbort()
public void setProgress(float progress)
progress
- new progress value, from 0.0 to 1.0public void setProgress(int zeroBasedIndex, int totalItems)
setProgress((float)zeroBasedIndex / (float)totalItems);
.
zeroBasedIndex
- the index of the item that was just processed, zero-basedtotalItems
- the number of items that will be processed
|
JIU 0.12.0 Homepage | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |