Packagecom.adobe.portfolio.utils
Classpublic class JobQueue
InheritanceJobQueue Inheritance flash.events.EventDispatcher

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

The JobQueue class implements a priority job queue that runs jobs sequentially.

JobQueue implements a queue that is particularly useful for deferred computation of list display elements, and can also be used for tasks that need to be done serially.

JobQueue can be either FILO (first in, last out) or FIFO (first in, first out).



Public Properties
 PropertyDefined By
  fifo : Boolean
The queue ordering: fifo = true -> fifo queuing; fifo = false -> filo queuing
JobQueue
  minExecutionPriority : int
The minimum execution priority.
JobQueue
  pause : Boolean
[write-only] Pause (or start) the job queue.
JobQueue
  queueName : String
[read-only] The queue name.
JobQueue
Public Methods
 MethodDefined By
  
JobQueue(queueName:String, fifo:Boolean = false, autoStart:Boolean = true, timerInterval:int = 50)
Constructor.
JobQueue
  
getJob(jobKey:Object):Object
Get the job associated with the specified job key.
JobQueue
  
getJobKey():Object
Return the key of the next job to be executed.
JobQueue
  
hasJobs():Boolean
Whether the queue has pending jobs.
JobQueue
  
Kills all pending jobs.
JobQueue
  
pushJob(jobKey:Object, job:Object, callBack:Function, jobPriority:int = 0):void
Push a job onto the queue.
JobQueue
  
removeJob(jobKey:Object):Boolean
Remove a job from the queue.
JobQueue
  
Start the queue to process the next job.
JobQueue
Protected Methods
 MethodDefined By
  
jobSort():Sort
JobQueue
Events
 Event Summary Defined By
  Dispatched when the queue empties.JobQueue
Property Detail
fifoproperty
fifo:Boolean

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

The queue ordering: fifo = true -> fifo queuing; fifo = false -> filo queuing


Implementation
    public function get fifo():Boolean
    public function set fifo(value:Boolean):void
minExecutionPriorityproperty 
minExecutionPriority:int

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

The minimum execution priority. Jobs must have at least this priority to be executed


Implementation
    public function get minExecutionPriority():int
    public function set minExecutionPriority(value:int):void
pauseproperty 
pause:Boolean  [write-only]

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Pause (or start) the job queue.


Implementation
    public function set pause(value:Boolean):void
queueNameproperty 
queueName:String  [read-only]

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

The queue name.


Implementation
    public function get queueName():String
Constructor Detail
JobQueue()Constructor
public function JobQueue(queueName:String, fifo:Boolean = false, autoStart:Boolean = true, timerInterval:int = 50)

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Constructor.

Parameters
queueName:String — Optional descriptive name of the queue
 
fifo:Boolean (default = false) — Optional boolean to control fifo behavior (true for fifo, false for filo)
 
autoStart:Boolean (default = true) — Optional boolean to control job start behavior - set to true to have JobQueue automatically start the next job in the queue. Using autoStart == true is generally not a good idea for asynchronous jobs.
 
timerInterval:int (default = 50) — Time in msec before the next job is begun (after completion of a previous job).
Method Detail
getJob()method
public function getJob(jobKey:Object):Object

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Get the job associated with the specified job key.

Parameters

jobKey:Object

Returns
Object — The job associated with the specified job key.
getJobKey()method 
public function getJobKey():Object

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Return the key of the next job to be executed.

Returns
Object — The key of the next job to be executed.
hasJobs()method 
public function hasJobs():Boolean

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Whether the queue has pending jobs.

Returns
Boolean — True if the queue has pending jobs.
jobSort()method 
protected function jobSort():Sort

Returns
Sort
killAllJobs()method 
public function killAllJobs():void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Kills all pending jobs.

pushJob()method 
public function pushJob(jobKey:Object, job:Object, callBack:Function, jobPriority:int = 0):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Push a job onto the queue.

Parameters

jobKey:Object — A unique key for the job.
 
job:Object — An object that generally contains the parameters of the job
 
callBack:Function — A function that is called to "execute" the job. It takes the form: callback(jobKey:Object, job:Object):void
 
jobPriority:int (default = 0) — The priority of the job. The fifo property dictates the order of execution for all jobs with the same priority. Jobs with a higher priority get executed before jobs with a lower priority. If a job is pushed onto the queue with a key that matches an existing job in the queue, then the new job takes it's place, and the old job is discarded.

removeJob()method 
public function removeJob(jobKey:Object):Boolean

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Remove a job from the queue.

Parameters

jobKey:Object — The key for the job.

Returns
Boolean — True if the job was found and removed
startJobTimer()method 
public function startJobTimer():void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Start the queue to process the next job.

Event Detail
queueIsEmpty Event
Event Object Type: com.adobe.portfolio.events.JobQueueEvent
JobQueueEvent.type property = com.adobe.portfolio.events.JobQueueEvent

Dispatched when the queue empties.