Packagefeathers.data
Classpublic class VectorHierarchicalCollection
InheritanceVectorHierarchicalCollection Inheritance starling.events.EventDispatcher
Implements IHierarchicalCollection

Product Version : Feathers 3.3.0

Wraps a Vector data source with a common API for use with UI controls that support hierarchical data.



Public Properties
 PropertyDefined By
  childrenField : String
The field of a branch object used to access its children.
VectorHierarchicalCollection
  vectorData : Object
The Vector data source for this collection.
VectorHierarchicalCollection
Public Methods
 MethodDefined By
  
VectorHierarchicalCollection(vectorData:Object = null)
Constructor.
VectorHierarchicalCollection
  
addItemAt(item:Object, index:int, ... rest):void
Adds an item to the collection, at the specified location.
VectorHierarchicalCollection
  
addItemAtLocation(item:Object, location:Vector.<int>):void
Adds an item to the collection, at the specified location.
VectorHierarchicalCollection
  
dispose(disposeBranch: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.
VectorHierarchicalCollection
  
getItemAt(index:int, ... rest):Object
Returns the item at the specified location in the collection.
VectorHierarchicalCollection
  
getItemAtLocation(location:Vector.<int>):Object
Returns the item at the specified location in the collection.
VectorHierarchicalCollection
  
getItemLocation(item:Object, result:Vector.<int> = null):Vector.<int>
Determines which location the item appears at within the collection.
VectorHierarchicalCollection
  
getLength(... rest):int
The number of items at the specified location in the collection.
VectorHierarchicalCollection
  
getLengthAtLocation(location:Vector.<int> = null):int
The number of items at the specified location in the collection.
VectorHierarchicalCollection
  
isBranch(node:Object):Boolean
Determines if a node from the data source is a branch.
VectorHierarchicalCollection
  
removeAll():void
Removes all items from the collection.
VectorHierarchicalCollection
  
removeItem(item:Object):void
Removes a specific item from the collection.
VectorHierarchicalCollection
  
removeItemAt(index:int, ... rest):Object
Removes the item at the specified location from the collection and returns it.
VectorHierarchicalCollection
  
removeItemAtLocation(location:Vector.<int>):Object
Removes the item at the specified location from the collection and returns it.
VectorHierarchicalCollection
  
setItemAt(item:Object, index:int, ... rest):void
Replaces the item at the specified location with a new item.
VectorHierarchicalCollection
  
setItemAtLocation(item:Object, location:Vector.<int>):void
Replaces the item at the specified location with a new item.
VectorHierarchicalCollection
  
updateAll():void
Call updateAll() to manually inform any component rendering the hierarchical collection that the properties of all, or many, of the collection's items have changed, and that any rendered views should be updated.
VectorHierarchicalCollection
  
updateItemAt(index:int, ... rest):void
Call updateItemAt() to manually inform any component rendering the hierarchical collection that the properties of a single item in the collection have changed, and that any views associated with the item should be updated.
VectorHierarchicalCollection
Events
 Event Summary Defined By
  Dispatched when an item is added to the collection.VectorHierarchicalCollection
  Dispatched when the underlying data source changes and components will need to redraw the data.VectorHierarchicalCollection
  Dispatched when an item is removed from the collection.VectorHierarchicalCollection
  Dispatched when an item is replaced in the collection.VectorHierarchicalCollection
  Dispatched when the collection has changed drastically, such as when the underlying data source is replaced completely.VectorHierarchicalCollection
  Dispatched when the updateAll() function is called on the hierarchical collection.VectorHierarchicalCollection
  Dispatched when the updateItemAt() function is called on the hierarchical collection.VectorHierarchicalCollection
Property Detail
childrenFieldproperty
childrenField:String

The field of a branch object used to access its children. The field's type must be Vector to be treated as a branch.


Implementation
    public function get childrenField():String
    public function set childrenField(value:String):void
vectorDataproperty 
vectorData:Object

The Vector data source for this collection.

Note: Ideally, this property would be typed as something other than Object, but there is no type that will accept all Vector objects without requiring a cast first.


Implementation
    public function get vectorData():Object
    public function set vectorData(value:Object):void
Constructor Detail
VectorHierarchicalCollection()Constructor
public function VectorHierarchicalCollection(vectorData:Object = null)

Constructor.

Parameters
vectorData: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.

Calling addItemAtLocation() instead is recommended because the Vector.<int> location may be reused to avoid excessive garbage collection from temporary objects created by ...rest arguments.

Parameters

item:Object
 
index:int
 
... rest


Throws
RangeError — Branch not found at specified location

See also

addItemAtLocation()method 
public function addItemAtLocation(item:Object, location:Vector.<int>):void

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

Parameters

item:Object
 
location:Vector.<int>


Throws
RangeError — Branch not found at specified location
dispose()method 
public function dispose(disposeBranch: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

disposeBranch:Function
 
disposeItem:Function

See also

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

Returns the item at the specified location in the collection.

Calling getItemAtLocation() instead is recommended because the Vector.<int> location may be reused to avoid excessive garbage collection from temporary objects created by ...rest arguments.

Parameters

index:int
 
... rest

Returns
Object

See also

getItemAtLocation()method 
public function getItemAtLocation(location:Vector.<int>):Object

Returns the item at the specified location in the collection.

Parameters

location:Vector.<int>

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 an empty vector.

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.

Calling getLengthOfBranch() instead is recommended because the Vector.<int> location may be reused to avoid excessive garbage collection from temporary objects created by ...rest arguments.

Parameters

... rest

Returns
int

Throws
RangeError — Branch not found at specified location

See also

getLengthAtLocation()method 
public function getLengthAtLocation(location:Vector.<int> = null):int

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

Parameters

location:Vector.<int> (default = null)

Returns
int

Throws
RangeError — Branch not found at specified location
isBranch()method 
public function isBranch(node:Object):Boolean

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

Parameters

node:Object

Returns
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.

Calling removeItemAtLocation() instead is recommended because the Vector.<int> location may be reused to avoid excessive garbage collection from temporary objects created by ...rest arguments.

Parameters

index:int
 
... rest

Returns
Object

Throws
RangeError — Branch not found at specified location

See also

removeItemAtLocation()method 
public function removeItemAtLocation(location:Vector.<int>):Object

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

Parameters

location:Vector.<int>

Returns
Object

Throws
RangeError — Branch not found at specified location
setItemAt()method 
public function setItemAt(item:Object, index:int, ... rest):void

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

Calling setItemAtLocation() instead is recommended because the Vector.<int> location may be reused to avoid excessive garbage collection from temporary objects created by ...rest arguments.

Parameters

item:Object
 
index:int
 
... rest


Throws
RangeError — Branch not found at specified location

See also

setItemAtLocation()method 
public function setItemAtLocation(item:Object, location:Vector.<int>):void

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

Parameters

item:Object
 
location:Vector.<int>


Throws
RangeError — Branch not found at specified location
updateAll()method 
public function updateAll():void

Call updateAll() to manually inform any component rendering the hierarchical collection 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, ... rest):void

Call updateItemAt() to manually inform any component rendering the hierarchical collection 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
 
... rest

See also

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 properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe 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.
dataThe index path of the item that has been added. It is of type Array and contains objects of type int.
targetThe 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.

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 components will need to redraw the data.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe 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.
datanull
targetThe 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  
Event Object Type: starling.events.Event
Event.type property = feathers.events.CollectionEventType.REMOVE_ITEM

Dispatched when an item is removed from the collection.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe 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.
dataThe index path of the item that has been removed. It is of type Array and contains objects of type int.
targetThe 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.

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 properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe 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.
dataThe index path of the item that has been replaced. It is of type Array and contains objects of type int.
targetThe 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.

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.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe 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.
datanull
targetThe 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.

Dispatched when the data provider's source is completely replaced.
updateAll Event  
Event Object Type: starling.events.Event
Event.type property = feathers.events.CollectionEventType.UPDATE_ALL

Dispatched when the updateAll() function is called on the hierarchical collection.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe 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.
datanull
targetThe 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.

Dispatched when all existing items in the collection have changed (but they have not been replaced by different items).

See also

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

Dispatched when the updateItemAt() function is called on the hierarchical collection.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
currentTargetThe 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.
dataThe index path of the item that has been updated. It is of type Array and contains objects of type int.
targetThe 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.

Dispatched when an item in the collection has changed.

See also