C

CollectionModelManager<T>

An ItemModelManager<T> that automatically installs and removes visual representations of items in a IObservableCollection<T> into or from the canvas.
Inheritance Hierarchy

Members

Show:

Constructors

Creates a new instance.

Parameters

itemType: Constructor<T>
The type of items in the observable collection.

See Also

API
model
Creates a new instance using the given model.

Parameters

itemType: Constructor<T>
The type of items in the observable collection.
model: IObservableCollection<T>
The model to manage.

Properties

Gets or sets a comparison that compares the items so that they are put into the correct order in the canvas tree.
If this instance is set to null this feature is effectively turned off.
final
Gets or sets a value indicating whether this CollectionModelManager<T> is enabled.
If the manager is disabled, it will not install the IRenderTreeElements into the associated CanvasComponent.
final

Property Value

true if enabled; otherwise, false.
Gets or sets the model of the items to display in the canvas.
Setting the model will automatically remove the items installed for a previously installed model. Also, the items contained in the new model will immediately be queried and installed into the canvas.
final
Gets or sets the renderer used by install when an item is added to a render tree group.
Setting the renderer to null will prevent this manager from installing new items.
final

Property Value

The renderer used by install.
Gets or sets the render tree group used by install.
Setting this property to null will prevent this manager from installing new items.
final

Methods

Registers and installs the given item into the canvas.

Parameters

item: T
The item to install.
Adds all items to the canvas.
This is useful to initialize this manager with an existing collection of items.

Parameters

items: IEnumerable<T>
The items to add.
Tries to find the item managed by this instance that is associated with the given render tree element.

Parameters

renderTreeElement: IRenderTreeElement
The render tree element to query the corresponding model item for.

Return Value

T
The item or null if no such item could be found.
Returns the IObjectRenderer<T> used to install the item in the canvas.
The default implementation simply returns the value of renderer.
protected

Parameters

item: T
The item to get the renderer for.

Return Value

IObjectRenderer<T>
The IObjectRenderer<T> used to install an item in the canvas.
Retrieves the render tree element that has been registered for the given item or null.

Parameters

item: T
The item to retrieve the render tree element for.

Return Value

IRenderTreeElement
A render tree element instance or null.

See Also

API
install
Gets the IRenderTreeGroup used to install the item in the canvas.
The default implementation simply returns the value of renderTreeGroup.
protected

Parameters

item: T
The item to get the group for.

Return Value

IRenderTreeGroup
The IRenderTreeGroup used to install an item in the canvas.
Installs a member of the collection into the canvas using the renderer.
protected

Parameters

item: T
The member to install.

Return Value

IRenderTreeElement
The new render tree element or null if the item was not installed.
Event handler for item creation events that adds the item to this manager.

This method is intended to be used to delegate item creation events from observable collections:

Using the ItemAddedHandler method as an event handler on an observable collection
manager.addEventListener('item-added', model.itemAddedHandler)

This method calls addItem with item.

Parameters

evt: ItemEventArgs<T>
The event arguments.
source: any
The instance that raised the event.
Event handler for item removal events that removes the item from this manager.

This method is intended to be used to delegate item removal events from observable collections:

Using the ItemRemovedHandler method as an event handler on an observable collection
manager.addEventListener('item-removed', model.itemRemovedHandler)

This method calls removeItem with item.

Parameters

evt: ItemEventArgs<T>
The event arguments.
source: any
The instance that raised the event.
Called when this mode gets disabled.
Called when this mode gets enabled.
Deregisters and uninstalls the given item from the canvas.

Parameters

item: T
The item to uninstall.
Removes all items from the canvas.
This method can be used to clean up this manager before disposing it.

Parameters

items: IEnumerable<T>
The items to remove.
This method may be called to update the visual representation of the given item in the canvas.
If no visual representation is registered, yet, install will be called.

Parameters

item: T
The item to update.