ID Generator Handler¶
This is an optional callback. It is called when new objects are created in the canvas and allows the application to provide its own method to generate a unique id for the object.
idGeneratorHandler¶
idGeneratorHandler(action, data)
The callback should return a string containing the application’s unique ID for the object. Here are more details about the different action and their parameters.
- Create node:
- action: create_node
- data:
nodeType:
{
"label":"C50",
"description":"C50 Model",
"operator_id_ref":"com.ibm.commonicons.models.c50",
"type":"model_node",
"image":"/images/common_node_icons/models/model_c50.svg",
"input_ports":[
{
"id":"inPort",
"label":"Input Port",
"cardinality":{
"min":0,
"max":1
}
}
],
"output_ports":[
]
}
-
Create comment:
- action: create_comment
- data: n/a
-
Create node link:
- action: create_node_link
- data:
sourceNode: {
"id":"6a547456-f1ea-48a6-9721-45d6ae70dd6b",
"label":"Aggregate",
"type":"execution_node",
"operator_id_ref":"com.ibm.commonicons.operations.aggregate",
"image":"/images/common_node_icons/operations/operation_aggregate.svg",
"class_name":"d3-node-body",
"input_ports":[...],
"output_ports":[...],
"x_pos":55,
"y_pos":97.5,
"inputPortsHeight":20,
"outputPortsHeight":20,
"height":75,
"width":70
},
targetNode: {
"id":"71c96629-be46-418b-be63-0a02ef2fe2e0",
"label":"Append",
"type":"execution_node",
"operator_id_ref":"com.ibm.commonicons.operations.append",
"image":"/images/common_node_icons/operations/operation_append.svg",
"class_name":"d3-node-body",
"input_ports":[...],
"output_ports":[...],
"x_pos":264,
"y_pos":83.5,
"inputPortsHeight":20,
"outputPortsHeight":20,
"height":75,
"width":70
}
- Create comment link:
- action: create_comment_link
- data:
comment: {
"id":"8c81aac7-ebe5-4f96-9d63-eabc22b09635",
"class_name":"d3-comment-rect",
"content":"",
"height":42,
"width":175,
"x_pos":50,
"y_pos":50
},
targetNode: {
"id":"71c96629-be46-418b-be63-0a02ef2fe2e0",
"label":"Append",
"type":"execution_node",
"operator_id_ref":"com.ibm.commonicons.operations.append",
"image":"/images/common_node_icons/operations/operation_append.svg",
"class_name":"d3-node-body",
"input_ports":[...],
"output_ports":[...],
"x_pos":264,
"y_pos":83.5,
"inputPortsHeight":20,
"outputPortsHeight":20,
"height":75,
"width":70
}
- Clone node: triggered when copying & pasting a node
- action: clone_node
- data:
node: {
"id":"56d30c83-3a08-4147-933e-b01d3c348ac1",
"label":"Append",
"type":"execution_node",
"operator_id_ref":"com.ibm.commonicons.operations.append",
"image":"/images/common_node_icons/operations/operation_append.svg",
"class_name":"d3-node-body",
"input_ports":[...],
"output_ports":[...],
"x_pos":265,
"y_pos":177.5,
"inputPortsHeight":20,
"outputPortsHeight":20,
"height":75,
"width":70
}
- Clone comment: triggered when copying & pasting a comment
- action: clone_comment
- data:
comment: {
"id":"8c81aac7-ebe5-4f96-9d63-eabc22b09635",
"class_name":"d3-comment-rect",
"content":"",
"height":42,
"width":175,
"x_pos":50,
"y_pos":50
}
- Clone node link: triggered when copying & pasting two connected nodes
- action: clone_node_link
- data:
link: {
"id":"12c4308e-f572-402a-8dd3-604d438539d4",
"class_name":"d3-data-link",
"srcNodeId":"2b1af6c2-f98b-4728-97b3-416d40224bce",
"trgNodeId":"b43fffe6-dc01-4d30-8b6d-abd977850a2e",
"type":"nodeLink"
},
sourceNodeId: "56d30c83-3a08-4147-933e-b01d3c348ac1",
targetNodeId: "815271f0-f4da-4793-ab8f-c4c32d3dd7e0"
- clone comment link: triggered when copying&pasting a comment and a node that are connected
- action: clone_comment_link
- data:
link: {
"id":"12c4308e-f572-402a-8dd3-604d438539d4",
"class_name":"d3-comment-link",
"srcNodeId":"2b1af6c2-f98b-4728-97b3-416d40224bce",
"trgNodeId":"b43fffe6-dc01-4d30-8b6d-abd977850a2e",
"type":"commentLink"
},
sourceNodeId: "56d30c83-3a08-4147-933e-b01d3c348ac1",
targetNodeId: "815271f0-f4da-4793-ab8f-c4c32d3dd7e0"