Used by the GraphClipboard to assign IDs for elements in the clipboard.
Remarks
IDs are created when items are copied (or cut) into the clipboard and queried when the items are pasted from the clipboard.
Providing a custom ID provider allows for identifying conceptually identical items across different graph instances.
The default implementation uses the IModelItem object reference as the ID.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.graph.IClipboardIdProvider
Methods
Gets the ID for the given originalItem
.
Parameters
A map of options to pass to the method.
- context - IGraphClipboardContext
- The clipboard context
- originalItem - IModelItem
- The original item which is copied. The item is part of the original graph from which the item is copied.
Returns
- ↪any
- An ID for the given item. The object should be suitable for use in a HashMap<TKey,TValue>.
Gets the item which is represented by the given id
.
Parameters
A map of options to pass to the method.
- context - IGraphClipboardContext
- The clipboard context.
- id - Object
- The ID to get the item for.
Returns
- ↪IModelItem
- The item which is represented by the given ID or
null
if the item cannot be located or is invalid. The item needs to be part of the target graph for paste operations.
Examples
Static Methods
Creates an implementation of the interface IClipboardIdProvider from the given definition.
Remarks
Parameters
A map of options to pass to the method.
- getId - function(IGraphClipboardContext, IModelItem):any
Gets the ID for the given
originalItem
.This property holds the implementation for getId.
- getItem - function(IGraphClipboardContext, any):IModelItem
Gets the item which is represented by the given
id
.This property holds the implementation for getItem.
Returns
- ↪IClipboardIdProvider
- An instance of the IClipboardIdProvider interface based on the given definition.