| Package | feathers.data | 
| Class | public class ListCollection | 
| Inheritance | ListCollection  EventDispatcher  Object | 
| Implements | IListCollection | 
| Product Version : | Feathers 1.0.0 | 
| Property | Defined By | ||
|---|---|---|---|
| data : Object 
		 The data source for this collection. | ListCollection | ||
| dataDescriptor : IListCollectionDataDescriptor 
		 Describes the underlying data source by translating APIs. | ListCollection | ||
| filterFunction : Function 
		 A function to determine if each item in the collection should be
		 included or excluded from visibility through APIs like
		 length and getItemAt(). | ListCollection | ||
| length : int [read-only] 
		 The number of items in the collection. | ListCollection | ||
| sortCompareFunction : Function 
		 A function to compare each item in the collection to determine the
		 order when sorted. | ListCollection | ||
| Method | Defined By | ||
|---|---|---|---|
| ListCollection(data:Object = null) 
		 Constructor
		  | ListCollection | ||
| addAll(collection:IListCollection):void 
		 Adds all items from another collection. | ListCollection | ||
| addAllAt(collection:IListCollection, index:int):void 
		 Adds all items from another collection, placing the items at a
		 specific index in this collection. | ListCollection | ||
|  | addEventListener(type:String, listener:Function):void  Registers an event listener at a certain object. | EventDispatcher | |
| addItem(item:Object):void 
		 Adds an item to the end of the collection. | ListCollection | ||
| addItemAt(item:Object, index:int):void 
		 Adds an item to the collection, at the specified index. | ListCollection | ||
| contains(item:Object):Boolean 
		 Determines if the specified item is in the collection. | ListCollection | ||
|  | dispatchEvent(event:Event):void  Dispatches an event to all objects that have registered listeners for its type. | EventDispatcher | |
|  | dispatchEventWith(type:String, bubbles:Boolean = false, data:Object = null):void  Dispatches an event with the given parameters to all objects that have registered 
     listeners for the given type. | EventDispatcher | |
| dispose(disposeItem:Function):void 
		 Calls a function for each item in the collection that may be used
		 to dispose any properties on the item. | ListCollection | ||
| getItemAt(index:int):Object 
		 Returns the item at the specified index in the collection. | ListCollection | ||
| getItemIndex(item:Object):int 
		 Determines which index the item appears at within the collection. | ListCollection | ||
|  | hasEventListener(type:String, listener:Function = null):Boolean  If called with one argument, figures out if there are any listeners registered for
     the given event type. | EventDispatcher | |
| pop():Object 
		 Removes the item from the end of the collection and returns it. | ListCollection | ||
| push(item:Object):void 
		 A convenient alias for addItem(). | ListCollection | ||
| refresh():void 
		 Refreshes the collection using the filterFunction
		 or sortCompareFunction without passing in a new values
		 for these properties. | ListCollection | ||
| removeAll():void 
		 Removes all items from the collection. | ListCollection | ||
|  | removeEventListener(type:String, listener:Function):void  Removes an event listener from the object. | EventDispatcher | |
|  | removeEventListeners(type:String = null):void  Removes all event listeners with a certain type, or all of them if type is null. | EventDispatcher | |
| removeItem(item:Object):void 
		 Removes a specific item from the collection. | ListCollection | ||
| removeItemAt(index:int):Object 
		 Removes the item at the specified index from the collection and
		 returns it. | ListCollection | ||
| reset(collection:IListCollection):void 
		 Replaces the collection's data with data from another collection. | ListCollection | ||
| setItemAt(item:Object, index:int):void 
		 Replaces the item at the specified index with a new item. | ListCollection | ||
| shift():Object 
		 Removes the first item in the collection and returns it. | ListCollection | ||
| unshift(item:Object):void 
		 Adds an item to the beginning of the collection. | ListCollection | ||
| updateAll():void 
		 Call updateAll() to manually inform any component
		 rendering the IListCollection that the properties of all,
		 or many, of the collection's items have changed, and that any
		 rendered views should be updated. | ListCollection | ||
