Final Class: JsonDiagramDataSource

Oracle® JavaScript Extension Toolkit (JET)
17.0.0

F92240-01

Since:
  • 3.0
Module:
  • ojjsondiagramdatasource

Note: This class is deprecated since 14.0.0. JsonDiagramDataSource has been deprecated with the oj-diagram data property, use DataProvider on nodeData and linkData oj-diagram attributes instead.

QuickNav

Description

JSON implementation of the oj.DiagramDataSource


Usage

For additional information visit:


Final classes in JET

Classes in JET are generally final and do not support subclassing. At the moment, final is not enforced. However, this will likely change in an upcoming JET release.


Constructor

new JsonDiagramDataSource(data, options)

Parameters:
Name Type Argument Description
data Object JSON data object with following properties:
nodesAn optional array of nodes. See DiagramDataSource.NodeObject section.
linksAn optional array of links. See DiagramDataSource.LinkObject section.
options Object <optional>
the options set on this data source
Properties
Name Type Argument Description
childData function <optional>
Function callback to retrieve nodes and links for the specified parent. Function will return a Promise that resolves into an object with the following structure:

nodesAn array of objects for the child nodes for the given parent. See DiagramDataSource.NodeObject section.
linksAn array of objects for the links for the given parent. See DiagramDataSource.LinkObject section.

Methods

getChildCount(nodeData) : {number}

Retrieves number of child nodes
Parameters:
Name Type Description
nodeData Object A data object for the node in question. See DiagramDataSource.NodeObject section.
Returns:

Number of child nodes if child count is available. The method returns 0 for leaf nodes. The method returns -1 if the child count is unknown (e.g. if the children have not been fetched).

Type
number

getData(parentData) : {Promise}

Returns child data for the given parent. The data include all immediate child nodes along with links whose endpoints both descend from the current parent node. If all the links are available upfront, they can be returned as part of the top-level data (since all nodes descend from the diagram root). If lazy-fetching links is desirable, the most optimal way to return links is as part of the data of the nearest common ancestor of the link's endpoints.
Parameters:
Name Type Description
parentData Object | null An object that contains data for the parent node. See DiagramDataSource.NodeObject section. If parentData is null, the method retrieves data for top level nodes.
Returns:

Promise resolves to a component object with the following structure:

nodesAn array of objects for the child nodes for the given parent. See DiagramDataSource.NodeObject section.
linksAn array of objects for the links for the given parent. See DiagramDataSource.LinkObject section.

Type
Promise

getDescendantsConnectivity(nodeData) : {string}

Indicates whether the specified object contains links that should be discovered in order to display promoted links.
Parameters:
Name Type Description
nodeData Object A data object for the container node in question. See DiagramDataSource.NodeObject section.
Returns:

the valid values are "connected", "disjoint", "unknown"

Type
string