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 using the given 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
If this instance is set to
null this feature is effectively turned off.final
Defined in
ItemModelManager.comparatorGets or sets a value indicating whether this CollectionModelManager<T> is enabled.
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.
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
Setting the renderer to
null will prevent this manager from installing new items.final
Property Value
The renderer used by install.
Defined in
ItemModelManager.rendererGets or sets the render tree group 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
Defined in
ItemModelManager.renderTreeGroupMethods
Registers and installs the given item into the canvas.
Registers and installs the given
item into the canvas.Adds all items to the canvas.
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.
Defined in
ItemModelManager.addItemsTries to find the item managed by this instance that is associated with the given render tree element.
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
nullif no such item could be found.
Overrides
ItemModelManager.getItemThe 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.
Defined in
ItemModelManager.getRendererRetrieves the render tree element that has been registered for the given item or null.
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
Defined in
ItemModelManager.getRenderTreeElementThe 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.
Defined in
ItemModelManager.getRenderTreeGroupInstalls a member of the collection into the canvas using the renderer.
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
nullif the item was not installed.
Defined in
ItemModelManager.installEvent handler for item creation events that adds the item to this manager.
Event handler for item creation events that adds the item to this manager.
Parameters
- evt: ItemEventArgs<T>
- The event arguments.
- source: any
- The instance that raised the event.
Defined in
ItemModelManager.itemAddedHandlerEvent handler for item removal events that removes the item from this manager.
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:
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.
Defined in
ItemModelManager.itemRemovedHandlerCalled when this mode gets disabled.
Called when this mode gets disabled.
Called when this mode gets enabled.
Called when this mode gets enabled.
Removes all items from the canvas.
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.
Defined in
ItemModelManager.removeItemsIf no visual representation is registered, yet, install will be called.
Parameters
- item: T
- The item to update.