Package | feathers.data |
Class | public class HierarchicalCollection |
Inheritance | HierarchicalCollection ![]() |
Property | Defined By | ||
---|---|---|---|
data : Object
The data source for this collection. | HierarchicalCollection | ||
dataDescriptor : IHierarchicalCollectionDataDescriptor
Describes the underlying data source by translating APIs. | HierarchicalCollection |
Method | Defined By | ||
---|---|---|---|
HierarchicalCollection(data:Object = null) | HierarchicalCollection | ||
addItemAt(item:Object, index:int, ... rest):void
Adds an item to the collection, at the specified location. | HierarchicalCollection | ||
dispose(disposeGroup:Function, disposeItem:Function):void
Calls a function for each group in the collection and another
function for each item in a group, where each function handles any
properties that require disposal on these objects. | HierarchicalCollection | ||
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 | ||
isBranch(node:Object):Boolean
Determines if a node from the data source is a branch. | HierarchicalCollection | ||
removeAll():void
Removes all items from the collection. | HierarchicalCollection | ||
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 |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when an item is added to the collection. | HierarchicalCollection | |||
Dispatched when the underlying data source changes and the ui will need to redraw the data. | HierarchicalCollection | |||
Dispatched when an item is removed from the collection. | HierarchicalCollection | |||
Dispatched when an item is replaced in the collection. | HierarchicalCollection | |||
Dispatched when the collection has changed drastically, such as when the underlying data source is replaced completely. | HierarchicalCollection | |||
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 |
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
.
public function get data():Object
public function set data(value:Object):void
dataDescriptor | property |
dataDescriptor:IHierarchicalCollectionDataDescriptor
Describes the underlying data source by translating APIs.
public function get dataDescriptor():IHierarchicalCollectionDataDescriptor
public function set dataDescriptor(value:IHierarchicalCollectionDataDescriptor):void
HierarchicalCollection | () | Constructor |
public function HierarchicalCollection(data:Object = null)
data:Object (default = null )
|
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 |
dispose | () | method |
public function dispose(disposeGroup:Function, disposeItem:Function):void
Calls a function for each group in the collection and another
function for each item in a group, where each function handles any
properties that require disposal on these objects. For example,
display objects or textures may need to be disposed. You may pass in
a value of null
for either function if you don't have
anything to dispose in one or the other.
The function to dispose a group is expected to have the following signature:
function( group:Object ):void
The function to dispose an item 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( group:Object ):void { var content:DisplayObject = DisplayObject(group.content); content.dispose(); }, function( item:Object ):void { var accessory:DisplayObject = DisplayObject(item.accessory); accessory.dispose(); },)
Parameters
disposeGroup:Function | |
disposeItem:Function |
See also
getItemAt | () | method |
public function getItemAt(index:int, ... rest):Object
Returns the item at the specified location in the collection.
Parameters
index:int | |
... rest |
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 )
|
Vector.<int> |
getLength | () | method |
public function getLength(... rest):int
The number of items at the specified location in the collection.
Parameters
... rest |
int |
isBranch | () | method |
public function isBranch(node:Object):Boolean
Determines if a node from the data source is a branch.
Parameters
node:Object |
Boolean |
removeAll | () | method |
public function removeAll():void
Removes all items from the collection.
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 |
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 |
addItem | Event |
starling.events.Event
feathers.events.CollectionEventType.ADD_ITEM
Dispatched 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 the currentTarget . |
data | The index path of the item that has
been added. It is of type Array and contains objects of
type int . |
target | The Object that dispatched the event;
it is not always the Object listening for the event. Use the
currentTarget property to always access the Object
listening for the event. |
change | Event |
starling.events.Event
starling.events.Event.CHANGE
Dispatched when the underlying data source changes and the ui 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 the currentTarget . |
data | null |
target | The Object that dispatched the event;
it is not always the Object listening for the event. Use the
currentTarget property to always access the Object
listening for the event. |
removeItem | Event |
starling.events.Event
feathers.events.CollectionEventType.REMOVE_ITEM
Dispatched 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 the currentTarget . |
data | The index path of the item that has
been removed. It is of type Array and contains objects of
type int . |
target | The Object that dispatched the event;
it is not always the Object listening for the event. Use the
currentTarget property to always access the Object
listening for the event. |
replaceItem | Event |
starling.events.Event
feathers.events.CollectionEventType.REPLACE_ITEM
Dispatched 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 the currentTarget . |
data | The index path of the item that has
been re[;aced. It is of type Array and contains objects of
type int . |
target | The Object that dispatched the event;
it is not always the Object listening for the event. Use the
currentTarget property to always access the Object
listening for the event. |
reset | Event |
starling.events.Event
feathers.events.CollectionEventType.RESET
Dispatched 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 the currentTarget . |
data | null |
target | The Object that dispatched the event;
it is not always the Object listening for the event. Use the
currentTarget property to always access the Object
listening for the event. |
updateItem | Event |
starling.events.Event
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 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 the currentTarget . |
data | The index path of the item that has
been updated. It is of type Array and contains objects of
type int . |
target | The Object that dispatched the event;
it is not always the Object listening for the event. Use the
currentTarget property to always access the Object
listening for the event. |