org.as2lib.app.exec.AbstractProcess
AbstractProcess
is a abstract helper class to implement processes.
Most of the functionalities of Process are served well within
AbstractProcess
. Because of the situation that most processes are
simple executions AbstractProcess
allows easy implementations of
Process.
To use the advantage of AbstractProcess
simple extend it and
implement the run method.
It executes run at start and handles the exeuction of events and the correct states. If you wan't to stop your process pause and resume offer direct support.
public function setParentProcess(p:Process):Void
Setter for a possible parent process.
p | Process to act as parentprocess. |
IllegalArgumentException | if the applied process has the current instance in its parents-hierarchy. |
public function startSubProcess(process:Process, args:Array, callBack:Executable):Void
Starts a sub process.
Your Process will not be finished until all the subprocesses are finished.
If you start more processes after each other, all will get started immediately. It is no batch system where one starts strictly after another.
You can start one specific process only if this process wasn't started before
process | Process to be started. |
args | Arguments for the process start. |
callBack | Callback to be executed if the process finishes. |
public function hasFinished(Void):Boolean
true if the process has finished. (false if the process hasn't started yet)
public function addProcessListener(listener:ProcessListener):Void
Adds a ProcessListener as Observer to the process.
listener | ProcessListener to be added. |
public function removeProcessListener(listener:ProcessListener):Void
Removes a ProcessListener as Observer from the process.
listener | ProcessListener to be added. |
public function addAllProcessListeners(list:Array):Void
Adds a list
of ProcessListener as Observer to the process.
list | List of listeners to be added. |
public function getAllProcessListeners(Void):Array
Flag if the process has been started.
true if the process has been started and isn't finish yet else false.
public function getPercentage(Void):Number
Getter for the currently executed percentage of the process.
Percentage of execution. Null if percentage was not evaluateable.
public function onUpdateProcess(process:Process):Void
Method to be executed if a process property changes.
process | Process that changed some properties |
public function onStartProcess(process:Process):Void
Method to be executed if a process starts execution.
process | Process that started execution |
public function onFinishProcess(process:Process):Void
Method to be executed if a process finishes its execution.
process | Process that finished with execution |
public function onProcessError(process:Process, error):Void
Method to be executed if a exception was thrown during the execution.
process | Process where a error occured |
error | Error that was catched with try & catch |
public function onResumeProcess(process:Process):Void
Method to be executed if a process awakes from pause.
process | Process that resumes from pause |