Installs and removes visual representations of items into or from the canvas.
Type Parameters
- T
- The type of managed items.
Type Details
- yFiles module
- view
Constructors
Creates a new instance of ItemModelManager<T>.
Parameters
A map of options to pass to the method.
- itemType - Constructor<T>
- The type of managed items.
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
Gets or sets the render tree group used by install.
Remarks
null
will prevent this manager from installing new items.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.
Adds all items to the canvas.
Remarks
Parameters
A map of options to pass to the method.
- 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
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.
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.
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
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.
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.
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.
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.
Removes all items from the canvas.
Remarks
Parameters
A map of options to pass to the method.
- items - IEnumerable<T>
- The items to remove.
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.