GODPAPER | All Packages | All Classes | Index | Frames No Frames |
HierarchicalCollection

Package | feathers.data
Class | public class HierarchicalCollection
Inheritance | HierarchicalCollection EventDispatcher Object

Wraps a two-dimensional data source with a common API for use with UI controls that support this type of data.

Default MXML Property `data`

Public Properties

| Property | Defined By
--- | --- | ---
|  | data : Object The data source for this collection. | HierarchicalCollection
|  | dataDescriptor : IHierarchicalCollectionDataDescriptor Describes the underlying data source by translating APIs. | HierarchicalCollection

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | HierarchicalCollection(data:Object = null) | HierarchicalCollection
|  | addEventListener(type:String, listener:Function):void Registers an event listener at a certain object. | EventDispatcher
|  | addItemAt(item:Object, index:int, ... rest):void Adds an item to the collection, at the specified location. | HierarchicalCollection
|  | 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
|  | getItemAt(index:int, ... rest):Object Returns the item at the specified location in the collection. | HierarchicalCollection
|  | getItemLocation(item:Object, result:Vector.<int> = null):Vector.<int> Determines which location the item appears at within the collection. | HierarchicalCollection
|  | getLength(... rest):int The number of items at the specified location in the collection. | HierarchicalCollection
|  | hasEventListener(type:String):Boolean Returns if there are listeners registered for a certain event type. | EventDispatcher
|  | isBranch(node:Object):Boolean Determines if a node from the data source is a branch. | HierarchicalCollection
|  | 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. | HierarchicalCollection
|  | removeItemAt(index:int, ... rest):Object Removes the item at the specified location from the collection and returns it. | HierarchicalCollection
|  | setItemAt(item:Object, index:int, ... rest):void Replaces the item at the specified location with a new item. | HierarchicalCollection
|  | updateItemAt(index:int, ... rest):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. | HierarchicalCollection

Events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | addItem | Dispatched when an item is added to the collection. | HierarchicalCollection
|  | change | Dispatched when the underlying data source changes and the ui will need to redraw the data. | HierarchicalCollection
|  | removeItem | Dispatched when an item is removed from the collection. | HierarchicalCollection
|  | replaceItem | Dispatched when an item is replaced in the collection. | HierarchicalCollection
|  | reset | Dispatched when the collection has changed drastically, such as when the underlying data source is replaced completely. | HierarchicalCollection
|  | updateItem | Dispatched when a property of an item in the collection has changed and the item doesn't have its own change event or signal. | HierarchicalCollection

Property Detail

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 `HierarchicalCollection`.

Implementation
`public function get data():Object`
`public function set data(value:Object):void`

dataDescriptor | property |

`dataDescriptor:IHierarchicalCollectionDataDescriptor`

Describes the underlying data source by translating APIs.

Implementation
`public function get dataDescriptor():IHierarchicalCollectionDataDescriptor`
`public function set dataDescriptor(value:IHierarchicalCollectionDataDescriptor):void`
Constructor Detail

HierarchicalCollection | () | Constructor

`public function HierarchicalCollection(data:Object = null)`

Parameters

| `data:Object` (default = `null`)``

Method Detail

addItemAt | () | method

`public function addItemAt(item:Object, index:int, ... rest):void`

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

Parameters

| `item:Object`
| `index:int`
| `... rest`

getItemAt | () | method |

`public function getItemAt(index:int, ... rest):Object`

Returns the item at the specified location in the collection.

Parameters

| `index:int`
| `... rest`

Returns

| `Object`

getItemLocation | () | method |

`public function getItemLocation(item:Object, result:Vector.<int> = null):Vector.<int>`

Determines which location the item appears at within the collection. If the item isn't in the collection, returns `null`.

Parameters

| `item:Object`
| `result:Vector.<int>` (default = `null`)``

Returns

| `Vector.<int>`

getLength | () | method |

`public function getLength(... rest):int`

The number of items at the specified location in the collection.

Parameters

| `... rest`

Returns

| `int`

isBranch | () | method |

`public function isBranch(node:Object):Boolean`

Determines if a node from the data source is a branch.

Parameters

| `node:Object`

Returns

| `Boolean`

removeItem | () | method |

`public function removeItem(item:Object):void`

Removes a specific item from the collection.

Parameters

| `item:Object`

removeItemAt | () | method |

`public function removeItemAt(index:int, ... rest):Object`

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

Parameters

| `index:int`
| `... rest`

Returns

| `Object`

setItemAt | () | method |

`public function setItemAt(item:Object, index:int, ... rest):void`

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

Parameters

| `item:Object`
| `index:int`
| `... rest`

updateItemAt | () | method |

`public function updateItemAt(index:int, ... rest):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:int`
| `... rest`

Event Detail

addItem | Event

Event Object Type: `starling.events.Event`
Event.type property = `feathers.events.CollectionEventType.ADD_ITEM`

Dispatched when an item is added to the collection.

The `data` property of the event is the index path of the item that has been added. It is of type `Array` and contains objects of type `int`.

Dispatched when an item is added to the collection.

change | Event |

Event Object Type: `starling.events.Event`
Event.type property = `starling.events.Event.CHANGE`

Dispatched when the underlying data source changes and the ui will need to redraw the data.

An event type to be utilized in custom events. Not used by Starling right now.

removeItem | Event |

Event Object Type: `starling.events.Event`
Event.type property = `feathers.events.CollectionEventType.REMOVE_ITEM`

Dispatched when an item is removed from the collection.

The `data` property of the event is the index path of the item that has been removed. It is of type `Array` and contains objects of type `int`.

Dispatched when an item is removed from the collection.

replaceItem | Event |

Event Object Type: `starling.events.Event`
Event.type property = `feathers.events.CollectionEventType.REPLACE_ITEM`

Dispatched when an item is replaced in the collection.

The `data` property of the event is the index path of the item that has been replaced. It is of type `Array` and contains objects of type `int`.

Dispatched when an item is replaced in the collection with a different item.

reset | Event |

Event Object Type: `starling.events.Event`
Event.type property = `feathers.events.CollectionEventType.RESET`

Dispatched when the collection has changed drastically, such as when the underlying data source is replaced completely.

Dispatched when the data provider's source is completely replaced.

updateItem | Event |

Event Object Type: `starling.events.Event`
Event.type property = `feathers.events.CollectionEventType.UPDATE_ITEM`

Dispatched when a property of an item in the collection has changed and the item doesn't have its own change event or signal. This event is only dispatched when the `updateItemAt()` function is called on the `HierarchicalCollection`.

In general, it's better for the items themselves to dispatch events or signals when their properties change.

The `data` property of the event is the index path of the item that has been updated. It is of type `Array` and contains objects of type `int`.

Dispatched when an item in the collection has changed.

Thu Jan 16 2014, 01:11 PM +08:00