| updateItemAt(index:int):void 
		 Call updateItemAt() to manually inform any component
		 rendering the IListCollection that the properties of a
		 single item in the collection have changed, and that any views
		 associated with the item should be updated. | ListCollection | ||
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when an item is added to the collection. | ListCollection | |||
| Dispatched when the underlying data source changes and components will need to redraw the data. | ListCollection | |||
| Dispatched when the filterFunction property changes or the refresh() function is called on the IListCollection. | ListCollection | |||
| Dispatched when an item is removed from the collection. | ListCollection | |||
| Dispatched when an item is replaced in the collection. | ListCollection | |||
| Dispatched when the collection has changed drastically, such as when the underlying data source is replaced completely. | ListCollection | |||
| Dispatched when the sortCompareFunction property changes or the refresh() function is called on the IListCollection. | ListCollection | |||
| Dispatched when the updateAll() function is called on the ListCollection. | ListCollection | |||
| Dispatched when the updateItemAt() function is called on the ListCollection. | ListCollection | |||
| data | property | 
data:Object
		 The data source for this collection. May be any type of data, but a
		 dataDescriptor needs to be provided to translate from
		 the data source's APIs to something that can be understood by
		 ListCollection.
		 
		 
Data sources of type Array, Vector, and XMLList are automatically
		 detected, and no dataDescriptor needs to be set if the
		 ListCollection uses one of these types.
    public function get data():Object    public function set data(value:Object):void| dataDescriptor | property | 
dataDescriptor:IListCollectionDataDescriptorDescribes the underlying data source by translating APIs.
    public function get dataDescriptor():IListCollectionDataDescriptor    public function set dataDescriptor(value:IListCollectionDataDescriptor):voidSee also
| filterFunction | property | 
filterFunction:Function
		 A function to determine if each item in the collection should be
		 included or excluded from visibility through APIs like
		 length and getItemAt().
		 
		 
The function is expected to have the following signature:
function( item:Object ):Boolean
In the following example, the filter function is based on the
		 text of a TextInput component:
    var collection:IListCollection; //this would be created from a concrete implementation
    
    var list:List = new List();
    list.dataProvider = collection;
    this.addChild( list );
    
    var input:TextInput = new TextInput();
    input.addEventListener( Event.CHANGE, function():void
    {
       if( input.text.length == 0 )
       {
           collection.filterFunction = null;
           return;
       }
       collection.filterFunction = function( item:Object ):Boolean
       {
           var itemText:String = item.label.toLowerCase();
           var filterText:String = input.text.toLowerCase();
           return itemText.indexOf( filterText ) >= 0;
       };
    } );
    this.addChild( input );    public function get filterFunction():Function    public function set filterFunction(value:Function):void| length | property | 
length:int  [read-only] The number of items in the collection.
    public function get length():int| sortCompareFunction | property | 
sortCompareFunction:FunctionA function to compare each item in the collection to determine the order when sorted.
The function is expected to have the following signature:
function( a:Object, b:Object ):int
The return value should be -1 if the first item
		 should appear before the second item when the collection is sorted.
		 The return value should be 1 if the first item should
		 appear after the second item when the collection in sorted. Finally,
		 the return value should be 0 if both items have the
		 same sort order.
    public function get sortCompareFunction():Function    public function set sortCompareFunction(value:Function):void| ListCollection | () | Constructor | 
public function ListCollection(data:Object = null)Constructor
Parameters| data:Object(default =null) | 
| addAll | () | method | 
 public function addAll(collection:IListCollection):voidAdds all items from another collection.
Parameters
| collection:IListCollection | 
| addAllAt | () | method | 
 public function addAllAt(collection:IListCollection, index:int):voidAdds all items from another collection, placing the items at a specific index in this collection.
Parameters
| collection:IListCollection | |
| index:int | 
| addItem | () | method | 
 public function addItem(item:Object):voidAdds an item to the end of the collection.
If the collection is filtered, addItem() may add
		 the item to the unfiltered data, but omit it from the filtered data.
		 If the item is omitted from the filtered data,
		 CollectionEventType.ADD_ITEM will not be dispatched.
Parameters
| item:Object | 
| addItemAt | () | method | 
 public function addItemAt(item:Object, index:int):voidAdds an item to the collection, at the specified index.
If the collection is filtered, the index is the position in the filtered data, rather than position in the unfiltered data.
Parameters
| item:Object | |
| index:int | 
| contains | () | method | 
 public function contains(item:Object):BooleanDetermines if the specified item is in the collection.
If the collection is filtered, contains() will return
		 false for items that are excluded by the filter.
Parameters
| item:Object | 
| Boolean | 
| dispose | () | method | 
 public function dispose(disposeItem:Function):voidCalls a function for each item in the collection that may be used to dispose any properties on the item. For example, display objects or textures may need to be disposed.
