Exhibit/API/2.2.0/Data/Collection

= Exhibit.Collection =

A grouping of items in a database, possibly by type. Configurable by the user.

Code: http://api.simile-widgets.org/exhibit/2.2.0/scripts/data/collection.js

Back to Exhibit API

Exhibit.Collection.createAllItemsCollection

 * Returns: Exhibit.Collection
 * Description: Generator, includes all items in the database

Exhibit.Collection.createSubmissionsCollection

 * Returns: Exhibit.Collection
 * Description: Generator, includes all submitted items in the database

Exhibit.Collection.create

 * Returns:  Exhibit.Collection
 * Description: Generator, includes all items of certain type given in the configuration, or all items if not configured.

Exhibit.Collection.createFromDOM

 * Returns: Exhibit.Collection
 * Description: Generator, like create, but reads configuration from the DOM.

Exhibit.Collection.create2

 * Description: Generator, like create, but locate the database from the UI context.

Exhibit.Collection.createFromDOM2

 * Description: Generator, like createFromDOM2, but locate the database from the UI context.

Exhibit.Collection._initializeBasicCollection

 * Description: Method called by most generators to fill the collection and add database listeners for its benefit.

Exhibit.Collection._initializeBasedCollection

 * Description: Method called by a generator where a collection on which this collection is based exists.

Exhibit.Collection._initializeRestrictingBasedCollection

 * Description: Used to initialize a collection based on another collection where updates to this collection should affect the base collection (they do not by default).

Exhibit.Collection._allItemsCollection_update

 * Description: Not intended to be called outside of an Exhibit.Collection object's context. This only appears as if it might be a static method; it is not.  Assigned as a collection's update method when the collection is based on all items in the database.  The update method is called when relevant database events are fired.

Exhibit.Collection._submissionCollection_update

 * Description: Not a static method. Assigned as a collection's update method when the collection is based on submitted items in the database.

Exhibit.Collection._typeBasedCollection_update

 * Description: Not a static method. Assigned as a collection's update method when the collection is based on a set of item types.

Exhibit.Collection._basedCollection_update

 * Description: Not a static method. Assigned as a collection's update method when the collection is based on another collection.

Exhibit.Collection._restrictingBasedCollection_onFacetUpdated

 * Description: Not a static method. Substitutes for the common implementation of onFacetUpdated to deal with the base collection.

Exhibit.Collection._restrictingBasedCollection_restrict

 * Description: Not a static method. Substitutes for the common restrict method to restrict the base collection.

Exhibit.Collection._restrictingBasedCollection_update

 * Description: Not a static method. Assigned as the update method when a collection is based on another collection and restricts it.

Exhibit.Collection._restrictingBasedCollection_hasRestrictions

 * Description: Not a static method. Adds a hasRestrictions method to the collection, like a Exhibit.Facet has.

Exhibit.Collection

 * Description: Creates a new object with an identifier and the database it draws from.

Exhibit.Collection.prototype.getID

 * Description: Getter, for the collection identifier.

Exhibit.Collection.prototype.dispose

 * Description: Handle removing the collection from the local context, disabling listeners and removing internal references to objects.

Exhibit.Collection.prototype.addListener

 * Description: Add a listener for collection events.

Exhibit.Collection.prototype.removeListener

 * Description: Remove a listener.

Exhibit.Collection.prototype.addFacet

 * Description: Register an Exhibit.Facet with the collection.

Exhibit.Collection.prototype.removeFacet

 * Description: Remove a previously registered Exhibit.Facet from the collection. Generally called by the facet itself when it is disposed.

Exhibit.Collection.prototype.clearAllRestrictions

 * Returns: Array, of all cleared restrictions.
 * Description: Signal all registered facets to clear any currently set restrictions.

Exhibit.Collection.prototype.applyRestrictions

 * Description: Given an array of restrictions, signal each registered facets to implement any applicable restriction.

Exhibit.Collection.prototype.getAllItems

 * Returns: Exhibit.Set
 * Description: Return all items in the collection regardless of restrictions.

Exhibit.Collection.prototype.countAllItems

 * Description: Return the count of all items in the collection regardless of restrictions.

Exhibit.Collection.prototype.getRestrictedItems

 * Description: Return only the items that match current restrictions.

Exhibit.Collection.prototype.countRestrictedItems

 * Description: Return the count of only the items that match current restrictions.

Exhibit.Collection.prototype.onFacetUpdated

 * Description: Modifies the set of items matching the restriction based on changes to a facet, sending the signal  when finished.

Exhibit.Collection.prototype.setItems

 * Description: Explicitly set which items are in this collection.

Exhibit.Collection.prototype._onRootItemsChanged

 * Description: Private method called when the base set of items the collection includes have changed, called by the update methods. Fires   during execution.

Exhibit.Collection.prototype._updateFacets

 * Description: Private method that signals registered facets to make updates based on one facet's restrictions changing, called by onFacetUpdated.

Exhibit.Collection.prototype._computeRestrictedItems

 * Description: Private method for calculating the new set of items based on restrictions, caching the result for later use.