| Package | com.developmentarc.framework.controllers.abstracts |
| Class | public class AbstractTask |
| Inheritance | AbstractTask flash.events.EventDispatcher |
| Implements | ITask |
The core structure of the Task follows the same basic design of a Flash Event. Like an Event, the Task has a default type and priority that is used by the TaskController and the TaskGroup to manage and organize the order of the active tasks.
See also
| Property | Defined by | ||
|---|---|---|---|
| isBlocker : Boolean [read-only]
Determines if the Task blocks all other items
in the TaskController.
| AbstractTask | ||
| phase : String [read-only]
Defines what phase the Task is currently in.
| AbstractTask | ||
| priority : uint [read-only]
Defines the priority value of the task defined at construction.
| AbstractTask | ||
| ready : Boolean [read-only]
Defines if the task is in a ready state.
| AbstractTask | ||
| selfOverride : Boolean
Defines if the Task is self-overriding when added to a TaskGroup
or the TaskController.
| AbstractTask | ||
| taskOverrides : Array [read-only]
Defines the currently applied overrides for the Task.
| AbstractTask | ||
| type : String [read-only]
Defines the Task type.
| AbstractTask | ||
| uid : Object [read-only]
Stores the unique identification value of the Task which was defined
at construction.
| AbstractTask | ||
| Property | Defined by | ||
|---|---|---|---|
| currentOverrides : Array
Stores the list of overrides for the Task.
| AbstractTask | ||
| currentPhase : String
Stores the Task's internal current phase state value.
| AbstractTask | ||
| Method | Defined by | ||
|---|---|---|---|
|
AbstractTask(type:String, priority:int = 5, uid:Object = null, selfOverride:Boolean = false, blocking:Boolean = false)
The Abstract Task constructor is used to define the base settings for the task.
| AbstractTask | ||
|
cancel():void
Called when a previously started Task needs to be cancelled.
| AbstractTask | ||
|
complete():void
Called when a previously started Task is completed.
| AbstractTask | ||
|
error():void
Called when a task recieves an error or generates an error.
| AbstractTask | ||
|
ignore():void
Called when a previously started Task needs to be set to ignore.
| AbstractTask | ||
|
inQueue():void
Called when a Task is added to a queue (TaskController or TaskGroup).
| AbstractTask | ||
|
inWaitingForReady():void
Called when a task is waiting to be set to ready before starting.
| AbstractTask | ||
|
pause():void
Called when a previously started Task needs to be paused.
| AbstractTask | ||
|
start():void
Starts the Task's functionality.
| AbstractTask | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| AbstractTask | ||||
| AbstractTask | ||||
| AbstractTask | ||||
| AbstractTask | ||||
| AbstractTask | ||||
| AbstractTask | ||||
| AbstractTask | ||||
| Constant | Defined by | ||
|---|---|---|---|
| TASK_CREATED : String = "TASK_CREATED" [static]
Used as the flag for the current phase when a Task
has been constructed.
| AbstractTask | ||
| currentOverrides | property |
protected var currentOverrides:ArrayStores the list of overrides for the Task.
| currentPhase | property |
protected var currentPhase:StringStores the Task's internal current phase state value. This property is protected and intended to be accessible from extended Classes. The value is publicly read-able via the phase getter.
| isBlocker | property |
isBlocker:Boolean [read-only]Determines if the Task blocks all other items in the TaskController. If the Task is set as a blocking task, the controller will load no more items from the queue until this Task is complete, cancelled or errors. The default is false.
Implementation public function get isBlocker():Boolean
| phase | property |
phase:String [read-only]Defines what phase the Task is currently in. When a task is created the default phase is TASK_CREATED.
Implementation public function get phase():String
| priority | property |
priority:uint [read-only]Defines the priority value of the task defined at construction. 0 is the highest priority, int.MAX_VALUE is the lowest.
Implementation public function get priority():uint
| ready | property |
ready:Boolean [read-only]Defines if the task is in a ready state.
Implementation public function get ready():Boolean
| selfOverride | property |
selfOverride:Boolean [read-write]Defines if the Task is self-overriding when added to a TaskGroup or the TaskController. Tasks with matching uid's will be overridden.
Implementation public function get selfOverride():Boolean
public function set selfOverride(value:Boolean):void
See also
| taskOverrides | property |
taskOverrides:Array [read-only]Defines the currently applied overrides for the Task. Overrides are used by the TaskController and the TaskGroup to determine if the current task is responsible for removing/canceling existing tasks in the system.
Implementation public function get taskOverrides():Array
| type | property |
type:String [read-only]Defines the Task type.
Implementation public function get type():String
| uid | property |
uid:Object [read-only]Stores the unique identification value of the Task which was defined at construction. The uid is used by the TaskController and TaskGroup to determine what if the Task should be overridden well self override is set to true. Tasks with matching uid's will be overridden.
Implementation public function get uid():Object
See also
| AbstractTask | () | constructor |
public function AbstractTask(type:String, priority:int = 5, uid:Object = null, selfOverride:Boolean = false, blocking:Boolean = false)The Abstract Task constructor is used to define the base settings for the task. The only required argument is the type parameter which defines the Task type similar to an Event type.
Parameterstype:String — The Task type.
|
|
priority:int (default = 5) — The priority of the task, 0 is the highest priority, int.MAX_VALUE is the lowest.
|
|
uid:Object (default = null) — The unique identification id of the task used during the override process.
|
|
selfOverride:Boolean (default = false) — Defines of the task is self overriding.
|
|
blocking:Boolean (default = false) — Defines if the task is blocking.
|
| cancel | () | method |
public function cancel():voidCalled when a previously started Task needs to be cancelled. This is an optional method that must be overridden by the extending class to implement the cancel ability. By default the cancel() method sets the current phase to TaskEvent.TASK_CANCEL and then dispatches a TaskEvent informing any listener that the Task has now been paused.
When extending the AbstractTask, this method must be overridden to define the functionality of the task. It is recommended that calling super.cancel() is added as the last step of the overridden method so that the phase and TaskEvent is dispatched correctly.
| complete | () | method |
public function complete():voidCalled when a previously started Task is completed. This is an optional method that must be overridden by the extending class to implement the complete ability. By default the complete() method sets the current phase to TaskEvent.TASK_COMPLETE and then dispatches a TaskEvent informing any listener that the Task has now been paused.
When extending the AbstractTask, this method must be overridden to define the functionality of the task. It is recommended that calling super.complete() is added as the last step of the overridden method so that the phase and TaskEvent is dispatched correctly.
| error | () | method |
public function error():voidCalled when a task recieves an error or generates an error. By default the error() method sets the current phase to TaskEvent.TASK_ERROR and then dispatches a TaskEvent informing any listener that the Task has now been paused.
When extending the AbstractTask, this method must be overridden to define the functionality of the task. It is recommended that calling super.error() is added as the last step of the overridden method so that the phase and TaskEvent is dispatched correctly.
| ignore | () | method |
public function ignore():voidCalled when a previously started Task needs to be set to ignore. This is an optional method that must be overridden by the extending class to implement the cancel ability. By default the ignore() method sets the current phase to TaskEvent.TASK_IGNORED and then dispatches a TaskEvent informing any listener that the Task has now been paused.
When extending the AbstractTask, this method must be overridden to define the functionality of the task. It is recommended that calling super.ignore() is added as the last step of the overridden method so that the phase and TaskEvent is dispatched correctly.
| inQueue | () | method |
public function inQueue():voidCalled when a Task is added to a queue (TaskController or TaskGroup). This is an optional method that must be overridden by the extending class to implement the inQueue functionality. By default the inQueue() method sets the current phase to TaskEvent.TASK_QUEUED and then dispatches a TaskEvent informing any listener that the Task has now been paused.
When extending the AbstractTask, this method must be overridden to define the functionality of the task. It is recommended that calling super.inQueue() is added as the last step of the overridden method so that the phase and TaskEvent is dispatched correctly.
| inWaitingForReady | () | method |
public function inWaitingForReady():voidCalled when a task is waiting to be set to ready before starting. This is an optional method that must be overridden by the extending class to implement the waiting ability. By default the inWaitingForReady() method sets the current phase to TaskEvent.TASK_WAITING_FOR_READY and then dispatches a TaskEvent informing any listener that the Task has now been paused.
When extending the AbstractTask, this method must be overridden to define the functionality of the task. It is recommended that calling super.inWaitingForReady() is added as the last step of the overridden method so that the phase and TaskEvent is dispatched correctly.
| pause | () | method |
public function pause():voidCalled when a previously started Task needs to be paused. This is an optional method that must be overridden by the extending class to implement the pause ability. By default the pause() method sets the current phase to TaskEvent.TASK_PAUSE and then dispatches a TaskEvent informing any listener that the Task has now been paused.
When extending the AbstractTask, this method must be overridden to define the functionality of the task. It is recommended that calling super.pause() is added as the last step of the overridden method so that the phase and TaskEvent is dispatched correctly.
| start | () | method |
public function start():voidStarts the Task's functionality. When the TaskController or TaskGroup is ready to start the Task, the start() method is called. The AbstractTask sets the current Phase to TaskEvent.TASK_START and then dispatches a TaskEvent informing any listener that the Task has now been started.
When extending the AbstractTask, this method must be overridden to define the functionality of the task. It is recommended that calling super.start() is added as the last step of the overridden method so that the phase and TaskEvent is dispatched correctly.
| taskCancel | event |
| taskCompelte | event |
| taskError | event |
| taskPause | event |
| taskQueued | event |
| taskReady | event |
| taskStart | event |
| TASK_CREATED | constant |
public static const TASK_CREATED:String = "TASK_CREATED"Used as the flag for the current phase when a Task has been constructed.