Class: DiagramModel
Defined in: diagram/model.ts:133
Stores the diagram content: graph (elements, links); maintains selection and the current language to display the data.
Additionally, the diagram model provides the means to undo/redo commands via history.
Extended by
Implements
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
| Events for the diagram model. | ||
| Provides the mechanism to undo/redo commands on the diagram. |
Accessors
cellsVersion
Get Signature
get cellsVersion():
number
Defined in: diagram/model.ts:213
Graph content (elements and links) version number which changes on every cell change (when element or link added/removed/reordered, see DiagramModelEvents.changeCells).
Returns
number
Implementation of
elements
Get Signature
get elements(): readonly
Element[]
Defined in: diagram/model.ts:217
All elements (nodes) in the graph.
Returns
readonly Element[]
Implementation of
factory
Get Signature
get factory():
DataFactory
Defined in: diagram/model.ts:209
Provides an RDF term factory to create RDF terms for identifiers and property values.
Returns
Implementation of
language
Get Signature
get language():
string
Defined in: diagram/model.ts:168
Current language for the diagram content.
Language code is specified as lowercase BCP47
string (examples: en, en-gb, etc).
Initial language is en.
Returns
string
links
Get Signature
get links(): readonly
Link[]
Defined in: diagram/model.ts:221
All links (edges) between elements in the graph.
Returns
readonly Link[]
Implementation of
selection
Get Signature
Defined in: diagram/model.ts:188
Current diagram selection (elements and/or links).
Returns
Methods
addElement()
addElement(
element):void
Defined in: diagram/model.ts:352
Adds the element to the diagram.
Throws an error if element with the same Element.id already exists in the graph.
The operation puts a command to the command history.
Parameters
| Parameter | Type |
|---|---|
|
Returns
void
addLink()
addLink(
link):void
Defined in: diagram/model.ts:382
Adds the link to the diagram.
Throws an error if link with the same Link.id already exists in the graph or any of source or target is not in the graph.
The operation puts a command to the command history.
Parameters
| Parameter | Type |
|---|---|
|
Returns
void
bringElements()
bringElements(
targets,to):void
Defined in: diagram/model.ts:333
Puts specified elements before or after all other in the display order.
Parameters
| Parameter | Type |
|---|---|
| readonly |
|
|
Returns
void
findLink()
findLink(
linkTypeId,sourceId,targetId):undefined|Link
Defined in: diagram/model.ts:244
Searches for any link of the specified type between elements with specified IDs in the graph if exists.
If multiple links is found, any of them could be returned.
Parameters
| Parameter | Type |
|---|---|
| |
|
|
|
|
Returns
undefined | Link
Implementation of
getElement()
getElement(
elementId):undefined|Element
Defined in: diagram/model.ts:232
Gets an element by its Element.id in the graph if exists.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
undefined | Element
Implementation of
getElementLinks()
getElementLinks(
element): readonlyLink[]
Defined in: diagram/model.ts:236
Gets all links connected to the specified element in the graph.
If element is not in the graph, no links would be returned.
Parameters
| Parameter | Type |
|---|---|
|
Returns
readonly Link[]
Implementation of
GraphStructure.getElementLinks
getLink()
getLink(
linkId):undefined|Link
Defined in: diagram/model.ts:240
Gets a link by its Link.id in the graph if exists.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
undefined | Link
Implementation of
getLinkVisibility()
getLinkVisibility(
linkTypeId):LinkTypeVisibility
Defined in: diagram/model.ts:259
Gets current visibility mode for the specified link type.
Parameters
| Parameter | Type |
|---|---|
|
Returns
Implementation of
GraphStructure.getLinkVisibility
removeElement()
removeElement(
elementId):void
Defined in: diagram/model.ts:365
Removes the element with specified ID from the diagram if exists.
When element is removed, all connected links will be removed as well.
The operation puts a command to the command history.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
void
removeLink()
removeLink(
linkId):void
Defined in: diagram/model.ts:391
Removes the link with specified ID from the diagram if exists.
The operation puts a command to the command history.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
void
reorderElements()
reorderElements(
compare):void
Defined in: diagram/model.ts:325
Changes display order of elements on the diagram.
Parameters
| Parameter | Type | Description |
|---|---|---|
| ( | Sort comparator to establish a particular ordering |
Returns
void
setLanguage()
setLanguage(
value):void
Defined in: diagram/model.ts:175
Sets current language for the diagram content.
Language code is specified as lowercase BCP47
string (examples: en, en-gb, etc).
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
void
setLinkVisibility()
setLinkVisibility(
linkTypeId,value):void
Defined in: diagram/model.ts:266
Sets current visibility mode for the specified link type.
Parameters
| Parameter | Type |
|---|---|
| |
|
Returns
void
setSelection()
setSelection(
value):void
Defined in: diagram/model.ts:195
Sets current diagram selection (elements and/or links).
When called, selected cells will be brought to the front before all other diagram cells.
Parameters
| Parameter | Type |
|---|---|
|
Returns
void
sourceOf()
sourceOf(
link):undefined|Element
Defined in: diagram/model.ts:251
Gets a source element for the specified link in the graph.
If link is not in the graph, undefined would be returned instead.
Parameters
| Parameter | Type |
|---|---|
|
Returns
undefined | Element
Implementation of
targetOf()
targetOf(
link):undefined|Element
Defined in: diagram/model.ts:255
Gets a target element for the specified link in the graph.
If link is not in the graph, undefined would be returned instead.
Parameters
| Parameter | Type |
|---|---|
|
Returns
undefined | Element