Installs and removes visual representations of items into or from the canvas.
Inheritance Hierarchy
Members
Show:
Constructors
Creates a new instance of ItemModelManager<T>.
Creates a new instance of ItemModelManager<T>.
Parameters
- itemType: Constructor<T>
- The type of managed items.
Properties
If this instance is set to
null this feature is effectively turned off.final
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.
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.
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.
Tries 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.
Overridden in
CollectionModelManager.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.
Retrieves 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
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.
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.
Event 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.
Event 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.
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.
If no visual representation is registered, yet, install will be called.
Parameters
- item: T
- The item to update.