The function is expected to have the following signature:
function( item:Object ):void
In the following example, the items in the collection are disposed:
    collection.dispose( function( item:Object ):void
    {
        var accessory:DisplayObject = DisplayObject(item.accessory);
        accessory.dispose();
    }If the collection has a filterFunction, it will be
		 removed, and it will not be restored.
Parameters
| disposeItem:Function | 
See also
| getItemAt | () | method | 
 public function getItemAt(index:int):ObjectReturns the item at the specified index in the collection.
Parameters
| index:int | 
| Object | 
| getItemIndex | () | method | 
 public function getItemIndex(item:Object):int
		 Determines which index the item appears at within the collection. If
		 the item isn't in the collection, returns -1.
		 
		 
If the collection is filtered, getItemIndex() will
		 return -1 for items that are excluded by the filter.
Parameters
| item:Object | 
| int | 
| pop | () | method | 
 public function pop():ObjectRemoves the item from the end of the collection and returns it.
Returns| Object | 
| push | () | method | 
 public function push(item:Object):void
		 A convenient alias for addItem().
		 
		 
Parameters
| item:Object | 
See also
| refresh | () | method | 
 public function refresh():void
		 Refreshes the collection using the filterFunction
		 or sortCompareFunction without passing in a new values
		 for these properties. Useful when either of these functions relies
		 on external variables that have changed.
		 
| removeAll | () | method | 
 public function removeAll():voidRemoves all items from the collection.
| removeItem | () | method | 
 public function removeItem(item:Object):voidRemoves a specific item from the collection.
If the collection is filtered, removeItem() will not
		 remove the item from the unfiltered data if it is not included in the
		 filtered data. If the item is not removed,
		 CollectionEventType.REMOVE_ITEM will not be dispatched.
Parameters
| item:Object | 
| removeItemAt | () | method | 
 public function removeItemAt(index:int):ObjectRemoves the item at the specified index from the collection and returns it.
If the collection is filtered, the index is the position in the filtered data, rather than position in the unfiltered data.
Parameters
| index:int | 
| Object | 
| reset | () | method | 
 public function reset(collection:IListCollection):voidReplaces the collection's data with data from another collection.
Parameters
| collection:IListCollection | 
| setItemAt | () | method | 
 public function setItemAt(item:Object, index:int):voidReplaces the item at the specified index with a new item.
Parameters
| item:Object | |
| index:int | 
| shift | () | method | 
 public function shift():ObjectRemoves the first item in the collection and returns it.
Returns| Object | 
| unshift | () | method | 
 public function unshift(item:Object):voidAdds an item to the beginning of the collection.
Parameters
| item:Object | 
| updateAll | () | method | 
 public function updateAll():void
		 Call updateAll() to manually inform any component
		 rendering the IListCollection that the properties of all,
		 or many, of the collection's items have changed, and that any
		 rendered views should be updated. The collection will dispatch the
		 CollectionEventType.UPDATE_ALL event.
		 
		 
Alternatively, the item can dispatch an event when one of its properties has changed, and a custom item renderer can listen for that event and update itself automatically.
See also
| updateItemAt | () | method | 
 public function updateItemAt(index:int):void
		 Call updateItemAt() to manually inform any component
		 rendering the IListCollection that the properties of a
		 single item in the collection have changed, and that any views
		 associated with the item should be updated. The collection will
		 dispatch the CollectionEventType.UPDATE_ITEM event.
		 
		 
Alternatively, the item can dispatch an event when one of its properties has changed, and a custom item renderer can listen for that event and update itself automatically.
Parameters
| index:int | 
See also
| addItem | Event | 
starling.events.Eventfeathers.events.CollectionEventType.ADD_ITEMDispatched when an item is added to the collection.
The properties of the event object have the following values:
| Property | Value | 
|---|---|
| bubbles | false | 
| currentTarget | The Object that defines the
	   event listener that handles the event. For example, if you use myButton.addEventListener()to register an event listener,
	   myButton is the value of thecurrentTarget. | 
| data | The index of the item that has been
	 added. It is of type int. | 
| target | The Object that dispatched the event;
	   it is not always the Object listening for the event. Use the currentTargetproperty to always access the Object
	   listening for the event. | 
| change | Event | 
starling.events.Eventstarling.events.Event.CHANGEDispatched when the underlying data source changes and components will need to redraw the data.
The properties of the event object have the following values:
| Property | Value | 
|---|---|
| bubbles | false | 
| currentTarget | The Object that defines the
	   event listener that handles the event. For example, if you use myButton.addEventListener()to register an event listener,
	   myButton is the value of thecurrentTarget. | 
| data | null | 
| target | The Object that dispatched the event;
	   it is not always the Object listening for the event. Use the currentTargetproperty to always access the Object
	   listening for the event. | 
| filterChange | Event | 
starling.events.Eventfeathers.events.CollectionEventType.FILTER_CHANGE
	 Dispatched when the filterFunction property changes or the
	 refresh() function is called on the IListCollection.
	 
	 
The properties of the event object have the following values:
| Property | Value | 
|---|---|
| bubbles | false | 
| currentTarget | The Object that defines the
	   event listener that handles the event. For example, if you use myButton.addEventListener()to register an event listener,
	   myButton is the value of thecurrentTarget. | 
| data | null | 
| target | The Object that dispatched the event;
	   it is not always the Object listening for the event. Use the currentTargetproperty to always access the Object
	   listening for the event. | 
See also
| removeItem | Event | 
starling.events.Eventfeathers.events.CollectionEventType.REMOVE_ITEMDispatched when an item is removed from the collection.
The properties of the event object have the following values:
| Property | Value | 
|---|---|
| bubbles | false | 
| currentTarget | The Object that defines the
	   event listener that handles the event. For example, if you use myButton.addEventListener()to register an event listener,
	   myButton is the value of thecurrentTarget. | 
| data | The index of the item that has been
	 removed. It is of type int. | 
| target | The Object that dispatched the event;
	   it is not always the Object listening for the event. Use the currentTargetproperty to always access the Object
	   listening for the event. | 
| replaceItem | Event | 
starling.events.Eventfeathers.events.CollectionEventType.REPLACE_ITEMDispatched when an item is replaced in the collection.
The properties of the event object have the following values:
| Property | Value | 
|---|---|
| bubbles | false | 
| currentTarget | The Object that defines the
	   event listener that handles the event. For example, if you use myButton.addEventListener()to register an event listener,
	   myButton is the value of thecurrentTarget. | 
| data | The index of the item that has been
	 replaced. It is of type int. | 
| target | The Object that dispatched the event;
	   it is not always the Object listening for the event. Use the currentTargetproperty to always access the Object
	   listening for the event. | 
| reset | Event | 
starling.events.Eventfeathers.events.CollectionEventType.RESETDispatched when the collection has changed drastically, such as when the underlying data source is replaced completely.
The properties of the event object have the following values:
| Property | Value | 
|---|---|
| bubbles | false | 
| currentTarget | The Object that defines the
	   event listener that handles the event. For example, if you use myButton.addEventListener()to register an event listener,
	   myButton is the value of thecurrentTarget. | 
| data | null | 
| target | The Object that dispatched the event;
	   it is not always the Object listening for the event. Use the currentTargetproperty to always access the Object
	   listening for the event. | 
| sortChange | Event | 
starling.events.Eventfeathers.events.CollectionEventType.SORT_CHANGE
	 Dispatched when the sortCompareFunction property changes or
	 the refresh() function is called on the IListCollection.
	 
	 
The properties of the event object have the following values:
| Property | Value | 
|---|---|
| bubbles | false | 
| currentTarget | The Object that defines the
	   event listener that handles the event. For example, if you use myButton.addEventListener()to register an event listener,
	   myButton is the value of thecurrentTarget. | 
| data | null | 
| target | The Object that dispatched the event;
	   it is not always the Object listening for the event. Use the currentTargetproperty to always access the Object
	   listening for the event. | 
See also
| updateAll | Event | 
starling.events.Eventfeathers.events.CollectionEventType.UPDATE_ALL
	 Dispatched when the updateAll() function is called on the
	 ListCollection.
	 
	 
The properties of the event object have the following values:
| Property | Value | 
|---|---|
| bubbles | false | 
| currentTarget | The Object that defines the
	   event listener that handles the event. For example, if you use myButton.addEventListener()to register an event listener,
	   myButton is the value of thecurrentTarget. | 
| data | null | 
| target | The Object that dispatched the event;
	   it is not always the Object listening for the event. Use the currentTargetproperty to always access the Object
	   listening for the event. | 
See also
| updateItem | Event | 
starling.events.Eventfeathers.events.CollectionEventType.UPDATE_ITEM
	 Dispatched when the updateItemAt() function is called on the
	 ListCollection.
	 
	 
The properties of the event object have the following values:
| Property | Value | 
|---|---|
| bubbles | false | 
| currentTarget | The Object that defines the
	   event listener that handles the event. For example, if you use myButton.addEventListener()to register an event listener,
	   myButton is the value of thecurrentTarget. | 
| data | The index of the item that has been
	 updated. It is of type int. | 
| target | The Object that dispatched the event;
	   it is not always the Object listening for the event. Use the currentTargetproperty to always access the Object
	   listening for the event. | 
See also