Package | com.yworks.canvas.model |
Class | public class DefaultCollectionModel |
Inheritance | DefaultCollectionModel com.yworks.support.EventDispatchingProxy |
Implements | ICollectionModel |
ICollectionModel
that is backed by an ordinary Collection
.
This class also lets you use [ ] array notation to access the getItemAt()
method. Writing is not supported.
The for each..in
loop is also supported.
Method | Defined By | ||
---|---|---|---|
DefaultCollectionModel(items:Collection = null)
Creates a new instance using a provided collection as the backing store. | DefaultCollectionModel | ||
Adds all of the elements in the specified collection to this collection (optional operation). | DefaultCollectionModel | ||
addItem(item:Object):Boolean
Adds the specified item to this collection. | DefaultCollectionModel | ||
clear():void
Removes all of the elements from this collection. | DefaultCollectionModel | ||
contains(item:Object):Boolean
Returns true if this collection contains the specified element. | DefaultCollectionModel | ||
getItemAt(index:int):Object
Returns the element at the specified position in this collection. | DefaultCollectionModel | ||
isEmpty():Boolean
Returns true if this collection contains no elements. | DefaultCollectionModel | ||
Returns an iterator over a set of elements. | DefaultCollectionModel | ||
length():uint
Returns the number of elements in this collection. | DefaultCollectionModel | ||
onItemAdded(item:Object):void
Callback method that will trigger the collectionChange
event. | DefaultCollectionModel | ||
onItemChanged(item:Object):void
Callback method that will trigger the collectionChange
event. | DefaultCollectionModel | ||
onItemRemoved(item:Object):void
Callback method that will trigger the collectionChange
event. | DefaultCollectionModel | ||
removeItem(item:Object):Boolean
Removes a single instance of the specified element from this collection, if it is present (optional operation). | DefaultCollectionModel | ||
toArray():Array
Returns an array containing all of the elements in this collection. | DefaultCollectionModel |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when an item has been added, removed or changed. | DefaultCollectionModel |
DefaultCollectionModel | () | Constructor |
public function DefaultCollectionModel(items:Collection = null)
Creates a new instance using a provided collection as the backing store.
Creates a new collection if none is provides.
Parametersitems:Collection (default = null ) — The collection to use.
|
addAll | () | method |
public function addAll(iter:Iterable):void
Adds all of the elements in the specified collection to this collection (optional operation).
Parameters
iter:Iterable — the collection containing elements to be added to this collection
|
addItem | () | method |
public function addItem(item:Object):Boolean
Adds the specified item to this collection. Returns true if this collection changed as a result of the call. (Returns false if this collection does not permit duplicates and already contains the specified element.)
Parameters
item:Object — element whose presence in this collection is to be ensured
|
Boolean — true if this collection changed as a result of the call
|
clear | () | method |
public function clear():void
Removes all of the elements from this collection. The collection will be empty after this method returns.
contains | () | method |
public function contains(item:Object):Boolean
Returns true if this collection contains the specified element.
Parameters
item:Object — element whose presence in this collection is to be tested
|
Boolean — true if this collection contains the specified element
|
getItemAt | () | method |
public function getItemAt(index:int):Object
Returns the element at the specified position in this collection.
Parameters
index:int — the index of the element to return
|
Object — the element at the specified position in this list
|
isEmpty | () | method |
public function isEmpty():Boolean
Returns true if this collection contains no elements.
ReturnsBoolean — true if this collection contains no elements
|
iterator | () | method |
public function iterator():Iterator
Returns an iterator over a set of elements.
ReturnsIterator — an Iterator.
|
length | () | method |
public function length():uint
Returns the number of elements in this collection.
Returnsuint — the number of elements in this collection
|
onItemAdded | () | method |
public function onItemAdded(item:Object):void
Callback method that will trigger the collectionChange
event.
Parameters
item:Object — The item that has just been added to the collection.
|
onItemChanged | () | method |
public function onItemChanged(item:Object):void
Callback method that will trigger the collectionChange
event.
Parameters
item:Object — The item that has just been changed.
|
onItemRemoved | () | method |
public function onItemRemoved(item:Object):void
Callback method that will trigger the collectionChange
event.
Parameters
item:Object — The item that has just been removed from the collection.
|
removeItem | () | method |
public function removeItem(item:Object):Boolean
Removes a single instance of the specified element from this collection, if it is present (optional operation).
Parameters
item:Object — element to be removed from this collection, if present
|
Boolean — true if an element was removed as a result of this call
|
toArray | () | method |
public function toArray():Array
Returns an array containing all of the elements in this collection.
ReturnsArray — an array containing all of the elements in this collection
|
collectionChange | Event |
mx.event.CollectionEvent
mx.event.CollectionEvent.COLLECTION_CHANGE
Dispatched when an item has been added, removed or changed.