EntityCollection

external class EntityCollection(source)

An observable collection of Entity instances where each entity has a unique id.

See also

Constructors

Link copied to clipboard
constructor(owner: DataSource)
constructor(owner: CompositeEntityCollection)
constructor()

Properties

Link copied to clipboard

Gets the event that is fired when entities are added or removed from the collection. The generated event is a EntityCollection.CollectionChangedEventCallback.

Link copied to clipboard
val id: String

Gets a globally unique identifier for this collection.

Link copied to clipboard
val owner: Any

Gets the owner of this entity collection, ie. the data source or composite entity collection which created it.

Link copied to clipboard

Gets whether or not this entity collection should be displayed. When true, each entity is only displayed if its own show property is also true.

Link copied to clipboard

Gets the array of Entity instances in the collection. This array should not be modified directly.

Functions

Link copied to clipboard
fun add(entity: Entity): Entity

Add an entity to the collection.

Link copied to clipboard

Computes the maximum availability of the entities in the collection. If the collection contains a mix of infinitely available data and non-infinite data, it will return the interval pertaining to the non-infinite data only. If all data is infinite, an infinite interval will be returned.

Link copied to clipboard
fun contains(entity: Entity): Boolean

Returns true if the provided entity is in this collection, false otherwise.

Link copied to clipboard
fun getById(id: String): Entity?

Gets an entity with the specified id.

Link copied to clipboard

Gets an entity with the specified id or creates it and adds it to the collection if it does not exist.

Link copied to clipboard
fun remove(entity: Entity): Boolean

Removes an entity from the collection.

Link copied to clipboard
fun removeAll()

Removes all Entities from the collection.

Link copied to clipboard

Removes an entity with the provided id from the collection.

Link copied to clipboard

Resumes raising EntityCollection.collectionChanged events immediately when an item is added or removed. Any modifications made while while events were suspended will be triggered as a single event when this function is called. This function is reference counted and can safely be called multiple times as long as there are corresponding calls to EntityCollection.resumeEvents.

Link copied to clipboard

Prevents EntityCollection.collectionChanged events from being raised until a corresponding call is made to EntityCollection.resumeEvents, at which point a single event will be raised that covers all suspended operations. This allows for many items to be added and removed efficiently. This function can be safely called multiple times as long as there are corresponding calls to EntityCollection.resumeEvents.