Packagecom.adobe.portfolio.utils
Classpublic class JobUtil
InheritanceJobUtil Inheritance flash.events.EventDispatcher

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

The JobUtil class implements a job queue that runs jobs sequentially. JobUtil implements a FILO (first-in, last out) queue that is particularly useful for deferred computation of list display elements. It can also be used for deferred tasks that need to be done serially. A FILO model allows clients to continually push the highest priority jobs. The idea is that the most recent events a have the higest priority. A job already on the queue that is "re-pushed" will will be promoted to the top of the queue. Imagine a large list of visual elements, which may take substantial computation to display (at least initially). The list can use JobUtil to queue the work to compute the visual representation. Meanwhile, the user may start scrolling to arbitrary sections of the list. By repushing the elements in the current view, the elements get re-prioritized to compute before other non-visible items. This process may repeat, as the user scrolls to various random views of the list. Because of this model, it's ideal to push the visual elements in reverse order if the initial view is of the first part of the list. Another strategy is to simply repush any elements that are currently visible. Using JobUtil allows the client control over the priority of the deferred work to be done and prevents the UI from "locking up" by using timers. In many respects it's equivalent to spawning a separate thread in multi-threaded environments, but without the syncronization headaches.



Public Properties
 PropertyDefined By
  jobDescription : String
[read-only]
JobUtil
  pause : Boolean
[write-only]
JobUtil
Public Methods
 MethodDefined By
  
JobUtil(jobDescription:String, fifo:Boolean = false, autoStart:Boolean = true, timerInterval:int = 50)
JobUtil
  
getJob(jobKey:Object):Object
JobUtil
  
getJobKey():Object
JobUtil
  
hasJobs():Boolean
JobUtil
  
JobUtil
  
pushJob(jobKey:Object, job:Object, callBack:Function):void
JobUtil
  
removeJob(jobKey:Object):Boolean
JobUtil
  
JobUtil
Property Detail
jobDescriptionproperty
jobDescription:String  [read-only]


Implementation
    public function get jobDescription():String
pauseproperty 
pause:Boolean  [write-only]


Implementation
    public function set pause(value:Boolean):void
Constructor Detail
JobUtil()Constructor
public function JobUtil(jobDescription:String, fifo:Boolean = false, autoStart:Boolean = true, timerInterval:int = 50)



Parameters
jobDescription:String
 
fifo:Boolean (default = false)
 
autoStart:Boolean (default = true)
 
timerInterval:int (default = 50)
Method Detail
getJob()method
public function getJob(jobKey:Object):Object

Parameters

jobKey:Object

Returns
Object
getJobKey()method 
public function getJobKey():Object

Returns
Object
hasJobs()method 
public function hasJobs():Boolean

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

pushJob()method 
public function pushJob(jobKey:Object, job:Object, callBack:Function):void

Parameters

jobKey:Object
 
job:Object
 
callBack:Function

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

Parameters

jobKey:Object

Returns
Boolean
startJobTimer()method 
public function startJobTimer():void