Packageorg.apache.flex.net.dataConverters
Classpublic class LazyCollection
InheritanceLazyCollection Inheritance EventDispatcher Inheritance flash.events.EventDispatcher
Implements IBead, ICollection

Language Version : ActionScript 3.0
Product Version : FlexJS 0.0
Runtime Versions : Flash Player 10.2, AIR 2.6

The LazyCollection class implements a collection whose items require conversion from a source data format to some other data type. For example, converting SOAP or JSON to ActionScript data classes. The Flex SDK used to convert all of the data items when the source data arrived, which, for very large data sets or complex data classes, could lock up the user interface. The lazy collection converts items as they are fetched from the collection, resulting in significant performance savings in many cases. Note that, if you need to compute a summary of data in the collection when the source data arrives, the computation can still lock up the user interface as you will have to visit and convert every data item. Of course, it is possible to compute that summary in a worker or pseudo-thread. The LazyCollection class is designed to be a bead that attaches to a data retrieval strand that dispatches an Event.COMPLETE and has a "data" property that gets passed to the input parser. This LazyCollection does not support adding/removing items from the collection or sending data back to the source. Subclasses have that additional functionality.



Public Properties
 PropertyDefined By
  id : String
An id property for MXML documents.
LazyCollection
  inputParser : IInputParser
A lazy collection uses an IInputParser to convert the source data items into an array of data items.
LazyCollection
  itemConverter : IItemConverter
A lazy collection uses an IItemConverter to convert the source data items into the desired data type.
LazyCollection
  strand : IStrand
[write-only]
LazyCollection
Protected Properties
 PropertyDefined By
  data : Array
The array of desired data types.
LazyCollection
  rawData : Array
The array of raw data needing conversion.
LazyCollection
Public Methods
 MethodDefined By
  
Constructor.
LazyCollection
  
getItemAt(index:int):Object
Fetches an item from the collection, converting it first if necessary.
LazyCollection
Property Detail
dataproperty
protected var data:Array

Language Version : ActionScript 3.0
Product Version : FlexJS 0.0
Runtime Versions : Flash Player 10.2, AIR 2.6

The array of desired data types. This array is sparse and unconverted items are therefore undefined in the array.

idproperty 
id:String

Language Version : ActionScript 3.0
Product Version : FlexJS 0.0
Runtime Versions : Flash Player 10.2, AIR 2.6

An id property for MXML documents.


Implementation
    public function get id():String
    public function set id(value:String):void
inputParserproperty 
inputParser:IInputParser

Language Version : ActionScript 3.0
Product Version : FlexJS 0.0
Runtime Versions : Flash Player 10.2, AIR 2.6

A lazy collection uses an IInputParser to convert the source data items into an array of data items. This is required in order to determine the length of the collection. This conversion happens as the source data arrives so it needs to be fast to avoid locking up the UI.


Implementation
    public function get inputParser():IInputParser
    public function set inputParser(value:IInputParser):void
itemConverterproperty 
itemConverter:IItemConverter

Language Version : ActionScript 3.0
Product Version : FlexJS 0.0
Runtime Versions : Flash Player 10.2, AIR 2.6

A lazy collection uses an IItemConverter to convert the source data items into the desired data type. The converter is only called as items are fetched from the collection.


Implementation
    public function get itemConverter():IItemConverter
    public function set itemConverter(value:IItemConverter):void
rawDataproperty 
protected var rawData:Array

Language Version : ActionScript 3.0
Product Version : FlexJS 0.0
Runtime Versions : Flash Player 10.2, AIR 2.6

The array of raw data needing conversion.

strandproperty 
strand:IStrand  [write-only]

Language Version : ActionScript 3.0
Product Version : FlexJS 0.0
Runtime Versions : Flash Player 10.2, AIR 2.6


Implementation
    public function set strand(value:IStrand):void
Constructor Detail
LazyCollection()Constructor
public function LazyCollection()

Language Version : ActionScript 3.0
Product Version : FlexJS 0.0
Runtime Versions : Flash Player 10.2, AIR 2.6

Constructor.

Method Detail
getItemAt()method
public function getItemAt(index:int):Object

Language Version : ActionScript 3.0
Product Version : FlexJS 0.0
Runtime Versions : Flash Player 10.2, AIR 2.6

Fetches an item from the collection, converting it first if necessary.

Parameters

index:int

Returns
Object