You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2182 lines
146 KiB

<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Model | GoJS API</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../assets/css/bootstrap.min.css">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<!-- non-fixed navbar -->
<nav id="non-fixed-nav" class="navbar navbar-inverse navbar-top">
<div class="container-fluid">
<div class="navbar-header">
<div class="navheader-container">
<div class="navheader-collapse" data-toggle="collapse" data-target="#navbar">
<a id="toplogo" class="navbar-brand" href="../../index.html">GoJS</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</div>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="../../index.html">Home</a></li>
<li><a href="../../learn/index.html">Learn</a></li>
<li><a href="../../samples/index.html">Samples</a></li>
<li><a href="../../intro/index.html">Intro</a></li>
<li><a href="../../api/index.html" target="api">API</a></li>
<li><a href="https://www.nwoods.com/components/evalform.htm">Register</a></li>
<li><a href="../../download.html">Download</a></li>
<li><a href="https://forum.nwoods.com/c/gojs">Forum</a></li>
<li><a href="https://www.nwoods.com/contact.html" onclick="ga('send','event','Outbound Link','click','contact');">Contact</a></li>
<li class="buy"><a href="https://www.nwoods.com/sales/index.html" onclick="ga('send','event','Outbound Link','click','buy');">Buy</a></li>
<li class="activate"><a href="https://www.nwoods.com/app/activate.aspx?sku=gojs">Activate</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="tsd-page-header">
<div class="tsd-page-toolbar">
<div class="container-fluid plr15">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">GoJS API</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container-fluid plr15">
<div class="top-copyright">
<!--<b>GoJS</b>&reg; Diagramming Components<br/>version &lt;br/&gt;version 2.0.17 for TypeScript/HTML<br/>by <a href="https://www.nwoods.com/">Northwoods Software&reg;</a>-->
<b>GoJS</b>&reg; Diagramming Components<br/>version 2.0.17<br/>by <a href="https://www.nwoods.com/">Northwoods Software&reg;</a>
</div>
<div>
<h1>Class Model</h1>
</div>
</div>
</div>
</div>
</header>
<div class="container-fluid container-main plr15">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">Model</span>
<ul class="tsd-hierarchy">
<li>
<a href="GraphLinksModel.html" class="tsd-signature-type">GraphLinksModel</a>
</li>
<li>
<a href="TreeModel.html" class="tsd-signature-type">TreeModel</a>
</li>
</ul>
</li>
</ul>
</section>
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<p>Models hold the essential data of a diagram, describing the basic entities and their properties and relationships
without specifying the appearance and behavior of the Nodes and Links and Groups that represent them visually.
Models tend to hold only relatively simple data, making them easy to persist by serialization as JSON or XML formatted text.</p>
<p>Models hold simple data objects, not <a href="Part.html">Part</a>s such as <a href="Node.html">Node</a>s or <a href="Link.html">Link</a>s.
Node data is normally represented in a <a href="Diagram.html">Diagram</a> by instances of <a href="Node.html">Node</a>,
but they could be represented by simple <a href="Part.html">Part</a>s or by <a href="Group.html">Group</a>s.
A Diagram constructs Parts for its <a href="Diagram.html#model">Diagram.model</a>&#39;s data by copying templates.
Templates are <a href="Panel.html">Panel</a>s of <a href="GraphObject.html">GraphObject</a>s that get some property values from the model data,
accessible via the <a href="Panel.html#data">Panel.data</a> property, using data <a href="Binding.html">Binding</a>.
See <a href="../../intro/usingModels.html">Using Models</a> and <a href="../../intro/dataBinding.html">Data Binding</a> for an introduction.</p>
<p>This Model class only supports holding an array of node data
and interpreting properties on that data to be able to refer to them
using unique key values.
To support simple tree-structured graphs, use a <a href="TreeModel.html">TreeModel</a>, which inherits from this class.
To support links and grouping, use a <a href="GraphLinksModel.html">GraphLinksModel</a>.</p>
<p>Each node data object is assumed to have a unique key value.
The <a href="Model.html#nodeKeyProperty">nodeKeyProperty</a> property names the property on the node data whose value
is the unique key for that node data object.
The default value for this property is &quot;key&quot;.
You should not have a TwoWay data binding on the node key property,
because that might cause the property value to be set to a duplicate key value.</p>
<p>The key values must be either strings or numbers or undefined.
If the key is undefined, or if there are duplicate key values,
the model will automatically try to assign a new unique key value.
Caution: if your keys are numbers, do not try to use string representations of those numbers as keys.
Conversely, if your keys are strings that happen to have number syntax, do not try to use those number values.
Sometimes JavaScript will automatically convert from string to number or vice-versa, but sometimes it won&#39;t.</p>
<p>For example, one can define a graph consisting of just two nodes:</p>
<pre><code class="hljs js"> model.nodeDataArray = [
{ <span class="hljs-attr">key</span>: <span class="hljs-string">"Alpha"</span> },
{ <span class="hljs-attr">key</span>: <span class="hljs-string">"Beta"</span> }
];</code></pre>
<p>This model cannot detect the modification of the <a href="Model.html#nodeDataArray">nodeDataArray</a> array
or the modification of any node data object.
If you want to add or remove node data from the <a href="Model.html#nodeDataArray">nodeDataArray</a>,
call the <a href="Model.html#addNodeData">addNodeData</a> or <a href="Model.html#removeNodeData">removeNodeData</a> methods.</p>
<p>If you want to modify a node data object, it depends on whether the property you want to change
is a structural property that the model needs to know about, or whether it is a property
that is only used for data binding or other application-specific purposes.</p>
<p>For the former case, call the appropriate method, such as
<a href="Model.html#setKeyForNodeData">setKeyForNodeData</a>, <a href="Model.html#setCategoryForNodeData">setCategoryForNodeData</a>,
<a href="GraphLinksModel.html#setToKeyForLinkData">GraphLinksModel.setToKeyForLinkData</a>, or <a href="GraphLinksModel.html#setGroupKeyForNodeData">GraphLinksModel.setGroupKeyForNodeData</a>.
These methods have names that start with &quot;set&quot;, &quot;add&quot;, &quot;insert&quot;, or &quot;remove&quot;.</p>
<p>For the latter case, when setting an application-specific property, typically for data binding,
and to support undo/redo, call <a href="Model.html#setDataProperty">setDataProperty</a>.</p>
<p>The <a href="Model.html#copyNodeData">copyNodeData</a> method can be called to make a shallow copy of a node data object.
However, if some of those property values are Arrays that want not to be shared but to be copied,
you can set <a href="Model.html#copiesArrays">copiesArrays</a> to true. This is typically very useful when dealing
with data bound item arrays.
Furthermore if the items in those copied Arrays are in fact Objects that need to be copied,
you can also set <a href="Model.html#copiesArrayObjects">copiesArrayObjects</a> to true, causing a copied Array to refer to
newly shallow-copied objects of the original array.</p>
<p>Each model raises <a href="ChangedEvent.html">ChangedEvent</a>s that you can follow by registering a listener via <a href="Model.html#addChangedListener">addChangedListener</a>.
Read more at the Introduction page: <a href="../../intro/changedEvents.html">Changed Events</a>.</p>
<p>Each model comes with its own <a href="UndoManager.html">UndoManager</a> that is initially not enabled.
You will need to set <a href="UndoManager.html#isEnabled">UndoManager.isEnabled</a> to true in order for the
UndoManager to record model changes and for your users to perform undo and redo.</p>
<p>You can temporarily turn off the recording of changes by setting <a href="Model.html#skipsUndoManager">skipsUndoManager</a> to true.
A number of places within the system do that routinely in order to avoid recording temporary changes,
so be sure to remember the original value beforehand and restore it afterwards.
Note that in a <a href="ChangedEvent.html">ChangedEvent</a> listener you may want to ignore events that happen when <a href="Model.html#skipsUndoManager">skipsUndoManager</a> is true.</p>
<p>One normally saves a diagram by just saving its model.
If you can use JSON-formatted text, this is easy to do -- just call <a href="Model.html#toJson">toJson</a>
to get the string representation of the model, and save that string.
Load the diagram by replacing the <a href="Diagram.html#model">Diagram.model</a> with one created by calling
the static function <a href="Model.html#static-fromJson">Model.fromJson</a>:</p>
<pre><code class="hljs js"> myDiagram.model = go.Model.fromJson(loadedString);</code></pre>
<p>Note that JSON and other textual data formats cannot faithfully store all JavaScript functions.
<a href="Model.html#toJson">toJson</a> and <a href="Model.html#static-fromJson">Model.fromJson</a> do not try to save and load functional property values.
You should arrange that all such functions, including event handlers, are established by your app.
<a href="Model.html#toJson">toJson</a> and <a href="Model.html#static-fromJson">Model.fromJson</a> also cannot handle circular references; any sharing of
references will be lost too.
They also skip properties that are not enumerable, those whose names start with an underscore, and those whose values are undefined.</p>
<p>Note that models also do not store the templates used by diagrams,
nor any transient or temporary parts such as <a href="Adornment.html">Adornment</a>s, nor any tools,
nor any <a href="UndoManager.html">UndoManager</a> state, nor any event listeners.
These objects and all other properties of diagrams must be established by your app.</p>
<p>You can add any number of properties to the <a href="Model.html#modelData">modelData</a> object, which is serialized and deserialized
into JSON just like any other model data for nodes or links.
However <a href="Model.html#modelData">modelData</a> is associated with the model as a whole and does not depend on the existence
of any node data or link data.</p>
<p>It is also easy to save the changes that were recorded in the most recent transaction.
Call <a href="Model.html#toIncrementalJson">toIncrementalJson</a> to generate a JSON-format string that holds the current state of modified data
plus the keys of inserted or removed data.
That method requires as an argument a <a href="ChangedEvent.html">ChangedEvent</a> that represents a transaction that completed or
an undo or a redo that just finished.</p>
<p>It is also possible to use such &quot;incremental&quot; JSON to modify an existing model.
Call <a href="Model.html#applyIncrementalJson">applyIncrementalJson</a>, giving it a string generated by <a href="Model.html#toIncrementalJson">toIncrementalJson</a>,
to modify this model by making all of the changes recorded in the JSON text.
Note how this method is a regular instance method, whereas <a href="Model.html#static-fromJson">Model.fromJson</a> is a static function.</p>
</div>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="Model.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#copiesArrayObjects" class="tsd-kind-icon">copies<wbr>Array<wbr>Objects</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#copiesArrays" class="tsd-kind-icon">copies<wbr>Arrays</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#copiesKey" class="tsd-kind-icon">copies<wbr>Key</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#copyNodeDataFunction" class="tsd-kind-icon">copy<wbr>Node<wbr>Data<wbr>Function</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#dataFormat" class="tsd-kind-icon">data<wbr>Format</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#isReadOnly" class="tsd-kind-icon">is<wbr>Read<wbr>Only</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#makeUniqueKeyFunction" class="tsd-kind-icon">make<wbr>Unique<wbr>Key<wbr>Function</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#modelData" class="tsd-kind-icon">model<wbr>Data</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#name" class="tsd-kind-icon">name</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#nodeCategoryProperty" class="tsd-kind-icon">node<wbr>Category<wbr>Property</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#nodeDataArray" class="tsd-kind-icon">node<wbr>Data<wbr>Array</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#nodeKeyProperty" class="tsd-kind-icon">node<wbr>Key<wbr>Property</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#skipsUndoManager" class="tsd-kind-icon">skips<wbr>Undo<wbr>Manager</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="Model.html#undoManager" class="tsd-kind-icon">undo<wbr>Manager</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#addArrayItem" class="tsd-kind-icon">add<wbr>Array<wbr>Item</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#addChangedListener" class="tsd-kind-icon">add<wbr>Changed<wbr>Listener</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#addNodeData" class="tsd-kind-icon">add<wbr>Node<wbr>Data</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#addNodeDataCollection" class="tsd-kind-icon">add<wbr>Node<wbr>Data<wbr>Collection</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#applyIncrementalJson" class="tsd-kind-icon">apply<wbr>Incremental<wbr>Json</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#clear" class="tsd-kind-icon">clear</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><a href="Model.html#cloneProtected" class="tsd-kind-icon">clone<wbr>Protected</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#commit" class="tsd-kind-icon">commit</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#commitTransaction" class="tsd-kind-icon">commit<wbr>Transaction</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#containsNodeData" class="tsd-kind-icon">contains<wbr>Node<wbr>Data</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#copy" class="tsd-kind-icon">copy</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#copyNodeData" class="tsd-kind-icon">copy<wbr>Node<wbr>Data</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#findNodeDataForKey" class="tsd-kind-icon">find<wbr>Node<wbr>Data<wbr>For<wbr>Key</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="Model.html#static-fromJson" class="tsd-kind-icon">from<wbr>Json</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#getCategoryForNodeData" class="tsd-kind-icon">get<wbr>Category<wbr>For<wbr>Node<wbr>Data</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#getKeyForNodeData" class="tsd-kind-icon">get<wbr>Key<wbr>For<wbr>Node<wbr>Data</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#insertArrayItem" class="tsd-kind-icon">insert<wbr>Array<wbr>Item</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#makeNodeDataKeyUnique" class="tsd-kind-icon">make<wbr>Node<wbr>Data<wbr>Key<wbr>Unique</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#raiseChangedEvent" class="tsd-kind-icon">raise<wbr>Changed<wbr>Event</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#raiseDataChanged" class="tsd-kind-icon">raise<wbr>Data<wbr>Changed</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#removeArrayItem" class="tsd-kind-icon">remove<wbr>Array<wbr>Item</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#removeChangedListener" class="tsd-kind-icon">remove<wbr>Changed<wbr>Listener</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#removeNodeData" class="tsd-kind-icon">remove<wbr>Node<wbr>Data</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#removeNodeDataCollection" class="tsd-kind-icon">remove<wbr>Node<wbr>Data<wbr>Collection</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#rollbackTransaction" class="tsd-kind-icon">rollback<wbr>Transaction</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#set" class="tsd-kind-icon">set</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#setCategoryForNodeData" class="tsd-kind-icon">set<wbr>Category<wbr>For<wbr>Node<wbr>Data</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#setDataProperty" class="tsd-kind-icon">set<wbr>Data<wbr>Property</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#setKeyForNodeData" class="tsd-kind-icon">set<wbr>Key<wbr>For<wbr>Node<wbr>Data</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#startTransaction" class="tsd-kind-icon">start<wbr>Transaction</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#toIncrementalJson" class="tsd-kind-icon">to<wbr>Incremental<wbr>Json</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#toJson" class="tsd-kind-icon">to<wbr>Json</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="Model.html#updateTargetBindings" class="tsd-kind-icon">update<wbr>Target<wbr>Bindings</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
<a name="constructor" class="tsd-anchor"></a>
<h3>
constructor
</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new <wbr>Model<span class="tsd-signature-symbol">(</span>nodedataarray<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Model.html" class="tsd-signature-type">Model</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>You probably don&#39;t want to call this constructor, because this class
does not support links (relationships between nodes) or groups (nodes and links and subgraphs as nodes):
instead, create instances of a subclass such as <a href="GraphLinksModel.html">GraphLinksModel</a> or <a href="TreeModel.html">TreeModel</a>.</p>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> nodedataarray: <span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">&gt;</span></h5>
<div class="tsd-comment tsd-typography">
<p>an optional Array containing JavaScript objects to be represented by <a href="Part.html">Part</a>s.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="Model.html" class="tsd-signature-type">Model</a></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="copiesArrayObjects" class="tsd-anchor"></a>
<h3>
copies<wbr>Array<wbr>Objects
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets whether the default behavior for <a href="Model.html#copyNodeData">copyNodeData</a> or <a href="GraphLinksModel.html#copyLinkData">GraphLinksModel.copyLinkData</a>
when copying Arrays also copies array items that are Objects.
This only covers copying Objects that are items in Arrays that are copied when <a href="Model.html#copiesArrays">copiesArrays</a> is true.
Copying an Object when this property is true also recursively copies any Arrays that are property values.
It also assumes that the object&#39;s constructor can be called with no arguments.</p>
<p>The default value is false.
This property does not affect any behavior when the value of <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a>
or <a href="GraphLinksModel.html#copyLinkDataFunction">GraphLinksModel.copyLinkDataFunction</a> has been set to a function.
This property has no effect unless <a href="Model.html#copiesArrays">copiesArrays</a> is true.</p>
<p>Caution: if you want a copied data object to share some references but not others,
you will need to provide your own copying function as <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a> rather than setting
this property and <a href="Model.html#copiesArrays">copiesArrays</a> to true.</p>
<p>Warning: there should not be any cyclical references within the model data.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#copiesArrays">copiesArrays</a>, <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a></p>
</dd>
<dt>since</dt>
<dd><p>1.5</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="copiesArrays" class="tsd-anchor"></a>
<h3>
copies<wbr>Arrays
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets whether the default behavior for <a href="Model.html#copyNodeData">copyNodeData</a> or <a href="GraphLinksModel.html#copyLinkData">GraphLinksModel.copyLinkData</a>
makes copies of property values that are Arrays.
This only copies Arrays that are top-level property values in data objects, not for Arrays that are in nested objects.
Copying Arrays will also copy any array items that are Objects when <a href="Model.html#copiesArrayObjects">copiesArrayObjects</a> is true.</p>
<p>The default value is false.
It is commonplace to set <a href="Model.html#copiesArrayObjects">copiesArrayObjects</a> to true when setting this property to true.
This property does not affect any behavior when the value of <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a>
or <a href="GraphLinksModel.html#copyLinkDataFunction">GraphLinksModel.copyLinkDataFunction</a> has been set to a function.</p>
<p>Caution: if you want a copied data object to share some Arrays but not others,
you will need to provide your own copying function as <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a> rather than setting
this property to true.</p>
<p>Warning: there should not be any cyclical references within the model data.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#copiesArrayObjects">copiesArrayObjects</a>, <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a></p>
</dd>
<dt>since</dt>
<dd><p>1.5</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="copiesKey" class="tsd-anchor"></a>
<h3>
copies<wbr>Key
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets whether the default behavior for <a href="Model.html#copyNodeData">copyNodeData</a> or <a href="GraphLinksModel.html#copyLinkData">GraphLinksModel.copyLinkData</a>
when copying properties of a data object also copies the key property value.
Set this to false in order to force a unique key generation for data copied from another Diagram, such as a Palette.</p>
<p>The default value is true.
This property does not affect any behavior when the value of <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a> has been set to a function.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#copiesArrays">copiesArrays</a>, <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a></p>
</dd>
<dt>since</dt>
<dd><p>2.0</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="copyNodeDataFunction" class="tsd-anchor"></a>
<h3>
copy<wbr>Node<wbr>Data<wbr>Function
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">data</span><span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">model</span><span class="tsd-signature-symbol">: </span><a href="Model.html" class="tsd-signature-type">Model</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets a function that makes a copy of a node data object.</p>
<p>You may need to set this property in order to ensure that a copied <a href="Node.html">Node</a> is bound
to data that does not share certain data structures between the original node data and the copied node data.
This property value may be null in order to cause <a href="Model.html#copyNodeData">copyNodeData</a> to make a shallow copy of a JavaScript Object.
The default value is null.</p>
<p>The first argument to the function will be a node data object (potentially a <a href="Part.html">Part</a>&#39;s <a href="Panel.html#data">Panel.data</a>).
The second argument to the function will be this Model itself.</p>
<p>It is common to implement a copying function when the node data has an Array of data
and that Array needs to be copied rather than shared.
Often the objects that are in the Array also need to be copied.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="dataFormat" class="tsd-anchor"></a>
<h3>
data<wbr>Format
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the name of the format of the diagram data.
The default value is the empty string.
The value must not be null.
Use different values to prevent parts from one model to be copy/pasted or drag-and-dropped into another diagram/model.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="isReadOnly" class="tsd-anchor"></a>
<h3>
is<wbr>Read<wbr>Only
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets whether this model may be modified, such as adding nodes.
By default this value is false.
Setting the <a href="Model.html#nodeDataArray">nodeDataArray</a> to something that is not a true Array of Objects
will cause this to be set to true.</p>
<p>Model methods and property setters do not heed this property.
It is up to code that uses a model to check this property when it might want to
prevent changes to the model.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="makeUniqueKeyFunction" class="tsd-anchor"></a>
<h3>
make<wbr>Unique<wbr>Key<wbr>Function
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">model</span><span class="tsd-signature-symbol">: </span><a href="Model.html" class="tsd-signature-type">Model</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">data</span><span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../index.html#Key" class="tsd-signature-type">Key</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets a function that returns a unique id number or string for a node data object.
This function is called by <a href="Model.html#makeNodeDataKeyUnique">makeNodeDataKeyUnique</a>
when a node data object is added to the model, either as part of a new
<a href="Model.html#nodeDataArray">nodeDataArray</a> or by a call to <a href="Model.html#addNodeData">addNodeData</a>, to make sure the value of
<a href="Model.html#getKeyForNodeData">getKeyForNodeData</a> is unique within the model.</p>
<p>The value may be null in order to cause <a href="Model.html#makeNodeDataKeyUnique">makeNodeDataKeyUnique</a> behave in the standard manner.
(The default value is null.)
You may want to supply a function here in order to make sure all of the automatically generated keys
are in a particular format.
Setting this property after setting <a href="Model.html#nodeDataArray">nodeDataArray</a> has no real effect until there is a call
to <a href="Model.html#addNodeData">addNodeData</a>.</p>
<p>If you want to ensure that this function is called when copying data that already has a key,
set <a href="Model.html#copiesKey">copiesKey</a> to false.
This is typically useful when copying a node from a Palette, where the key it has in the Palette&#39;s Model
happens to be unique within the target Diagram&#39;s Model.
Unless you set <a href="Model.html#copiesKey">copiesKey</a> to false, the original key value will be copied and retained
if it is already unique within the target model.</p>
<p>If a node data object is already in the model and you want to change its key value,
call <a href="Model.html#setKeyForNodeData">setKeyForNodeData</a> with a new and unique key.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="modelData" class="tsd-anchor"></a>
<h3>
model<wbr>Data
<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets a JavaScript Object that can hold programmer-defined property values for the model as a whole,
rather than just for one node or one link.</p>
<p>By default this an object with no properties.
Any properties that you add to this object will be written out by <a href="Model.html#toJson">toJson</a>
and will be restored by <a href="Model.html#static-fromJson">Model.fromJson</a>, if the following conditions are true:</p>
<ul>
<li>the property is enumerable and its name does not start with an underscore (&#39;_&#39;)</li>
<li>the property value is not undefined and is not a function</li>
<li>the model knows how to convert the property value to JSON format</li>
<li>property values that are Objects or Arrays form a tree structure -- no shared or cyclical references</li>
</ul>
<p>Most object classes cannot be serialized into JSON without special knowledge and processing at both ends.
The <a href="Model.html#toJson">toJson</a> and <a href="Model.html#static-fromJson">Model.fromJson</a> methods automatically do such processing for numbers that are NaN
and for objects that are of class <a href="Point.html">Point</a>, <a href="Size.html">Size</a>, <a href="Rect.html">Rect</a>, <a href="Margin.html">Margin</a>, <a href="Spot.html">Spot</a>,
<a href="Brush.html">Brush</a> (but not for brush patterns), and for <a href="Geometry.html">Geometry</a>.</p>
<p>At the current time one cannot have a <a href="Diagram.html">Diagram</a> as a binding target.
Calling <a href="Model.html#setDataProperty">setDataProperty</a> will work to change a property value, but there are no target bindings in any Diagrams to be updated.
Because the binding mechanism is unavailable for this object, we recommend that when you want to save a model
that you explicitly set properties on this object just before calling <a href="Model.html#toJson">toJson</a>.
When loading a model, call <a href="Model.html#static-fromJson">Model.fromJson</a> and explicitly get the properties that you want to set on a Diagram.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="name" class="tsd-anchor"></a>
<h3>
name
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the name of this model.
The initial name is an empty string.
The value must not be null.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="nodeCategoryProperty" class="tsd-anchor"></a>
<h3>
node<wbr>Category<wbr>Property
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">a</span><span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">b</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the name of the node data property that returns a string naming that data&#39;s category.
The value may also be a function taking two arguments, where the first argument will be a node data object.
If the second argument is not supplied, the function should return the category name;
if the second argument is supplied, the function should modify the node data object so that it has that new category name.
The default value is the string &#39;category&#39;, meaning that it expects the data to have a property named &#39;category&#39; if it cares to name a category.
This is used by the diagram to distinguish between different kinds of nodes.
The name must not be null.
If the value is an empty string,
<a href="Model.html#getCategoryForNodeData">getCategoryForNodeData</a> will return an empty string for all node data objects.</p>
<p>If you want to set this property you must do so before using the model, and especially before you assign <a href="Diagram.html#model">Diagram.model</a>.
Note that functions cannot be serialized into JSON-formatted text, so if you are using <a href="Model.html#toJson">toJson</a> and <a href="Model.html#static-fromJson">Model.fromJson</a>,
and if you want this property to be a function, you will need to assign this property to your desired function
immediately after creating the model, including when it is created by <a href="Model.html#static-fromJson">Model.fromJson</a>.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#getCategoryForNodeData">getCategoryForNodeData</a>, <a href="Model.html#setCategoryForNodeData">setCategoryForNodeData</a></p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="nodeDataArray" class="tsd-anchor"></a>
<h3>
node<wbr>Data<wbr>Array
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">&gt;</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the array of node data objects that correspond to <a href="Node.html">Node</a>s,
<a href="Group.html">Group</a>s, or non-Link <a href="Part.html">Part</a>s in the <a href="Diagram.html">Diagram</a>.
The initial value is an empty Array.</p>
<p>For each Object in the Array, <a href="Model.html#getKeyForNodeData">getKeyForNodeData</a> should return a number or string
uniquely identifying the node data within the model.
If it returns undefined, this calls <a href="Model.html#makeNodeDataKeyUnique">makeNodeDataKeyUnique</a>,
to make sure the node data has a unique key.
These key values may be used by other objects to refer to that particular node data object.
If more than one node data object has the same key,
there may be some confusion about which object to reference.</p>
<p>If you want to use a custom data property for holding the unique key value on a node data object,
you should set <a href="Model.html#nodeKeyProperty">nodeKeyProperty</a> before you set this <code>nodeDataArray</code> property.</p>
<p>Adding or removing data from this Array will not notify this model or the diagram
that there are any new nodes or that any nodes have been deleted.
Instead you should call <a href="Model.html#addNodeData">addNodeData</a> or <a href="Model.html#removeNodeData">removeNodeData</a>.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="nodeKeyProperty" class="tsd-anchor"></a>
<h3>
node<wbr>Key<wbr>Property
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">a</span><span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">b</span><span class="tsd-signature-symbol">?: </span><a href="../index.html#Key" class="tsd-signature-type">Key</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../index.html#Key" class="tsd-signature-type">Key</a> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the name of the data property that returns a unique id number or string for each node data object.
The value may also be a function taking two arguments, where the first argument will be a node data object.
If the second argument is not supplied, the function should return the unique key value;
if the second argument is supplied, the function should modify the node data object so that it has that new value as its unique key value.
The default value is the name &#39;key&#39;, meaning that it expects the data to have a property named &#39;key&#39; if it has a key value.
The name must not be null or the empty string.
You must set this property before assigning the <a href="Model.html#nodeDataArray">nodeDataArray</a>.</p>
<p>If you want to set this property you must do so before using the model, and especially before you assign <a href="Diagram.html#model">Diagram.model</a>.
Note that functions cannot be serialized into JSON-formatted text, so if you are using <a href="Model.html#toJson">toJson</a> and <a href="Model.html#static-fromJson">Model.fromJson</a>,
and if you want this property to be a function, you will need to assign this property to your desired function
immediately after creating the model, including when it is created by <a href="Model.html#static-fromJson">Model.fromJson</a>.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#getKeyForNodeData">getKeyForNodeData</a></p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="skipsUndoManager" class="tsd-anchor"></a>
<h3>
skips<wbr>Undo<wbr>Manager
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets whether <a href="ChangedEvent.html">ChangedEvent</a>s are not recorded by the <a href="UndoManager.html">UndoManager</a>.
The initial and normal value is false.
WARNING: while this property is true do not perform any changes that cause any previous transactions
to become impossible to undo.</p>
<p>When this property is true, changing the Model or any data object does not call <a href="UndoManager.html#handleChanged">UndoManager.handleChanged</a>.
Even when this property is true,
transactions (such as calls to <a href="Model.html#startTransaction">startTransaction</a>) and undo/redo (such as calls to <a href="CommandHandler.html#undo">CommandHandler.undo</a>)
are still delegated to the <a href="Model.html#undoManager">undoManager</a>.</p>
<p>You should set this to true only temporarily, and you should remember its previous value before setting this to true.
When finishing the period for which you want the UndoManager to be disabled,
do not blindly set this property to false.
You should set this back to the value it had before you set it to true.
For more permanent disabling of the <a href="UndoManager.html">UndoManager</a>, set <a href="UndoManager.html#isEnabled">UndoManager.isEnabled</a> to false.</p>
<p>This property is also set when setting <a href="Diagram.html#skipsUndoManager">Diagram.skipsUndoManager</a>.
Setting this property does not raise a <a href="ChangedEvent.html">ChangedEvent</a>.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="undoManager" class="tsd-anchor"></a>
<h3>
undo<wbr>Manager
<span class="tsd-signature-symbol">: </span><a href="UndoManager.html" class="tsd-signature-type">UndoManager</a> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the <a href="UndoManager.html">UndoManager</a> for this Model.</p>
<p>The default UndoManager has its <a href="UndoManager.html#isEnabled">UndoManager.isEnabled</a> property set to false.
If you want users to undo and redo, you should set that property to true once you have initialized the Diagram or its Model.</p>
<p>This property setter does not raise a <a href="ChangedEvent.html">ChangedEvent</a>.</p>
</div>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="addArrayItem" class="tsd-anchor"></a>
<h3>
add<wbr>Array<wbr>Item
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">add<wbr>Array<wbr>Item<span class="tsd-signature-symbol">(</span>arr<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span>, val<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Add an item at the end of a data array that may be data bound by a <a href="Panel.html">Panel</a> as its <a href="Panel.html#itemArray">Panel.itemArray</a>,
in a manner that can be undone/redone and that automatically updates any bindings.</p>
<p>This also calls <a href="Model.html#raiseChangedEvent">raiseChangedEvent</a> to notify all listeners about the <a href="ChangedEvent.html#static-Insert">ChangedEvent.Insert</a>.</p>
<p>If you want to add a new node or part to the diagram, call <a href="Model.html#addNodeData">addNodeData</a>.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#insertArrayItem">insertArrayItem</a></p>
</dd>
<dt>since</dt>
<dd><p>1.1</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>arr: <span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h5>
<div class="tsd-comment tsd-typography">
<p>an Array that is the value of some <a href="Panel.html">Panel</a>&#39;s <a href="Panel.html#itemArray">Panel.itemArray</a>.</p>
</div>
</li>
<li>
<h5>val: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>the new value to be pushed onto the array.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="addChangedListener" class="tsd-anchor"></a>
<h3>
add<wbr>Changed<wbr>Listener
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">add<wbr>Changed<wbr>Listener<span class="tsd-signature-symbol">(</span>listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">e</span><span class="tsd-signature-symbol">: </span><a href="ChangedEvent.html" class="tsd-signature-type">ChangedEvent</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Register an event handler that is called when there is a ChangedEvent.</p>
<p>This registration does not raise a <a href="ChangedEvent.html">ChangedEvent</a>.
In case a Diagram&#39;s Model may be replaced, you may prefer calling <a href="Diagram.html#addModelChangedListener">Diagram.addModelChangedListener</a> instead of this method.</p>
<p>Event listeners are not written out by <a href="Model.html#toJson">toJson</a>.</p>
<p>Do not add or remove Changed listeners during the execution of a Changed listener.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#removeChangedListener">removeChangedListener</a>, <a href="Diagram.html#addModelChangedListener">Diagram.addModelChangedListener</a></p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>listener: <span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">e</span><span class="tsd-signature-symbol">: </span><a href="ChangedEvent.html" class="tsd-signature-type">ChangedEvent</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></h5>
<div class="tsd-comment tsd-typography">
<p>a function that takes a <a href="ChangedEvent.html">ChangedEvent</a> as its argument.</p>
</div>
<ul class="tsd-parameters">
</ul>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="addNodeData" class="tsd-anchor"></a>
<h3>
add<wbr>Node<wbr>Data
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">add<wbr>Node<wbr>Data<span class="tsd-signature-symbol">(</span>nodedata<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>When you want to add a node or group to the diagram,
call this method with a new data object.
This will add that data to the <a href="Model.html#nodeDataArray">nodeDataArray</a> and
notify all listeners that a new node data object has been inserted into the collection.</p>
<p>To remove a node from the diagram, you can remove its data object by calling <a href="Model.html#removeNodeData">removeNodeData</a>.</p>
<p>To add or remove an object or value from an item array, call <a href="Model.html#insertArrayItem">insertArrayItem</a> or <a href="Model.html#removeArrayItem">removeArrayItem</a>.</p>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>nodedata: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a JavaScript object represented by a node, group, or non-link.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="addNodeDataCollection" class="tsd-anchor"></a>
<h3>
add<wbr>Node<wbr>Data<wbr>Collection
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">add<wbr>Node<wbr>Data<wbr>Collection<span class="tsd-signature-symbol">(</span>coll<span class="tsd-signature-symbol">: </span><a href="Iterable.html" class="tsd-signature-type">Iterable</a><span class="tsd-signature-symbol">&lt;</span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Add to this model all of the node data held in an Array or in an <a href="Iterable.html">Iterable</a> of node data objects.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.3</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>coll: <a href="Iterable.html" class="tsd-signature-type">Iterable</a><span class="tsd-signature-symbol">&lt;</span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">&gt;</span></h5>
<div class="tsd-comment tsd-typography">
<p>a collection of node data objects to add to the <a href="Model.html#nodeDataArray">nodeDataArray</a></p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="applyIncrementalJson" class="tsd-anchor"></a>
<h3>
apply<wbr>Incremental<wbr>Json
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">apply<wbr>Incremental<wbr>Json<span class="tsd-signature-symbol">(</span>s<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Modify this model by applying the changes given in an &quot;incremental&quot; model change in JSON format
generated by <a href="Model.html#toIncrementalJson">toIncrementalJson</a>.
The expected properties of the argument are described at <a href="Model.html#toIncrementalJson">toIncrementalJson</a>.
Incremental changes must be applied in the same order that the changes occurred in the original model.</p>
<p>This requires the &quot;incremental&quot; property to be present and to be a number, as specified by <a href="Model.html#toIncrementalJson">toIncrementalJson</a>.
All of the top-level properties in the JSON, such as <a href="Model.html#nodeKeyProperty">nodeKeyProperty</a>, must be the same as for this model.
Note that if the model is a <a href="GraphLinksModel.html">GraphLinksModel</a>, you will have to have set <a href="GraphLinksModel.html#linkKeyProperty">GraphLinksModel.linkKeyProperty</a>
to the name of a property, the same both in the <a href="Diagram.html#model">Diagram.model</a> as well as in the data that you pass to this method.</p>
<p>This conducts a transaction.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.6</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>s: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a String in JSON format containing modifications to be performed to the model,
or a JavaScript Object parsed from such a string</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="clear" class="tsd-anchor"></a>
<h3>
clear
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">clear<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Clear out all references to any model data.
This also clears out the <a href="UndoManager.html">UndoManager</a>, so this operation is not undoable.
This method is called by <a href="Diagram.html#clear">Diagram.clear</a>; it does not notify any <a href="Diagram.html">Diagram</a>s or other listeners.
This method does not unregister any Changed event listeners.</p>
<p>Instead of calling this method, you may prefer to set <a href="Model.html#nodeDataArray">nodeDataArray</a> to an empty JavaScript Array.
If this model is a <a href="GraphLinksModel.html">GraphLinksModel</a>, you would also want to set <a href="GraphLinksModel.html#linkDataArray">GraphLinksModel.linkDataArray</a> to a separate empty JavaScript Array.</p>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected">
<a name="cloneProtected" class="tsd-anchor"></a>
<h3>
<span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-flag ts-flagVirtual">Virtual</span>
clone<wbr>Protected
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected">
<li class="tsd-signature tsd-kind-icon">clone<wbr>Protected<span class="tsd-signature-symbol">(</span>copy<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Copies properties from this model to the given model, which must be of the same class.
This is called by <a href="Model.html#copy">copy</a>.
This method may be overridden.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.6</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>copy: <span class="tsd-signature-type">this</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="commit" class="tsd-anchor"></a>
<h3>
commit
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">commit<span class="tsd-signature-symbol">(</span>func<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">m</span><span class="tsd-signature-symbol">: </span><a href="Model.html" class="tsd-signature-type">Model</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span>, tname<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Starts a new transaction, calls the provided function, and commits the transaction.
Code is called within a try-finally loop.
If the function does not return normally, this rolls back the transaction rather than committing it.
Example usage:</p>
<pre><code class="hljs js">model.commit(<span class="hljs-function"><span class="hljs-params">m</span> =&gt;</span> m.addNodeData({ <span class="hljs-attr">counter</span>: myCounter++ }), <span class="hljs-string">"Added Node"</span>);</code></pre>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.8</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>func: <span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">m</span><span class="tsd-signature-symbol">: </span><a href="Model.html" class="tsd-signature-type">Model</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></h5>
<div class="tsd-comment tsd-typography">
<p>the function to call as the transaction body</p>
</div>
<ul class="tsd-parameters">
</ul>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> tname: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></h5>
<div class="tsd-comment tsd-typography">
<p>a descriptive name for the transaction, or null to temporarily set <a href="Model.html#skipsUndoManager">skipsUndoManager</a> to true;
if no string transaction name is given, an empty string is used as the transaction name</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="commitTransaction" class="tsd-anchor"></a>
<h3>
commit<wbr>Transaction
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">commit<wbr>Transaction<span class="tsd-signature-symbol">(</span>tname<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Commit the changes of the current transaction.
This just calls <a href="UndoManager.html#commitTransaction">UndoManager.commitTransaction</a>.</p>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> tname: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>a descriptive name for the transaction.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
<p>the value returned by <a href="UndoManager.html#commitTransaction">UndoManager.commitTransaction</a>.</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="containsNodeData" class="tsd-anchor"></a>
<h3>
contains<wbr>Node<wbr>Data
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">contains<wbr>Node<wbr>Data<span class="tsd-signature-symbol">(</span>nodedata<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Decide if a given node data object is in this model, using reference equality.</p>
<p>If you do not have a reference to the particular data object that is in the <a href="Model.html#nodeDataArray">nodeDataArray</a>,
you may need to search for it by iterating through that Array,
or by finding the desired <a href="Node.html">Node</a> or simple <a href="Part.html">Part</a> in a <a href="Diagram.html">Diagram</a> and getting that node&#39;s <a href="Panel.html#data">Panel.data</a>,
or most likely by calling <a href="Model.html#findNodeDataForKey">findNodeDataForKey</a>.</p>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>nodedata: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a JavaScript object represented by a node, group, or non-link.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
<p>true if it is a node data object in this model; false otherwise.</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="copy" class="tsd-anchor"></a>
<h3>
<span class="tsd-flag ts-flagVirtual">Virtual</span>
copy
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">copy<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Model.html" class="tsd-signature-type">Model</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Creates a shallow copy of this Model and returns it.
<em>The data are not copied:</em> <a href="Model.html#nodeDataArray">nodeDataArray</a>, <a href="Model.html#modelData">modelData</a>,
<a href="GraphLinksModel.html#linkDataArray">GraphLinksModel.linkDataArray</a>, <a href="GraphLinksModel.html#archetypeNodeData">GraphLinksModel.archetypeNodeData</a> are left empty.
Nor are any Changed listeners or the UndoManager copied.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.6</p>
</dd>
</dl>
</div>
<h4 class="tsd-returns-title">Returns <a href="Model.html" class="tsd-signature-type">Model</a></h4>
<p>an empty copy of the model with the same properties, other than data</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="copyNodeData" class="tsd-anchor"></a>
<h3>
<span class="tsd-flag ts-flagVirtual">Virtual</span>
copy<wbr>Node<wbr>Data
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">copy<wbr>Node<wbr>Data<span class="tsd-signature-symbol">(</span>nodedata<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Make a copy of a node data object.
This uses the value of <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a> to actually perform the copy, unless that property is null.
When it is null the default behavior is to just make a shallow copy of the JavaScript Object.</p>
<p>However when <a href="Model.html#copiesArrays">copiesArrays</a> is true, this will make a copy of property values that are JavaScript Arrays.
This is useful when you do not want the Arrays to be shared between the node data objects.
Note that if you want to copy some property values that are Arrays but not other properties that are Arrays,
you cannot use <a href="Model.html#copiesArrays">copiesArrays</a> but must implement your own <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a>.</p>
<p>In addition when <a href="Model.html#copiesArrayObjects">copiesArrayObjects</a> is true, if items in the Array being copied are JavaScript Objects,
those objects are copied, recursively.
This is useful when the items in copied Arrays are themselves objects that need to be copied.
Note that if you want to share references to some but not all of the objects in copied Arrays you cannot use
<a href="Model.html#copiesArrayObjects">copiesArrayObjects</a> but must implement your own <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a>.</p>
<p>This does not modify the model -- the returned data object is not added to this model.
This assumes that the data&#39;s constructor can be called with no arguments.</p>
<p>Models should not have any references to Diagrams or GraphObjects or Tools or Layouts or other objects
that form a <a href="Diagram.html">Diagram</a>.</p>
<p>Warning: there should not be any cyclical references within the model data, unless you
either do not turn on <a href="Model.html#copiesArrays">copiesArrays</a> or <a href="Model.html#copiesArrayObjects">copiesArrayObjects</a> or unless you have
supplied your own <a href="Model.html#copyNodeDataFunction">copyNodeDataFunction</a> that can handle cyclical references.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#addNodeData">addNodeData</a></p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>nodedata: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a JavaScript object represented by a node, group, or non-link.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns
<a href="ObjectData.html" class="tsd-signature-type">ObjectData</a>
<span class="tsd-signature-symbol"> | </span>
<span class="tsd-signature-type">null</span>
</h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="findNodeDataForKey" class="tsd-anchor"></a>
<h3>
find<wbr>Node<wbr>Data<wbr>For<wbr>Key
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">find<wbr>Node<wbr>Data<wbr>For<wbr>Key<span class="tsd-signature-symbol">(</span>key<span class="tsd-signature-symbol">: </span><a href="../index.html#Key" class="tsd-signature-type">Key</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Given a number or string, find the node data object in this model
that uses the given value as its unique key.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#containsNodeData">containsNodeData</a>, <a href="Model.html#getKeyForNodeData">getKeyForNodeData</a></p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>key: <a href="../index.html#Key" class="tsd-signature-type">Key</a></h5>
<div class="tsd-comment tsd-typography">
<p>a string or a number.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns
<a href="ObjectData.html" class="tsd-signature-type">ObjectData</a>
<span class="tsd-signature-symbol"> | </span>
<span class="tsd-signature-type">null</span>
</h4>
<p>null if the key is not present in the model,
or if the key is null or undefined or not a string or number.</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
<a name="static-fromJson" class="tsd-anchor"></a>
<h3>
<span class="tsd-flag ts-flagStatic">Static</span>
from<wbr>Json
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
<li class="tsd-signature tsd-kind-icon">from<wbr>Json<span class="tsd-signature-symbol">(</span>s<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a>, model<span class="tsd-signature-symbol">?: </span><a href="Model.html" class="tsd-signature-type">Model</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Model.html" class="tsd-signature-type">Model</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>This static function parses a string in JSON format that was written by <a href="Model.html#toJson">Model.toJson</a>,
and then constructs, initializes, and returns a model with that information.</p>
<p>Note that properties with values that are functions are not written out by <a href="Model.html#toJson">toJson</a>,
so reading in such a model will require constructing such a model, initializing its functional property values,
and explicitly passing it in as the second argument.</p>
<p>As a special case when deserializing an object, if the property is named &quot;points&quot; and the
property value is an Array with an even number of numbers, it will substitute a <a href="List.html">List</a> of <a href="Point.html">Point</a>s.</p>
<p>Typical usage:</p>
<pre><code class="hljs js"><span class="hljs-keyword">var</span> modelAsText = ...; <span class="hljs-comment">// fetch the model in textual format from a database</span>
myDiagram.model = go.Model.fromJson(modelAsText);</code></pre>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>s: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a String in JSON format containing all of the persistent properties of the model, or an Object already read from JSON text.</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> model: <a href="Model.html" class="tsd-signature-type">Model</a></h5>
<div class="tsd-comment tsd-typography">
<p>an optional model to be modified; if not supplied, it constructs and returns a new model whose name is specified by the &quot;class&quot; property.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="Model.html" class="tsd-signature-type">Model</a></h4>
<p>the supplied or created model loaded with data from the given string.</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getCategoryForNodeData" class="tsd-anchor"></a>
<h3>
get<wbr>Category<wbr>For<wbr>Node<wbr>Data
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>Category<wbr>For<wbr>Node<wbr>Data<span class="tsd-signature-symbol">(</span>nodedata<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Find the category of a given node data, a string naming the node template
or group template or part template
that the <a href="Diagram.html">Diagram</a> should use to represent the node data.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#nodeCategoryProperty">nodeCategoryProperty</a>, <a href="Model.html#setCategoryForNodeData">setCategoryForNodeData</a></p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>nodedata: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a JavaScript object represented by a node, group, or non-link.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="getKeyForNodeData" class="tsd-anchor"></a>
<h3>
get<wbr>Key<wbr>For<wbr>Node<wbr>Data
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">get<wbr>Key<wbr>For<wbr>Node<wbr>Data<span class="tsd-signature-symbol">(</span>nodedata<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../index.html#Key" class="tsd-signature-type">Key</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Given a node data object return its unique key: a number or a string.
This returns undefined if there is no key value.</p>
<p>It is possible to change the key for a node data object by calling <a href="Model.html#setKeyForNodeData">setKeyForNodeData</a>.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#nodeKeyProperty">nodeKeyProperty</a>, <a href="Model.html#setKeyForNodeData">setKeyForNodeData</a>, <a href="Model.html#findNodeDataForKey">findNodeDataForKey</a></p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>nodedata: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a JavaScript object represented by a node, group, or non-link.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="../index.html#Key" class="tsd-signature-type">Key</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="insertArrayItem" class="tsd-anchor"></a>
<h3>
insert<wbr>Array<wbr>Item
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">insert<wbr>Array<wbr>Item<span class="tsd-signature-symbol">(</span>arr<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span>, idx<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, val<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Add an item to a data array that may be data bound by a <a href="Panel.html">Panel</a> as its <a href="Panel.html#itemArray">Panel.itemArray</a>,
given a new data value and the index at which to insert the new value, in a manner that can be undone/redone and that automatically updates any bindings.</p>
<p>This also calls <a href="Model.html#raiseChangedEvent">raiseChangedEvent</a> to notify all listeners about the <a href="ChangedEvent.html#static-Insert">ChangedEvent.Insert</a>.</p>
<p>If you want to add a new node or part to the diagram, call <a href="Model.html#addNodeData">addNodeData</a>.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#removeArrayItem">removeArrayItem</a></p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>arr: <span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h5>
<div class="tsd-comment tsd-typography">
<p>an Array that is the value of some <a href="Panel.html">Panel</a>&#39;s <a href="Panel.html#itemArray">Panel.itemArray</a>.</p>
</div>
</li>
<li>
<h5>idx: <span class="tsd-signature-type">number</span></h5>
<div class="tsd-comment tsd-typography">
<p>the zero-based array index where the new value will be inserted; use -1 to push the new value on the end of the array.</p>
</div>
</li>
<li>
<h5>val: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>the new value to be inserted into the array.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="makeNodeDataKeyUnique" class="tsd-anchor"></a>
<h3>
make<wbr>Node<wbr>Data<wbr>Key<wbr>Unique
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">make<wbr>Node<wbr>Data<wbr>Key<wbr>Unique<span class="tsd-signature-symbol">(</span>nodedata<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>This method is called when a node data object is added to the model to make sure that
<a href="Model.html#getKeyForNodeData">getKeyForNodeData</a> returns a unique key value.</p>
<p>The key value should be unique within the set of data managed by this model:
<a href="Model.html#nodeDataArray">nodeDataArray</a>.
If the key is already in use, this will assign an unused number to the
<a href="Model.html#nodeKeyProperty">nodeKeyProperty</a> property on the data.</p>
<p>If you want to customize the way in which node data gets a unique key,
you can set the <a href="Model.html#makeUniqueKeyFunction">makeUniqueKeyFunction</a> functional property.</p>
<p>If the node data object is already in the model and you want to change its key value,
call <a href="Model.html#setKeyForNodeData">setKeyForNodeData</a> and give it a new unique key value.</p>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>nodedata: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a JavaScript object represented by a node, group, or non-link.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="raiseChangedEvent" class="tsd-anchor"></a>
<h3>
raise<wbr>Changed<wbr>Event
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">raise<wbr>Changed<wbr>Event<span class="tsd-signature-symbol">(</span>change<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EnumValue</span>, propertyname<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">obj</span><span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">val</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, obj<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a>, oldval<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, newval<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, oldparam<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span>, newparam<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Call this method to notify that the model or its objects have changed.
This constructs a <a href="ChangedEvent.html">ChangedEvent</a> and calls all Changed listeners.</p>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>change: <span class="tsd-signature-type">EnumValue</span></h5>
<div class="tsd-comment tsd-typography">
<p>specifies the general nature of the change; typically the value is <a href="ChangedEvent.html#static-Property">ChangedEvent.Property</a>.</p>
</div>
</li>
<li>
<h5>propertyname: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">obj</span><span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">val</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>names the property that was modified, or a function that takes an Object and returns the property value.</p>
</div>
</li>
<li>
<h5>obj: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>the object that was modified, typically a <a href="GraphObject.html">GraphObject</a>, <a href="Diagram.html">Diagram</a>, or a <a href="Model.html">Model</a>.</p>
</div>
</li>
<li>
<h5>oldval: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>the previous or older value.</p>
</div>
</li>
<li>
<h5>newval: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>the next or newer value.</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> oldparam: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>an optional value that helps describe the older value.</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> newparam: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>an optional value that helps describe the newer value.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="raiseDataChanged" class="tsd-anchor"></a>
<h3>
raise<wbr>Data<wbr>Changed
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">raise<wbr>Data<wbr>Changed<span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a>, propertyname<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">obj</span><span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">val</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, oldval<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, newval<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, oldparam<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span>, newparam<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Call this method to notify about a data property having changed value.
This constructs a <a href="ChangedEvent.html">ChangedEvent</a> and calls all Changed listeners.</p>
<p>You should call this method only if the property value actually changed.
This method is called by <a href="Model.html#setDataProperty">setDataProperty</a>.</p>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>data: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>the data object whose property changed value.</p>
</div>
</li>
<li>
<h5>propertyname: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">obj</span><span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">val</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>the name of the property, or a function that takes an Object and returns the property value.</p>
</div>
</li>
<li>
<h5>oldval: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>the previous or old value for the property.</p>
</div>
</li>
<li>
<h5>newval: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>the next or new value for the property.</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> oldparam: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>an optional value additionally describing the old value.</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> newparam: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>an optional value additionally describing the new value.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="removeArrayItem" class="tsd-anchor"></a>
<h3>
remove<wbr>Array<wbr>Item
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">remove<wbr>Array<wbr>Item<span class="tsd-signature-symbol">(</span>arr<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span>, idx<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Remove an item from a data array that may be data bound by a <a href="Panel.html">Panel</a> as its <a href="Panel.html#itemArray">Panel.itemArray</a>,
given the index at which to remove a data value, in a manner that can be undone/redone and that automatically updates any bindings.</p>
<p>This also calls <a href="Model.html#raiseChangedEvent">raiseChangedEvent</a> to notify all listeners about the <a href="ChangedEvent.html#static-Remove">ChangedEvent.Remove</a>.</p>
<p>If you want to remove a node from the diagram, call <a href="Model.html#removeNodeData">removeNodeData</a>.</p>
<p>Note that there is no version of this method that takes an item value instead of an index into the array.
Because item arrays may hold any JavaScript value, including numbers and strings, there may be duplicate entries with that value in the array.
To avoid ambiguity, removing an item from an array requires an index.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#insertArrayItem">insertArrayItem</a></p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>arr: <span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h5>
<div class="tsd-comment tsd-typography">
<p>an Array that is the value of some <a href="Panel.html">Panel</a>&#39;s <a href="Panel.html#itemArray">Panel.itemArray</a>.</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> idx: <span class="tsd-signature-type">number</span></h5>
<div class="tsd-comment tsd-typography">
<p>the zero-based array index of the data item to be removed from the array;
if not supplied it will remove the last item of the array.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="removeChangedListener" class="tsd-anchor"></a>
<h3>
remove<wbr>Changed<wbr>Listener
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">remove<wbr>Changed<wbr>Listener<span class="tsd-signature-symbol">(</span>listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">e</span><span class="tsd-signature-symbol">: </span><a href="ChangedEvent.html" class="tsd-signature-type">ChangedEvent</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Unregister an event handler listener.</p>
<p>This deregistration does not raise a <a href="ChangedEvent.html">ChangedEvent</a>.
In case a Diagram&#39;s Model may be replaced, you may prefer calling <a href="Diagram.html#removeModelChangedListener">Diagram.removeModelChangedListener</a> instead of this method.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#addChangedListener">addChangedListener</a>, <a href="Diagram.html#removeModelChangedListener">Diagram.removeModelChangedListener</a></p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>listener: <span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">e</span><span class="tsd-signature-symbol">: </span><a href="ChangedEvent.html" class="tsd-signature-type">ChangedEvent</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></h5>
<div class="tsd-comment tsd-typography">
<p>a function that takes a <a href="ChangedEvent.html">ChangedEvent</a> as its argument.</p>
</div>
<ul class="tsd-parameters">
</ul>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="removeNodeData" class="tsd-anchor"></a>
<h3>
remove<wbr>Node<wbr>Data
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">remove<wbr>Node<wbr>Data<span class="tsd-signature-symbol">(</span>nodedata<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>When you want to remove a node or group from the diagram,
call this method with an existing data object.
This will remove that data from the <a href="Model.html#nodeDataArray">nodeDataArray</a> and
notify all listeners that a node data object has been removed from the collection.</p>
<p>If you do not have a reference to the particular data object that is in the <a href="Model.html#nodeDataArray">nodeDataArray</a>,
you may need to search for it by iterating through that Array,
or by finding the desired <a href="Node.html">Node</a> or simple <a href="Part.html">Part</a> in a <a href="Diagram.html">Diagram</a> and getting that node&#39;s <a href="Panel.html#data">Panel.data</a>,
or most likely by calling <a href="Model.html#findNodeDataForKey">findNodeDataForKey</a>.</p>
<p>Removing a node data from a model does not automatically remove
any connected link data from the model.
Removing a node data that represents a group does not automatically remove
any member node data or link data from the model.</p>
<p>To add a node to the diagram, you can add its data object by calling <a href="Model.html#addNodeData">addNodeData</a>.</p>
<p>To add or remove an object or value from an item array, call <a href="Model.html#insertArrayItem">insertArrayItem</a> or <a href="Model.html#removeArrayItem">removeArrayItem</a>.</p>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>nodedata: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a JavaScript object represented by a node, group, or non-link.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="removeNodeDataCollection" class="tsd-anchor"></a>
<h3>
remove<wbr>Node<wbr>Data<wbr>Collection
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">remove<wbr>Node<wbr>Data<wbr>Collection<span class="tsd-signature-symbol">(</span>coll<span class="tsd-signature-symbol">: </span><a href="Iterable.html" class="tsd-signature-type">Iterable</a><span class="tsd-signature-symbol">&lt;</span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Remove from this model all of the node data held in an Array or in an <a href="Iterable.html">Iterable</a> of node data objects.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.3</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>coll: <a href="Iterable.html" class="tsd-signature-type">Iterable</a><span class="tsd-signature-symbol">&lt;</span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol">&lt;</span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a><span class="tsd-signature-symbol">&gt;</span></h5>
<div class="tsd-comment tsd-typography">
<p>a collection of node data objects to remove from the <a href="Model.html#nodeDataArray">nodeDataArray</a></p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="rollbackTransaction" class="tsd-anchor"></a>
<h3>
rollback<wbr>Transaction
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">rollback<wbr>Transaction<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Rollback the current transaction, undoing any recorded changes.
This just calls <a href="UndoManager.html#rollbackTransaction">UndoManager.rollbackTransaction</a>.</p>
</div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
<p>the value returned by <a href="UndoManager.html#rollbackTransaction">UndoManager.rollbackTransaction</a>.</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="set" class="tsd-anchor"></a>
<h3>
set
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">set<span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a>, propname<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, val<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>A synonym for <a href="Model.html#setDataProperty">setDataProperty</a></p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#setDataProperty">setDataProperty</a></p>
</dd>
<dt>since</dt>
<dd><p>1.8</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>data: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a JavaScript object typically the value of a <a href="Panel.html#data">Panel.data</a> and represented by a Node, Link, Group, simple Part,
or item in a <a href="Panel.html#itemArray">Panel.itemArray</a>; or this model&#39;s <a href="Model.html#modelData">modelData</a>.</p>
</div>
</li>
<li>
<h5>propname: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>a string that is not null or the empty string.</p>
</div>
</li>
<li>
<h5>val: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>the new value for the property.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="setCategoryForNodeData" class="tsd-anchor"></a>
<h3>
set<wbr>Category<wbr>For<wbr>Node<wbr>Data
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">set<wbr>Category<wbr>For<wbr>Node<wbr>Data<span class="tsd-signature-symbol">(</span>nodedata<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a>, cat<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Change the category of a given node data, a string naming the node template
or group template or part template
that the <a href="Diagram.html">Diagram</a> should use to represent the node data.</p>
<p>Changing the node template for a node data will cause the existing <a href="Node.html">Node</a>, <a href="Group.html">Group</a>, or <a href="Part.html">Part</a>
to be replaced with a new instance of the same class
created by copying the new node template and applying any data-bindings.
That means that the templates in the <a href="Diagram.html#nodeTemplateMap">Diagram.nodeTemplateMap</a> or <a href="Diagram.html#groupTemplateMap">Diagram.groupTemplateMap</a>
must be instances of the same class -- one cannot convert a <a href="Node.html">Node</a> into a <a href="Group.html">Group</a> or vice-versa
by setting the category.</p>
<p>Binding sources should not be (or depend in a conversion function on) the category of the data
if you might be modifying the category, because then some bindings might be evaluated
before or after the category has been changed.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#nodeCategoryProperty">nodeCategoryProperty</a>, <a href="Model.html#getCategoryForNodeData">getCategoryForNodeData</a></p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>nodedata: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a JavaScript object represented by a node, group, or non-link.</p>
</div>
</li>
<li>
<h5>cat: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>Must not be null.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="setDataProperty" class="tsd-anchor"></a>
<h3>
<span class="tsd-flag ts-flagVirtual">Virtual</span>
set<wbr>Data<wbr>Property
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">set<wbr>Data<wbr>Property<span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a>, propname<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, val<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Change the value of some property of a node data, a link data, an item data, or the <a href="Model.html#modelData">Model.modelData</a>,
given a string naming the property and the new value,
in a manner that can be undone/redone and that automatically updates any bindings.</p>
<p>This gets the old value of the property; if the value is the same as the new value, no side-effects occur.
This calls <a href="Model.html#raiseDataChanged">raiseDataChanged</a> to notify about the change.</p>
<p>Note that it is insufficient to modify an item Array (for example by pushing a new item onto the Array) and
then calling <code>setDataProperty(data, &quot;items&quot;, data.items)</code> because the value of
<code>data.items</code> is still the same reference.
Instead you will want to call <a href="Model.html#insertArrayItem">insertArrayItem</a>, <a href="Model.html#addArrayItem">addArrayItem</a>, or <a href="Model.html#removeArrayItem">removeArrayItem</a>.</p>
<p>If you modify the property that is the <a href="Model.html#nodeKeyProperty">nodeKeyProperty</a>, this will call <a href="Model.html#setKeyForNodeData">setKeyForNodeData</a>.</p>
<p>If you modify the property that is the <a href="Model.html#nodeCategoryProperty">nodeCategoryProperty</a> or the <a href="GraphLinksModel.html#linkCategoryProperty">GraphLinksModel.linkCategoryProperty</a>,
this will call <a href="Model.html#setCategoryForNodeData">setCategoryForNodeData</a> or <a href="GraphLinksModel.html#setCategoryForLinkData">GraphLinksModel.setCategoryForLinkData</a>.
But if the category might change, <a href="Binding.html">Binding</a> sources should not be (or depend in a conversion function on) the category of the data,
because then some bindings might be evaluated before or after the category has been changed.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#set">set</a></p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>data: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a JavaScript object typically the value of a <a href="Panel.html#data">Panel.data</a> and represented by a Node, Link, Group, simple Part,
or item in a <a href="Panel.html#itemArray">Panel.itemArray</a>; or this model&#39;s <a href="Model.html#modelData">modelData</a>.</p>
</div>
</li>
<li>
<h5>propname: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>a string that is not null or the empty string.</p>
</div>
</li>
<li>
<h5>val: <span class="tsd-signature-type">any</span></h5>
<div class="tsd-comment tsd-typography">
<p>the new value for the property.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="setKeyForNodeData" class="tsd-anchor"></a>
<h3>
set<wbr>Key<wbr>For<wbr>Node<wbr>Data
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">set<wbr>Key<wbr>For<wbr>Node<wbr>Data<span class="tsd-signature-symbol">(</span>nodedata<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a>, key<span class="tsd-signature-symbol">: </span><a href="../index.html#Key" class="tsd-signature-type">Key</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Change the unique key of a given node data that is already in this model.
The new key value must be unique -- i.e. not in use by another node data object.
You can call <a href="Model.html#findNodeDataForKey">findNodeDataForKey</a> to check if a proposed new key is already in use.</p>
<p>This operation will check all data objects in the model and replace all references
using the old key value with the new one.</p>
<p>If this is called on a node data object that is not (yet) in this model,
this unconditionally modifies the property to the new key value.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#nodeKeyProperty">nodeKeyProperty</a>, <a href="Model.html#getKeyForNodeData">getKeyForNodeData</a></p>
</dd>
<dt>since</dt>
<dd><p>1.1</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>nodedata: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>a JavaScript object represented by a node, group, or non-link.</p>
</div>
</li>
<li>
<h5>key: <a href="../index.html#Key" class="tsd-signature-type">Key</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="startTransaction" class="tsd-anchor"></a>
<h3>
start<wbr>Transaction
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">start<wbr>Transaction<span class="tsd-signature-symbol">(</span>tname<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Begin a transaction, where the changes are held by a <a href="Transaction.html">Transaction</a> object
in the <a href="UndoManager.html">UndoManager</a>.
This just calls <a href="UndoManager.html#startTransaction">UndoManager.startTransaction</a>.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="Model.html#commit">commit</a></p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> tname: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>a descriptive name for the transaction.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
<p>the value returned by <a href="UndoManager.html#startTransaction">UndoManager.startTransaction</a>.</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="toIncrementalJson" class="tsd-anchor"></a>
<h3>
to<wbr>Incremental<wbr>Json
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">to<wbr>Incremental<wbr>Json<span class="tsd-signature-symbol">(</span>e<span class="tsd-signature-symbol">: </span><a href="ChangedEvent.html" class="tsd-signature-type">ChangedEvent</a>, classname<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Produce a JSON-format string representing the changes in the most recent <a href="Transaction.html">Transaction</a>.
This writes out JSON for a model, but recording only changes in the given Transaction,
with the addition of the &quot;incremental&quot; property to mark it as different from a complete model.
Instead of the &quot;nodeDataArray&quot; property (and &quot;linkDataArray&quot; property for <a href="GraphLinksModel.html">GraphLinksModel</a>s),
this will have &quot;inserted...&quot;, &quot;modified...&quot;, and &quot;removed...&quot; properties that are non-empty Arrays.</p>
<p>The &quot;modifiedNodeData&quot; Array holds JavaScript objects.
The &quot;insertedNodeKeys&quot; and &quot;removedNodeKeys&quot; Arrays hold keys (numbers or strings) of data,
not whole objects, that have been added and/or deleted.
The &quot;modelData&quot; property holds the <a href="Model.html#modelData">Model.modelData</a> object, if it was modified.</p>
<p>Note that it is entirely plausible for the same object be in or referenced by all three Arrays,
because a single <a href="Transaction.html">Transaction</a> can include adding a node, modifying it, and removing it.</p>
<p>The purpose of this method is to make it easier to send incremental changes to the server/database,
instead of sending the whole model.
Whereas it has always been easy to perform &quot;batch&quot; updates or &quot;file saves&quot;:</p>
<pre><code class="hljs js"> myDiagram.addModelChangedListener(<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">e</span>) </span>{
<span class="hljs-keyword">if</span> (e.isTransactionFinished) {
<span class="hljs-keyword">var</span> json = e.model.toJson();
<span class="hljs-comment">// save the whole model upon each transaction completion or undo/redo</span>
... send to server/database ...
}
});</code></pre>
<p>You can now easily send &quot;incremental&quot; updates:</p>
<pre><code class="hljs js"> myDiagram.addModelChangedListener(<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">e</span>) </span>{
<span class="hljs-keyword">if</span> (e.isTransactionFinished) {
<span class="hljs-keyword">var</span> json = e.model.toIncrementalJson(e);
<span class="hljs-comment">// record each Transaction as a JSON-format string</span>
... send to server/database ...
}
});</code></pre>
<p>Note that these incremental changes include the results of undo and redo operations.
Also, when you might call <a href="Model.html#applyIncrementalJson">applyIncrementalJson</a>, you will need to disable your Changed listener,
so that it does not send spurious changes to your database during the process of apply incremental changes from the database.</p>
<p>For <a href="GraphLinksModel.html">GraphLinksModel</a>s, this method requires that <a href="GraphLinksModel.html#linkKeyProperty">GraphLinksModel.linkKeyProperty</a> is not an empty string.
The incremental JSON for GraphLinksModels will include &quot;modifiedLinkData&quot;, &quot;insertedLinkKeys&quot;, and &quot;removedLinkKeys&quot;
properties that are non-empty Arrays.</p>
<p>The same restrictions on data property names and data property values applies to this method as it does to <a href="Model.html#toJson">toJson</a>.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.6</p>
</dd>
</dl>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>e: <a href="ChangedEvent.html" class="tsd-signature-type">ChangedEvent</a></h5>
<div class="tsd-comment tsd-typography">
<p>a Transaction ChangedEvent for which <a href="ChangedEvent.html#isTransactionFinished">ChangedEvent.isTransactionFinished</a> is true</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> classname: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>for the written model, defaults to the name of the class of the model</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="toJson" class="tsd-anchor"></a>
<h3>
to<wbr>Json
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">to<wbr>Json<span class="tsd-signature-symbol">(</span>classname<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Generate a string representation of the persistent data in this model, in JSON format,
that can be read in later with a call to <a href="Model.html#static-fromJson">Model.fromJson</a>.</p>
<p>Object properties that are not enumerable or whose names start with &quot;_&quot; are not written out.</p>
<p>Functions are not able to be written in JSON format, so any properties that have function values
will not be saved in the JSON string.</p>
<p>There must not be any circular references within the model data.
Any sharing of object references will be lost in the written JSON.</p>
<p>Most object classes cannot be serialized into JSON without special knowledge and processing at both ends.
The <a href="Model.html#toJson">toJson</a> and <a href="Model.html#static-fromJson">Model.fromJson</a> methods automatically do such processing for numbers that are NaN
and for objects that are of class <a href="Point.html">Point</a>, <a href="Size.html">Size</a>, <a href="Rect.html">Rect</a>, <a href="Margin.html">Margin</a>, <a href="Spot.html">Spot</a>,
<a href="Brush.html">Brush</a> (but not for brush patterns), and for <a href="Geometry.html">Geometry</a>.
However, we recommend that you use Binding converters (static functions named &quot;parse&quot; and &quot;stringify&quot;)
to represent Points, Sizes, Rects, Margins, Spots, and Geometries as string values in your data, rather than as Objects.
This makes the JSON text smaller and simpler and easier to read.</p>
<p>As a special case when serializing an object, if the property is named &quot;points&quot; and the
property value is a <a href="List.html">List</a> of <a href="Point.html">Point</a>s, it will write an Array of numbers.</p>
<p>Note that this is a method on the <a href="Model.html">Model</a> class.
It cannot render unmodeled Parts such as the background grid or any Parts that you have added directly to a Diagram.</p>
<p>Typical usage:</p>
<pre><code class="hljs js"><span class="hljs-keyword">var</span> modelAsText = myDiagram.model.toJson();
<span class="hljs-comment">// now save this text string by sending it to your database</span></code></pre>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> classname: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The optional name of the model class to use in the output;
for the standard models, this is their class name prefixed with &quot;go.&quot;.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
<p>a String in JSON format containing all of the persistent properties of the model.</p>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
<a name="updateTargetBindings" class="tsd-anchor"></a>
<h3>
update<wbr>Target<wbr>Bindings
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">update<wbr>Target<wbr>Bindings<span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><a href="ObjectData.html" class="tsd-signature-type">ObjectData</a>, srcpropname<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Find a <a href="Part.html">Part</a> corresponding to the given data and
call its <a href="Panel.html#updateTargetBindings">Panel.updateTargetBindings</a> method, in each <a href="Diagram.html">Diagram</a>
that uses this Model.</p>
<p>Caution: setting a data property without calling <a href="Model.html#setDataProperty">setDataProperty</a>
and then calling this updateTargetBindings method will update GraphObjects that are bound to the property,
but such data settings will not be recorded in the UndoManager and therefore will not be undone/redone,
causing an inconsistency between the GraphObjects and the part data.</p>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>data: <a href="ObjectData.html" class="tsd-signature-type">ObjectData</a></h5>
<div class="tsd-comment tsd-typography">
<p>The data object in this model that was modified.</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> srcpropname: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>If not present or the empty string,
update all bindings on the target <a href="Part.html">Part</a> or item <a href="Panel.html">Panel</a>
otherwise update only those bindings using this source property name.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals ">
<a href="../index.html"><em>GoJS <wbr>Class <wbr>Index</em></a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
</ul>
<ul class="current">
<li class="current tsd-kind-class">
<a href="Model.html" class="tsd-kind-icon">Model</a>
<ul>
<li class=" tsd-kind-constructor tsd-parent-kind-class">
<a href="Model.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#copiesArrayObjects" class="tsd-kind-icon">copies<wbr>Array<wbr>Objects</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#copiesArrays" class="tsd-kind-icon">copies<wbr>Arrays</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#copiesKey" class="tsd-kind-icon">copies<wbr>Key</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#copyNodeDataFunction" class="tsd-kind-icon">copy<wbr>Node<wbr>Data<wbr>Function</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#dataFormat" class="tsd-kind-icon">data<wbr>Format</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#isReadOnly" class="tsd-kind-icon">is<wbr>Read<wbr>Only</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#makeUniqueKeyFunction" class="tsd-kind-icon">make<wbr>Unique<wbr>Key<wbr>Function</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#modelData" class="tsd-kind-icon">model<wbr>Data</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#name" class="tsd-kind-icon">name</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#nodeCategoryProperty" class="tsd-kind-icon">node<wbr>Category<wbr>Property</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#nodeDataArray" class="tsd-kind-icon">node<wbr>Data<wbr>Array</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#nodeKeyProperty" class="tsd-kind-icon">node<wbr>Key<wbr>Property</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#skipsUndoManager" class="tsd-kind-icon">skips<wbr>Undo<wbr>Manager</a>
</li>
<li class=" tsd-kind-accessor tsd-parent-kind-class">
<a href="Model.html#undoManager" class="tsd-kind-icon">undo<wbr>Manager</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#addArrayItem" class="tsd-kind-icon">add<wbr>Array<wbr>Item</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#addChangedListener" class="tsd-kind-icon">add<wbr>Changed<wbr>Listener</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#addNodeData" class="tsd-kind-icon">add<wbr>Node<wbr>Data</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#addNodeDataCollection" class="tsd-kind-icon">add<wbr>Node<wbr>Data<wbr>Collection</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#applyIncrementalJson" class="tsd-kind-icon">apply<wbr>Incremental<wbr>Json</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#clear" class="tsd-kind-icon">clear</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-protected">
<a href="Model.html#cloneProtected" class="tsd-kind-icon">clone<wbr>Protected</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#commit" class="tsd-kind-icon">commit</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#commitTransaction" class="tsd-kind-icon">commit<wbr>Transaction</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#containsNodeData" class="tsd-kind-icon">contains<wbr>Node<wbr>Data</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#copy" class="tsd-kind-icon">copy</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#copyNodeData" class="tsd-kind-icon">copy<wbr>Node<wbr>Data</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#findNodeDataForKey" class="tsd-kind-icon">find<wbr>Node<wbr>Data<wbr>For<wbr>Key</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class tsd-is-static">
<a href="Model.html#static-fromJson" class="tsd-kind-icon">from<wbr>Json</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#getCategoryForNodeData" class="tsd-kind-icon">get<wbr>Category<wbr>For<wbr>Node<wbr>Data</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#getKeyForNodeData" class="tsd-kind-icon">get<wbr>Key<wbr>For<wbr>Node<wbr>Data</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#insertArrayItem" class="tsd-kind-icon">insert<wbr>Array<wbr>Item</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#makeNodeDataKeyUnique" class="tsd-kind-icon">make<wbr>Node<wbr>Data<wbr>Key<wbr>Unique</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#raiseChangedEvent" class="tsd-kind-icon">raise<wbr>Changed<wbr>Event</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#raiseDataChanged" class="tsd-kind-icon">raise<wbr>Data<wbr>Changed</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#removeArrayItem" class="tsd-kind-icon">remove<wbr>Array<wbr>Item</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#removeChangedListener" class="tsd-kind-icon">remove<wbr>Changed<wbr>Listener</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#removeNodeData" class="tsd-kind-icon">remove<wbr>Node<wbr>Data</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#removeNodeDataCollection" class="tsd-kind-icon">remove<wbr>Node<wbr>Data<wbr>Collection</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#rollbackTransaction" class="tsd-kind-icon">rollback<wbr>Transaction</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#set" class="tsd-kind-icon">set</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#setCategoryForNodeData" class="tsd-kind-icon">set<wbr>Category<wbr>For<wbr>Node<wbr>Data</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#setDataProperty" class="tsd-kind-icon">set<wbr>Data<wbr>Property</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#setKeyForNodeData" class="tsd-kind-icon">set<wbr>Key<wbr>For<wbr>Node<wbr>Data</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#startTransaction" class="tsd-kind-icon">start<wbr>Transaction</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#toIncrementalJson" class="tsd-kind-icon">to<wbr>Incremental<wbr>Json</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#toJson" class="tsd-kind-icon">to<wbr>Json</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="Model.html#updateTargetBindings" class="tsd-kind-icon">update<wbr>Target<wbr>Bindings</a>
</li>
</ul>
</li>
</ul>
<ul class="after-current">
</ul>
</nav>
</div>
</div>
</div>
<div class="container-fluid bottom-copyright plr15">
Copyright &copy; 1998-2019 by Northwoods Software Corporation.
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
<script src="../../assets/js/api.js"></script>
<script src="../../assets/js/bootstrap.min.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-1506307-5', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>