ListCollection

public class
feathers.data.ListCollection

Description

Wraps a data source with a common API for use with UI controls, like lists, that support one dimensional collections of data. Supports custom "data descriptors" so that unexpected data sources may be used. Supports Arrays, Vectors, and XMLLists automatically.

See also:
ArrayListCollectionDataDescriptor
feathers.data.VectorListCollectionDataDescriptor
XMLListListCollectionDataDescriptor

API overview

Constructor

ListCollection ( data: Object = null )
Constructor.

Attributes

Public attributes

data: Object

The data source for this collection

dataDescriptor: IListCollectionDataDescriptor

Describes the underlying data source by translating APIs

length: Number read-only

The number of items in the collection

Functions

Public functions

addAll ( collection: ListCollection ): Void

Adds all items from another collection

addAllAt ( collection: ListCollection , index: Number ): Void

Adds all items from another collection, placing the items at a specific index in this collection

addItem ( item: Object ): Void

Adds an item to the end of the collection

addItemAt ( item: Object , index: Number ): Void

Adds an item to the collection, at the specified index

contains ( item: Object ): Boolean

Determines if the specified item is in the collection

getItemAt ( index: Number ): Object

Returns the item at the specified index in the collection

getItemIndex ( item: Object ): Number

Determines which index the item appears at within the collection

pop (): Object

Removes the item from the end of the collection and returns it

push ( item: Object ): Void

Adds an item to the end of the collection

removeAll (): Void

Removes all items from the collection

removeItem ( item: Object ): Void

Removes a specific item from the collection

removeItemAt ( index: Number ): Object

Removes the item at the specified index from the collection and returns it

setItemAt ( item: Object , index: Number ): Void

Replaces the item at the specified index with a new item

shift (): Object

Removed the item from the beginning of the collection and returns it

unshift ( item: Object ): Void

Adds an item to the beginning of the collection

updateItemAt ( index: Number ): Void

If an item doesn't dispatch an event or signal to indicate that it has changed, you can manually tell the collection about the change, and the collection will dispatch the CollectionEventType.UPDATE_ITEM event to manually notify the component that renders the data

Constructor

ListCollection ( data: Object = null )

Constructor.

Attributes

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.

dataDescriptor: IListCollectionDataDescriptor

Describes the underlying data source by translating APIs.

See also:
feathers.data.IListCollectionDataDescriptor

length: Number

read-only

The number of items in the collection.

Functions

addAll ( collection: ListCollection ): Void

Adds all items from another collection.

Parameters

collection: ListCollection


addAllAt ( collection: ListCollection , index: Number ): Void

Adds all items from another collection, placing the items at a specific index in this collection.

Parameters

collection: ListCollection
index: Number


addEventListener ( type: String , listener: Function ): Void
Inherited from EventDispatcher

Registers an event listener at a certain object.

Parameters

type: String
listener: Function


addItem ( item: Object ): Void

Adds an item to the end of the collection.

Parameters

item: Object


addItemAt ( item: Object , index: Number ): Void

Adds an item to the collection, at the specified index.

Parameters

item: Object
index: Number


contains ( item: Object ): Boolean

Determines if the specified item is in the collection.

Parameters

item: Object


dispatchEvent ( event: Event ): Void
Inherited from EventDispatcher

Dispatches an event to all objects that have registered listeners for its type. If an event with enabled 'bubble' property is dispatched to a display object, it will travel up along the line of parents, until it either hits the root object or someone stops its propagation manually.

Parameters

event: Event


dispatchEventWith ( type: String , bubbles: Boolean = false , data: Object = null ): Void
Inherited from EventDispatcher

Dispatches an event with the given parameters to all objects that have registered listeners for the given type. The method uses an internal pool of event objects to avoid allocations.

Parameters

type: String
bubbles: Boolean = false
data: Object = null


getFullTypeName (): String
Inherited from Object

native

Gets the fully qualified type name of the Object. The fully qualified type name includes the package of the type.


Returns

String fully qualified type name of the Object.

getItemAt ( index: Number ): Object

Returns the item at the specified index in the collection.

Parameters

index: Number


getItemIndex ( item: Object ): Number

Determines which index the item appears at within the collection. If the item isn't in the collection, returns -1.

Parameters

item: Object


getType (): Type
Inherited from Object

native

Gets the Type that describes the Object.


Returns

Type The Type that describes the object.

getTypeName (): String
Inherited from Object

native

Gets the type name of the Object.


Returns

String type name of the Object.

hasEventListener ( type: String ): Boolean
Inherited from EventDispatcher

Returns if there are listeners registered for a certain event type.

Parameters

type: String


pop (): Object

Removes the item from the end of the collection and returns it.



push ( item: Object ): Void

Adds an item to the end of the collection.

Parameters

item: Object


removeAll (): Void

Removes all items from the collection.



removeEventListener ( type: String , listener: Function ): Void
Inherited from EventDispatcher

Removes an event listener from the object.

Parameters

type: String
listener: Function


removeEventListeners ( type: String = null ): Void
Inherited from EventDispatcher

Removes all event listeners with a certain type, or all of them if type is null. Be careful when removing all event listeners: you never know who else was listening.

Parameters

type: String = null


removeItem ( item: Object ): Void

Removes a specific item from the collection.

Parameters

item: Object


removeItemAt ( index: Number ): Object

Removes the item at the specified index from the collection and returns it.

Parameters

index: Number


setItemAt ( item: Object , index: Number ): Void

Replaces the item at the specified index with a new item.

Parameters

item: Object
index: Number


shift (): Object

Removed the item from the beginning of the collection and returns it.



toString (): String
Inherited from Object

native

Returns a String that describes the Object. This can be overriden to provide extra details when printing objects using trace().


Returns

String String that described the Object.

unshift ( item: Object ): Void

Adds an item to the beginning of the collection.

Parameters

item: Object


updateItemAt ( index: Number ): Void

If an item doesn't dispatch an event or signal to indicate that it has changed, you can manually tell the collection about the change, and the collection will dispatch the CollectionEventType.UPDATE_ITEM event to manually notify the component that renders the data.

Parameters

index: Number


: