An ItemModelManager<T> that automatically installs and removes visual representations of items in a IObservableCollection<T> into or from the canvas.
Type Parameters
- T
- The type of items in the observable collection.
Type Details
- yFiles module
- view
Constructors
Creates a new instance using the given model
.
Parameters
A map of options to pass to the method.
- itemType - Constructor<T>
- The type of items in the observable collection.
- model - IObservableCollection<T>
- The model to manage.
Creates a new instance.
Parameters
A map of options to pass to the method.
- itemType - Constructor<T>
- The type of items in the observable collection.
See Also
Properties
Gets or sets a comparison that compares the items so that they are put into the correct order in the canvas tree.
Remarks
null
this feature is effectively turned off.Signature Details
function(x: T, y: T) : number
Parameters
- x - T
- The first object to compare.
- y - T
- The second object to compare.
Returns
- number
- An integer value which is
<0
ifx
is less thany
,0
ifx
is equal toy
, or>0
ifx
is greater thany
Defined in
Gets or sets a value indicating whether this CollectionModelManager<T> is enabled.
Remarks
Property Value
true
if enabled; otherwise, false
.Gets or sets the model of the items to display in the canvas.
Remarks
Gets or sets the render tree group used by install.
Remarks
null
will prevent this manager from installing new items.Defined in
Methods
Registers and installs the given item
into the canvas.
Parameters
A map of options to pass to the method.
- item - T
- The item to install.
Overrides
Adds all items to the canvas.
Remarks
Parameters
A map of options to pass to the method.
- items - IEnumerable<T>
- The items to add.
Defined in
Tries to find the item managed by this instance that is associated with the given render tree element.
Parameters
A map of options to pass to the method.
- renderTreeElement - IRenderTreeElement
- The render tree element to query the corresponding model item for.
Returns
- ↪T?
- The item or
null
if no such item could be found.
Overrides
Returns the IObjectRenderer<T> used to install the item
in the canvas.
Remarks
Parameters
A map of options to pass to the method.
- item - T
- The item to get the renderer for.
Returns
- ↪IObjectRenderer<T>?
- The IObjectRenderer<T> used to install an item in the canvas.
Defined in
Retrieves the render tree element that has been registered for the given item or null
.
Parameters
A map of options to pass to the method.
- item - T
- The item to retrieve the render tree element for.
Returns
- ↪IRenderTreeElement?
- A render tree element instance or
null
.
See Also
Defined in
Gets the IRenderTreeGroup used to install the item
in the canvas.
Remarks
Parameters
A map of options to pass to the method.
- item - T
- The item to get the group for.
Returns
- ↪IRenderTreeGroup?
- The IRenderTreeGroup used to install an item in the canvas.
Defined in
Installs a member of the collection into the canvas using the renderer.
Parameters
A map of options to pass to the method.
- item - T
- The member to install.
Returns
- ↪IRenderTreeElement?
- The new render tree element or
null
if the item was not installed.
Defined in
Event handler for item creation events that adds the item to this manager.
Remarks
This method is intended to be used to delegate item creation events from observable collections:
manager.addEventListener('item-added', model.itemAddedHandler)
Parameters
A map of options to pass to the method.
- evt - ItemEventArgs<T>
- The event arguments.
- source - any
- The instance that raised the event.
Defined in
Event handler for item removal events that removes the item from this manager.
Remarks
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
A map of options to pass to the method.
- evt - ItemEventArgs<T>
- The event arguments.
- source - any
- The instance that raised the event.
Defined in
Called when this mode gets disabled.
Called when this mode gets enabled.
Deregisters and uninstalls the given item
from the canvas.
Parameters
A map of options to pass to the method.
- item - T
- The item to uninstall.
Overrides
Removes all items from the canvas.
Remarks
Parameters
A map of options to pass to the method.
- items - IEnumerable<T>
- The items to remove.
Defined in
This method may be called to update the visual representation of the given item in the canvas.
Remarks
Parameters
A map of options to pass to the method.
- item - T
- The item to update.