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 DiagramDataSource(data)
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | data required by the DiagramDataSource implementation |
Fields
-
(static) EventType :string
-
- nodes: An array of node objects. See DiagramDataSource.NodeObject section.
- links: An array of link objects. See DiagramDataSource.LinkObject section.
- nodes: An array of node objects. See DiagramDataSource.NodeObject section.
- links: An array of link objects. See DiagramDataSource.LinkObject section.
- nodes: An array of node objects. See DiagramDataSource.NodeObject section.
- links: An array of link objects. See DiagramDataSource.LinkObject section.
Properties:
Name Type Default Description ADD
string add Triggered when nodes or links are added to DiagramDataSource. The event payload contains.
data Object An object with the following properties: parentId string parent id for nodes and links index number An index where the nodes should be added CHANGE
string change Triggered when nodes or links are removed from DiagramDataSource. The event payload contains: data Object An object with the following properties: REMOVE
string remove Triggered when nodes or links are removed from DiagramDataSource. The event payload contains: data Object An object with the following properties: parentId string parent id for nodes and links
Methods
-
getCapability(feature) : {string|null}
-
Determines whether this DataSource supports the specified feature.
Parameters:
Name Type Description feature
string the feature in which its capabilities is inquired. - Inherited From:
Returns:
the capability of the specified feature. Returns null if the feature is not recognized.
- Type
- string | null
-
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:
nodes An array of objects for the child nodes for the given parent. See DiagramDataSource.NodeObject section. links An 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
-
handleEvent(eventType, event) : {boolean}
-
Handle the event
Parameters:
Name Type Description eventType
string event type event
Object event - Inherited From:
Returns:
Returns false if event is cancelled
- Type
- boolean
-
Init : {undefined}
-
Initializes the instance.
- Inherited From:
Returns:
- Type
- undefined
-
off(eventType, eventHandler) : {void}
-
Detach an event handler.
Application can call this if it no longer wants to be notified of an event that it has attached an handler to using the
on
method.Parameters:
Name Type Description eventType
string eventType eventHandler
function(Object) event handler function - Inherited From:
Returns:
- Type
- void
-
on(eventType, eventHandler) : {void}
-
Attach an event handler.
Application can call this if it wants to be notified of an event. It can call the
off
method to detach the handler when it no longer wants to be notified.Parameters:
Name Type Description eventType
string eventType eventHandler
function(Object) event handler function - Inherited From:
Returns:
- Type
- void
Type Definitions
-
LinkObject
-
Object that defines diagram link. The object might also have additional custom properties that can be mapped to link styles (see oj.ojDiagram#linkProperties) or used during Diagram layout (see oj.DvtDiagramLayoutContextLink#getData).
Properties:
Name Type Argument Description categories
Array.<string> <optional>
An optional array of additional category strings corresponding to the link. endNode
string End node id. id
string Link id label
string <optional>
The label for the link. If the string contains new line characters, a multi-line label will be rendered. selectable
string <optional>
Specifies whether or not the node will be selectable. Acceptable values are 'off' and 'auto'. Default value is 'auto' shortDesc
string <optional>
The description of the node. This is used for accessibility and also for customizing the tooltip text. startNode
string Start node id. -
NodeObject
-
Object that defines diagram node. The object might also have additional custom properties that can be mapped to node styles (see oj.ojDiagram#nodeProperties) or used during Diagram layout (see oj.DvtDiagramLayoutContextNode#getData).
Properties:
Name Type Argument Description categories
Array.<string> <optional>
An optional array of additional category strings corresponding to the node. draggable
string <optional>
Specifies whether or not the node will be draggable. Acceptable values are 'off' and 'auto'. Default value is 'auto' id
string Node id label
string <optional>
The label for the node. If the string contains new line characters, a multi-line label will be rendered. nodes
Array.<Object> <optional>
An array of objects with properties for the child nodes. Set value to null to indicate leaf node, if child nodes could be fetched on container disclosure. Set value to 'undefined' to indicate potential child nodes, if the child nodes should be fetched on container disclosure. selectable
string <optional>
Specifies whether or not the node will be selectable. Acceptable values are 'off' and 'auto'. Default value is 'auto' shortDesc
string <optional>
The description of the node. This is used for accessibility and also for customizing the tooltip text.