Populate an IlvSDMModel and create subgraphs programmatically

Article ID: 2374
Last updated: 29 May, 2018
Article ID: 2374
Last updated: 29 May, 2018
Revision: 3
Views: 518
Posted: 23 Jun, 2010
by Dean J.
Updated: 29 May, 2018
by Gargani A.

Question

How to populate an IlvSDMModel programmatically, how to create subgraphs.

Answer

The IlvSDMModel interface provides methods for creating and adding new nodes to the model, which allows it to be modified programmatically within an application. Here is a summary of the relevant IlvSDMModel methods:

  • createNode()
  • createLink()
  • addObject()
  • setFrom()
  • setTo()
  • ...

The attached sample illustrates this capability. Right-clicking in the view adds new nodes to the model; if the click occurs over one of the topmost nodes in the hierarchy, the new node is added as a child of the clicked item.
You can download the sample here.

In the sample, the SubGraph renderer is activated to reveal the parent-child hierarchy of the SDM model. Since the rendering of a node changes depending on whether the node has child nodes or not (if it has child nodes, it will be rendered as a submanager), it is necessary to add this setting to the CSS to take this change into account:

SubGraph {
leafToContainerEnabled : "true";
}

Note: the model can be changed only if the isEditable() method from the IlvSDMModel interface returns true. Refer to the documentation for further details.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2374
Last updated: 29 May, 2018
Revision: 3
Views: 518
Posted: 23 Jun, 2010 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Also listed in


Others in this category