model property

Model get model

Gets or sets the Model holding data corresponding to the data-bound nodes and links of this Diagram.

Replacing this value causes all of the bound Nodes and Links to be deleted and re-created from the new model data.

Models may be shared by multiple Diagrams. One common approach is to have two Diagrams displaying the same Model but using different templates (see #nodeTemplate, #nodeTemplateMap, and the associated link and group properties) and sometimes even different Layouts.

Setting this property does not notify about any changed event; the new value must not be null. Typically a new Model will have its own UndoManager, thereby replacing the Diagram's current UndoManager.

Replacing or re-setting the model will re-initialize the Diagram, taking in to account #initialPosition, #initialScale, #initialAutoScale, and #initialContentAlignment. It will also set #isModified to false.

The default behavior when replacing the model is to copy a few UndoManager properties to the new UndoManager, including UndoManager#isEnabled and UndoManager#maxHistoryLength.

It is an error to replace the Diagram.model while a transaction is in progress.

Implementation

_i3.Model get model => _i4.getProperty(
      this,
      'model',
    );
set model (Model value)

Implementation

set model(_i3.Model value) {
  _i4.setProperty(
    this,
    'model',
    value,
  );
}