GraphLinksModel class
GraphLinksModels support links between nodes and grouping nodes and links into subgraphs. GraphLinksModels hold node data and link data in separate arrays. Node data is normally represented in a Diagram by instances of Node, but they could be represented by simple Parts or by Groups. Link data should be represented by instances of Link.
Each link data object is assumed to have two values, one referring to the node that the link is coming from and one that the link is going to. The #linkFromKeyProperty property names the property on the link data whose value is the key of the "from" node. The #linkToKeyProperty property names the property on the link data whose value is the key of the "to" node. The default values for these properties are "from" and "to" respectively.
For example, one can define a graph consisting of two nodes with one link connecting them:
model.nodeDataArray = [
{ key: "Alpha" },
{ key: "Beta" }
];
model.linkDataArray = [
{ from: "Alpha", to: "Beta" }
];
If you want to have subgraphs in your diagram, where a group node contains some number of nodes and links, you need to declare that some node data actually represent groups, and you need to provide a reference from a member node data to its containing group node data. The #nodeIsGroupProperty property names the property on a node data that is true if that node data represents a group. The #nodeGroupKeyProperty property names the property on a node data whose value is the key of the containing group's node data. The default values for these properties are "isGroup" and "group" respectively.
For example, one can define a graph consisting of one group containing a subgraph of two nodes connected by a link, with a second link from that group to a third node that is not a member of that group:
model.nodeDataArray = [
{ key: "Group1", isGroup: true},
{ key: "Alpha", group: "Group1" },
{ key: "Beta", group: "Group1" },
{ key: "Gamma" }
];
model.linkDataArray = [
{ from: "Alpha", to: "Beta" },
{ from: "Group1", to: "Gamma" }
];
GraphLinksModels also support distinguishing the "port" element of a node to which a link can connect, at either end of the link. This identification is a string that names the "port" element in the node. However, you need to set the #linkFromPortIdProperty and/or #linkToPortIdProperty properties before the model is able to get the "port id" information from the link data.
For example, one can define a graph consisting of a "subtraction" node and two inputs and one output. The "subtraction" node has two distinct inputs called "subtrahend" and "minuend"; the output is called "difference".
model.linkFromPortIdProperty = "fromPort"; // necessary to remember portIds
model.linkToPortIdProperty = "toPort";
model.nodeDataArray = [
{ key: 1, constant: 5 }, // a constant input node
{ key: 2, constant: 2 }, // another constant node
{ key: 3, operation: "subtract" },
{ key: 4, value: 3 } // the output node
];
model.linkDataArray = [
{ from: 1, to: 3, toPort: "subtrahend" },
{ from: 2, to: 3, toPort: "minuend" },
{ from: 3, to: 4, fromPort: "difference" }
];
In this case links connected to node 3 (which is the subtraction operation) are distinguished by port id. The connections to the other nodes do not have any port identification, presumably because there is only one port on those nodes, representing the node value.
Note that there is no requirement that the link data objects have any kind of unique identifier, unlike for node data. There is no expectation that there be references to link data in the model, so there is no need for such an identifier. When there are multiple links connecting two ports, the only way to distinguish the links in the model is by reference to the particular link data object. This is why there are two methods on the Diagram class for Nodes, Diagram#findNodeForKey and Diagram#findNodeForData, but there is only the one method for Links, Diagram#findLinkForData.
However you may wish to have the model maintain string or number identifiers on the link data just as all models do for node data. To get that behavior, so that you can call #findLinkDataForKey, you need to set #linkKeyProperty to be a non-empty string. Just as with the assignment of node keys, you can customize the assignment of link keys by setting #makeUniqueLinkKeyFunction to a function that returns a unique identifier.
This model does not support the modification of whether a node data object is a group.
This model cannot detect the modification of the #linkDataArray array or the modification of any link data object. If you want to add or remove link data from the #linkDataArray, call the #addLinkData or #removeLinkData methods. If you want to modify the node a link connects to, call the #setFromKeyForLinkData and/or #setToKeyForLinkData methods. If you want to change the membership of a node data in a group, call the #setGroupKeyForNodeData method.
- Implemented types
- Available extensions
- Annotations
-
- @JS()
- @staticInterop
Constructors
- GraphLinksModel.$1()
-
factory
- GraphLinksModel.$2([dynamic init])
-
factory
-
GraphLinksModel.$3([Array<
Object> ? nodedataarray, Array<Object> ? linkdataarray, dynamic init]) -
factory
Properties
-
afterCopyFunction
↔ void Function(Map<
Object, Object> , Model, Model)? -
Available on Model, provided by the Model$Typings extension
(undocumented) This function (if not null) is called towards the end of Diagram#copyParts in order to support custom data copying operations that depend on references between the parts.getter/setter pair - archetypeNodeData ↔ Object?
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets a data object that will be copied and added to the model as a new node data each time there is a link reference (either the "to" or the "from" of a link data) to a node key that does not yet exist in the model.getter/setter pair - copiesArrayObjects ↔ bool
-
Available on Model, provided by the Model$Typings extension
Gets or sets whether the default behavior for #copyNodeData or GraphLinksModel#copyLinkData when copying Arrays also copies array items that are Objects. This only covers copying Objects that are items in Arrays that are copied when #copiesArrays 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's constructor can be called with no arguments.getter/setter pair - copiesArrays ↔ bool
-
Available on Model, provided by the Model$Typings extension
Gets or sets whether the default behavior for #copyNodeData or GraphLinksModel#copyLinkData 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 #copiesArrayObjects is true.getter/setter pair - copiesKey ↔ bool
-
Available on Model, provided by the Model$Typings extension
Gets or sets whether the default behavior for #copyNodeData or GraphLinksModel#copyLinkData 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.getter/setter pair - copyLinkDataFunction ↔ Object Function(Object, GraphLinksModel)?
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets a function that makes a copy of a link data object.getter/setter pair - copyNodeDataFunction ↔ Object Function(Object, Model)?
-
Available on Model, provided by the Model$Typings extension
Gets or sets a function that makes a copy of a node data object.getter/setter pair - dataFormat ↔ String
-
Available on Model, provided by the Model$Typings extension
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.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
- isReadOnly ↔ bool
-
Available on Model, provided by the Model$Typings extension
Gets or sets whether this model may be modified, such as adding nodes. By default this value is false. Setting the #nodeDataArray to something that is not a true Array of Objects will cause this to be set to true.getter/setter pair - linkCategoryProperty ↔ Object
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets the name of the data property that returns a string naming that data's category, The value may also be a function taking two arguments, where the first argument will be a link 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 link data object so that it has that new category name. The default value is the name 'category', meaning that it expects the data to have a property named 'category' if it cares to name the category for the Link. This is used by the diagram to distinguish between different kinds of links. The name must not be null. If the value is an empty string, #getCategoryForLinkData will return an empty string for all link data objects.getter/setter pair -
linkDataArray
↔ Array<
Object> -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets the array of link data objects that correspond to Links in the Diagram. The initial value is an empty Array.getter/setter pair - linkFromKeyProperty ↔ Object
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets the name of the data property that returns the key of the node data that the link data is coming from. The value may also be a function taking two arguments, where the first argument will be a link data object. If the second argument is not supplied, the function should return the key of the link's source node; if the second argument is supplied, the function should modify the link data object so that it has that new key (which may be undefined to refer to no node) as the identifier to the "from" node. The default value is the name 'from', meaning that it expects the data to have a property named 'from' to refer to the link's source node. The name must not be null. If the value is an empty string, #getFromKeyForLinkData will return undefined for all link data objects.getter/setter pair - linkFromPortIdProperty ↔ Object
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets the name of the data property that returns the optional parameter naming a "port" element on the node that the link data is connected from. The value may also be a function taking two arguments, where the first argument will be a link data object. If the second argument is not supplied, the function should return the string identifier of the link's source port; if the second argument is supplied, the function should modify the link data object so that it has that string as the identifier to the "from" port. The default value is the empty string indicating that one cannot distinguish different logical connection points for any links. The name must not be null nor the value of #linkFromKeyProperty or #linkToKeyProperty. If the value is an empty string, #getFromPortIdForLinkData will return an empty string for all link data objects.getter/setter pair - linkKeyProperty ↔ Object
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets the name of the data property that returns a unique id number or string for each link data object. The value may also be a function taking two arguments, where the first argument will be a link data object. If the second argument is not supplied, the function should return the unique string or number key for that link data object; if the second argument is supplied, the function should modify the link data object so that it has that string or number as the unique key for that link. The default value is the empty string, which means the model will not maintain a key property value on link data objects. The name must not be null.getter/setter pair - linkLabelKeysProperty ↔ Object
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets the name of the data property that returns an array of keys of node data that are labels on that link data. The value may also be a function taking two arguments, where the first argument will be a link data object. If the second argument is not supplied, the function should return the array of label node keys for the link; if the second argument is supplied, the function should modify the link data object so that it holds that Array of node keys as references to label nodes. The default value is the empty string: '', meaning that the model does not support links owning label nodes.getter/setter pair - linkToKeyProperty ↔ Object
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets the name of the data property that returns the key of the node data that the link data is going to, The value may also be a function taking two arguments, where the first argument will be a link data object. If the second argument is not supplied, the function should return the key of the link's destination node; if the second argument is supplied, the function should modify the link data object so that it has that new key (which may be undefined to refer to no node) as the identifier to the "to" node. The default value is the name 'to', meaning that it expects the data to have a property named 'to' to refer to the link's destination node. The name must not be null. If the value is an empty string, #getToKeyForLinkData will return undefined for all link data objects.getter/setter pair - linkToPortIdProperty ↔ Object
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets the name of the data property that returns the optional parameter naming a "port" element on the node that the link data is connected to. The value may also be a function taking two arguments, where the first argument will be a link data object. If the second argument is not supplied, the function should return the string identifier of the link's destination port; if the second argument is supplied, the function should modify the link data object so that it has that string as the identifier to the "to" port. The default value is the empty string indicating that one cannot distinguish different logical connection points for any links. The name must not be null nor the value of #linkFromKeyProperty or #linkToKeyProperty. If the value is an empty string, #getToPortIdForLinkData will return an empty string for all link data objects.getter/setter pair - makeUniqueKeyFunction ↔ dynamic Function(Model, Object)?
-
Available on Model, provided by the Model$Typings extension
Gets or sets a function that returns a unique id number or string for a node data object. This function is called by #makeNodeDataKeyUnique when a node data object is added to the model, either as part of a new #nodeDataArray or by a call to #addNodeData, to make sure the value of #getKeyForNodeData is unique within the model.getter/setter pair - makeUniqueLinkKeyFunction ↔ dynamic Function(GraphLinksModel, Object)?
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets a function that returns a unique id number or string for a link data object. This function is called by #makeLinkDataKeyUnique when a link data object is added to the model, either as part of a new #linkDataArray or by a call to #addLinkData, to make sure the value of #getKeyForLinkData is unique within the model. However it will not be called when #linkKeyProperty is the default value, an empty string.getter/setter pair - modelData ↔ Object
-
Available on Model, provided by the Model$Typings extension
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.getter/setter pair - name ↔ String
-
Available on Model, provided by the Model$Typings extension
Gets or sets the name of this model. The initial name is an empty string. The value must not be null.getter/setter pair - nodeCategoryProperty ↔ Object
-
Available on Model, provided by the Model$Typings extension
Gets or sets the name of the node data property that returns a string naming that data'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 'category', meaning that it expects the data to have a property named 'category' 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, #getCategoryForNodeData will return an empty string for all node data objects.getter/setter pair -
nodeDataArray
↔ Array<
Object> -
Available on Model, provided by the Model$Typings extension
Gets or sets the array of node data objects that correspond to Nodes, Groups, or non-Link Parts in the Diagram. The initial value is an empty Array.getter/setter pair - nodeGroupKeyProperty ↔ Object
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets the name of the property on node data that specifies the string or number key of the group data that "owns" that node data. 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 string or number key for the group data object of which the given data object is a member; if the second argument is supplied, the function should modify the node data object so that it has that new key (which may be undefined to refer to no node) as the containing group key for that node. The default value is the name 'group', meaning that it expects the data to have a property named 'group' to refer to any containing group.getter/setter pair - nodeIsGroupProperty ↔ Object
-
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets or sets the name of the boolean property on node data that indicates whether the data should be represented as a group of nodes and links or as a simple node. 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 true if the node data object should be represented by a Group and false otherwise. At the current time the function will not be called to change whether the node is a group or not. The default value is the name 'isGroup', meaning that it expects the data to have a property named 'isGroup' on those node data objects that should be represented by Groups.getter/setter pair - nodeKeyProperty ↔ Object
-
Available on Model, provided by the Model$Typings extension
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 'key', meaning that it expects the data to have a property named 'key' if it has a key value. The name must not be null or the empty string. You must set this property before assigning the #nodeDataArray.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- skipsUndoManager ↔ bool
-
Available on Model, provided by the Model$Typings extension
Gets or sets whether ChangedEvents are not recorded by the UndoManager. 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.getter/setter pair - undoManager ↔ UndoManager
-
Available on Model, provided by the Model$Typings extension
Gets or sets the UndoManager for this Model.getter/setter pair
Methods
-
addArrayItem(
Array arr, [dynamic val]) → void -
Available on Model, provided by the Model$Typings extension
Add an item at the end of a data array that may be data bound by a Panel as its Panel#itemArray, in a manner that can be undone/redone and that automatically updates any bindings. -
addChangedListener(
void listener(ChangedEvent)) → Model -
Available on Model, provided by the Model$Typings extension
Register an event handler that is called when there is a ChangedEvent. -
addLabelKeyForLinkData(
Object linkdata, dynamic key) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Adds a node key value that identifies a node data acting as a new label node on the given link data. -
addLinkData(
Object linkdata) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
When you want to add a link to the diagram, call this method with a new data object. This will add that data to the #linkDataArray and notify all listeners that a new link data object has been inserted into the collection. -
addLinkDataCollection(
Object coll) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Add to this model all of the link data held in an Array or in an Iterable of link data objects. @param {Iterable. -
addNodeData(
Object nodedata) → void -
Available on Model, provided by the Model$Typings extension
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 #nodeDataArray and notify all listeners that a new node data object has been inserted into the collection. -
addNodeDataCollection(
Object coll) → void -
Available on Model, provided by the Model$Typings extension
Add to this model all of the node data held in an Array or in an Iterable of node data objects. @param {Iterable. -
applyIncrementalJson(
Object s) → void -
Available on Model, provided by the Model$Typings extension
Modify this model by applying the changes given in an "incremental" model change in JSON format generated by #toIncrementalJson. The expected properties of the argument are described at #toIncrementalJson. Incremental changes must be applied in the same order that the changes occurred in the original model. -
assignAllDataProperties(
Object data, Object props) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
This override is similar toObject.assign
, but safely calls #setDataProperty for each property other than a key property. @param data a data object @param props an Object holding various properties whose values are to be assigned to the DATA object -
assignAllDataProperties(
Object data, Object props) → void -
Available on Model, provided by the Model$Typings extension
This is similar toObject.assign
, but safely calls #setDataProperty for each property other than a key property. This does not delete any properties on the DATA object, although properties may be set to undefined if they are set that way on the PROPS object. @param data a data object @param props an Object holding various properties whose values are to be assigned to the DATA object -
changeState(
ChangedEvent e, bool undo) → void -
Available on Model, provided by the Model$Typings extension
(undocumented) This is called during an undo or redo to modify the model or its objects. -
clear(
) → void -
Available on Model, provided by the Model$Typings extension
Clear out all references to any model data. This also clears out the UndoManager, so this operation is not undoable. This method is called by Diagram#clear; it does not notify any Diagrams or other listeners. This method does not unregister any Changed event listeners. -
clearUnresolvedReferences(
[dynamic key]) → void -
Available on Model, provided by the Model$Typings extension
(undocumented) @param {string|number=} key -
cloneDeep<
T> (T obj) → T -
Available on Model, provided by the Model$Typings extension
Deeply copy an object or array and return the new object. This is typically called on a #nodeDataArray or GraphLinksModel#linkDataArray or data objects within them. -
cloneProtected(
Model copy) → void -
Available on Model, provided by the Model$Typings extension
Copies properties from this model to the given model, which must be of the same class. This is called by #copy. This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method. -
commit(
void func(Model), [String? tname]) → void -
Available on Model, provided by the Model$Typings extension
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: -
commitTransaction(
[String? tname]) → bool -
Available on Model, provided by the Model$Typings extension
Commit the changes of the current transaction. This just calls UndoManager#commitTransaction. @param {string=} tname a descriptive name for the transaction. @return {boolean} the value returned by UndoManager#commitTransaction. -
containsLinkData(
Object linkdata) → bool -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Decide if a given link data object is in this model, using reference equality. -
containsNodeData(
Object nodedata) → bool -
Available on Model, provided by the Model$Typings extension
Decide if a given node data object is in this model, using reference equality. -
copy(
) → Model -
Available on Model, provided by the Model$Typings extension
Creates a shallow copy of this Model and returns it. The data are not copied: #nodeDataArray, #modelData, GraphLinksModel#linkDataArray, GraphLinksModel#archetypeNodeData are left empty. Nor are any Changed listeners or the UndoManager copied. @expose @return {Model} an empty copy of the model with the same properties, other than data @since 1.6 -
copyLinkData(
Object linkdata) → Object -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Make a copy of a link data object. This uses the value of #copyLinkDataFunction to actually perform the copy, unless it is null, in which case this method just makes a shallow copy of the JavaScript Object. -
copyNodeData(
Object nodedata) → Object? -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
This override also makes sure any copied node data does not have a reference to the containing group. @expose @param {ObjectData} nodedata a JavaScript object represented by a node, group, or non-link. @return {ObjectData} @see Model#copyNodeData -
copyNodeData(
Object nodedata) → Object? -
Available on Model, provided by the Model$Typings extension
Make a copy of a node data object. This uses the value of #copyNodeDataFunction 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. -
findLinkDataForKey(
dynamic key) → Object? -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Given a number or string, find the link data object in this model that uses the given value as its unique key. -
findNodeDataForKey(
dynamic key) → Object? -
Available on Model, provided by the Model$Typings extension
Given a number or string, find the node data object in this model that uses the given value as its unique key. @param {(string|number|undefined)} key a string or a number. @return {Object} null if the key is not present in the model, or if the key is null or undefined or not a string or number. @see #containsNodeData @see #getKeyForNodeData -
getCategoryForLinkData(
Object linkdata) → String -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Find the category of a given link data, a string naming the link template that the Diagram should use to represent the link data. @param {ObjectData} linkdata a JavaScript object represented by a link. @return {string} @see #linkCategoryProperty @see #setCategoryForLinkData -
getCategoryForNodeData(
Object nodedata) → String -
Available on Model, provided by the Model$Typings extension
Find the category of a given node data, a string naming the node template or group template or part template that the Diagram should use to represent the node data. @param {Object} nodedata a JavaScript object represented by a node, group, or non-link. @return {string} @see #nodeCategoryProperty @see #setCategoryForNodeData -
getFromKeyForLinkData(
Object linkdata) → dynamic -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
From a link data retrieve a value uniquely identifying the node data from which this link is connected. @param {ObjectData} linkdata a JavaScript object represented by a link. @return {string|number|undefined} This may return undefined if the link is not coming from any node. @see #linkFromKeyProperty @see #setFromKeyForLinkData -
getFromPortIdForLinkData(
Object linkdata) → String -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
From a link data retrieve a value identifying the port object of the node from which this link is connected. @param {ObjectData} linkdata a JavaScript object represented by a link. @return {string} This may return the empty string if there is no particular port parameter information. @see #linkFromPortIdProperty @see #setFromPortIdForLinkData -
getGroupKeyForNodeData(
Object nodedata) → dynamic -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
If there is a container group for the given node data, return the group's key. @param {ObjectData} nodedata a JavaScript object represented by a node, group, or non-link. @return {string|number|undefined} This returns undefined if there is no containing group data. @see #nodeGroupKeyProperty @see #setGroupKeyForNodeData -
getKeyForLinkData(
Object linkdata) → dynamic -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Given a link data object return its unique key: a number or a string. This returns undefined if there is no key value. Unless #linkKeyProperty is set to a non-empty string, this model will not automatically assign unique key values for link data objects. -
getKeyForNodeData(
Object nodedata) → dynamic -
Available on Model, provided by the Model$Typings extension
Given a node data object return its unique key: a number or a string. This returns undefined if there is no key value. -
getLabelKeysForLinkData(
Object linkdata) → Array -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Gets an Array of node key values that identify node data acting as labels on the given link data. -
getToKeyForLinkData(
Object linkdata) → dynamic -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
From a link data retrieve a value uniquely identifying the node data to which this link is connected. @param {ObjectData} linkdata a JavaScript object represented by a link. @return {string|number|undefined} This may return undefined if the link is not going to any node. @see #linkToKeyProperty @see #setToKeyForLinkData -
getToPortIdForLinkData(
Object linkdata) → String -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
From a link data retrieve a value identifying the port object of the node to which this link is connected. @param {ObjectData} linkdata a JavaScript object represented by a link. @return {string} This may return the empty string if there is no particular port parameter information. @see #linkToPortIdProperty @see #setToPortIdForLinkData -
insertArrayItem(
Array arr, num idx, [dynamic val]) → void -
Available on Model, provided by the Model$Typings extension
Add an item to a data array that may be data bound by a Panel as its Panel#itemArray, 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. -
isGroupForNodeData(
Object nodedata) → bool -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
See if the given node data should be represented as a group or as a simple node. -
makeLinkDataKeyUnique(
Object linkdata) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
This method is called when a link data object is added to the model to make sure that #getKeyForLinkData returns a unique key value. -
makeNodeDataKeyUnique(
Object nodedata) → void -
Available on Model, provided by the Model$Typings extension
This method is called when a node data object is added to the model to make sure that #getKeyForNodeData returns a unique key value. -
mergeLinkDataArray(
Array< Object> arr) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Take an Array of link data objects and update #linkDataArray without replacing the Array and without replacing any existing link data objects that are identified by key. This depends on #linkKeyProperty being a non-empty string. -
mergeNodeDataArray(
Array< Object> arr) → void -
Available on Model, provided by the Model$Typings extension
Take an Array of node data objects and update #nodeDataArray without replacing the Array and without replacing any existing node data objects that are identified by key. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
raiseChangedEvent(
EnumValue change, Object propertyname, Object obj, [dynamic oldval, dynamic newval, dynamic oldparam, dynamic newparam]) → void -
Available on Model, provided by the Model$Typings extension
Call this method to notify that the model or its objects have changed. This constructs a ChangedEvent and calls all Changed listeners. @param {EnumValue} change specifies the general nature of the change; typically the value is ChangedEvent.Property. @param {string|function(ObjectData,?=):?} propertyname names the property that was modified, or a function that takes an Object and returns the property value. @param {Object} obj the object that was modified, typically a GraphObject, Diagram, or a Model. @param {} oldval the previous or older value. @param {} newval the next or newer value. @param {=} oldparam an optional value that helps describe the older value. @param {=} newparam an optional value that helps describe the newer value. -
raiseDataChanged(
Object data, Object propertyname, [dynamic oldval, dynamic newval, dynamic oldparam, dynamic newparam]) → void -
Available on Model, provided by the Model$Typings extension
Call this method to notify about a data property having changed value. This constructs a ChangedEvent and calls all Changed listeners. -
removeArrayItem(
Array arr, [num? idx]) → void -
Available on Model, provided by the Model$Typings extension
Remove an item from a data array that may be data bound by a Panel as its Panel#itemArray, given the index at which to remove a data value, in a manner that can be undone/redone and that automatically updates any bindings. -
removeChangedListener(
void listener(ChangedEvent)) → void -
Available on Model, provided by the Model$Typings extension
Unregister an event handler listener. -
removeLabelKeyForLinkData(
Object linkdata, dynamic key) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Removes a node key value that identifies a node data acting as a former label node on the given link data. -
removeLinkData(
Object linkdata) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
When you want to remove a link from the diagram, call this method with an existing link data object. This will remove that data object from the #linkDataArray and notify all listeners that a link data object has been removed from the collection. -
removeLinkDataCollection(
Object coll) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Remove from this model all of the link data held in an Array or in an Iterable of link data objects. @param {Iterable. -
removeNodeData(
Object nodedata) → void -
Available on Model, provided by the Model$Typings extension
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 #nodeDataArray and notify all listeners that a node data object has been removed from the collection. -
removeNodeDataCollection(
Object coll) → void -
Available on Model, provided by the Model$Typings extension
Remove from this model all of the node data held in an Array or in an Iterable of node data objects. @param {Iterable. -
rollbackTransaction(
) → bool -
Available on Model, provided by the Model$Typings extension
Rollback the current transaction, undoing any recorded changes. This just calls UndoManager#rollbackTransaction. @return {boolean} the value returned by UndoManager#rollbackTransaction. -
set(
Object data, String propname, [dynamic val]) → void -
Available on Model, provided by the Model$Typings extension
A synonym for #setDataProperty @param {Object} data a JavaScript object typically the value of a Panel#data and represented by a Node, Link, Group, simple Part, or item in a Panel#itemArray; or this model's #modelData. @param {string} propname a string that is not null or the empty string. @param {*} val the new value for the property. @see #setDataProperty @since 1.8 -
setCategoryForLinkData(
Object linkdata, String cat) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Change the category of a given link data, a string naming the link template that the Diagram should use to represent the link data. -
setCategoryForNodeData(
Object nodedata, String cat) → void -
Available on Model, provided by the Model$Typings extension
Change the category of a given node data, a string naming the node template or group template or part template that the Diagram should use to represent the node data. -
setDataProperty(
Object data, String propname, [dynamic val]) → void -
Available on Model, provided by the Model$Typings extension
Change the value of some property of a node data, a link data, an item data, or the Model#modelData, given a string naming the property and the new value, in a manner that can be undone/redone and that automatically updates any bindings. -
setDataProperty(
Object data, String propname, [dynamic val]) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
This override changes the value of some property of a node data, a link data, or an item data, given a string naming the property and the new value, in a manner that can be undone/redone and that automatically updates any bindings. This override handles link data as well as node data. -
setFromKeyForLinkData(
Object linkdata, dynamic key) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Change the node key that the given link data references as the source of the link. @param {ObjectData} linkdata a JavaScript object represented by a link. @param {string|number|undefined} key This may be undefined if the link should no longer come from any node. @see #linkFromKeyProperty @see #getFromKeyForLinkData -
setFromPortIdForLinkData(
Object linkdata, String portname) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Change the information that the given link data uses to identify the particular "port" that the link is coming from. @param {ObjectData} linkdata a JavaScript object represented by a link. @param {string} portname This may be the empty string if the link should no longer be associated with any particular "port". @see #linkFromPortIdProperty @see #getFromPortIdForLinkData -
setGroupKeyForNodeData(
Object nodedata, dynamic key) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Change the container group for the given node data, given a key for the new group. @param {ObjectData} nodedata a JavaScript object represented by a node, group, or non-link. @param {string|number|undefined} key This may be undefined if there should be no containing group data. @see #nodeGroupKeyProperty @see #getGroupKeyForNodeData -
setKeyForLinkData(
Object linkdata, dynamic key) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Change the unique key of a given link data that is already in this model. The new key value must be unique -- i.e. not in use by another link data object. You can call #findLinkDataForKey to check if a proposed new key is already in use. -
setKeyForNodeData(
Object nodedata, dynamic key) → void -
Available on Model, provided by the Model$Typings extension
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 #findNodeDataForKey to check if a proposed new key is already in use. -
setLabelKeysForLinkData(
Object linkdata, Array arr) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Replaces an Array of node key values that identify node data acting as labels on the given link data. -
setToKeyForLinkData(
Object linkdata, dynamic key) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Change the node key that the given link data references as the destination of the link. @param {ObjectData} linkdata a JavaScript object represented by a link. @param {string|number|undefined} key This may be undefined if the link should no longer go to any node. @see #linkToKeyProperty @see #getToKeyForLinkData -
setToPortIdForLinkData(
Object linkdata, String portname) → void -
Available on GraphLinksModel, provided by the GraphLinksModel$Typings extension
Change the information that the given link data uses to identify the particular "port" that the link is going to. @param {ObjectData} linkdata a JavaScript object represented by a link. @param {string} portname This may be the empty string if the link should no longer be associated with any particular "port". @see #linkToPortIdProperty @see #getToPortIdForLinkData -
startTransaction(
[String? tname]) → bool -
Available on Model, provided by the Model$Typings extension
Begin a transaction, where the changes are held by a Transaction object in the UndoManager. This just calls UndoManager#startTransaction. @param {string=} tname a descriptive name for the transaction. @return {boolean} the value returned by UndoManager#startTransaction. @see #commit -
toIncrementalData(
ChangedEvent e) → IncrementalData -
Available on Model, provided by the Model$Typings extension
Produce an object representing the changes in the most recent Transaction. The structure of the object follows the same format as the JSON output from #toIncrementalJson. -
toIncrementalJson(
ChangedEvent e, [String? classname]) → String -
Available on Model, provided by the Model$Typings extension
Produce a JSON-format string representing the changes in the most recent Transaction. This writes out JSON for a model, but recording only changes in the given Transaction, with the addition of the "incremental" property to mark it as different from a complete model. Instead of the "nodeDataArray" property (and "linkDataArray" property for GraphLinksModels), this will have "inserted...", "modified...", and "removed..." properties that are non-empty Arrays. -
toJson(
[String? classname]) → String -
Available on Model, provided by the Model$Typings extension
Generate a string representation of the persistent data in this model, in JSON format, that can be read in later with a call to Model.fromJson. -
toString(
) → String -
A string representation of this object.
inherited
-
updateTargetBindings(
Object data, [String? srcpropname]) → void -
Available on Model, provided by the Model$Typings extension
Find a Part corresponding to the given data and call its Panel#updateTargetBindings method, in each Diagram that uses this Model.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited