Oui c’est ça, voici petit rappel des hooks du modeler :
/*
* SIMPLICITE - runtime & framework
* http://www.simplicite.fr
* Copyright (c)2006-2020 Simplicite Software. All rights reserved.
*/
// SVG Modeler extension
Simplicite.Diagram.ModelHooks.Default = {
// Template global properties
canUseGrid: true,
canUseNote: true,
canUseShape: true,
canUseContainer: true,
canUseTitle: true,
canUseSprings: true,
//-----------------
// Model hooks
//-----------------
// Called when the template is loaded
onLoadTemplate: function(template, cbk) { cbk(); },
// Called when the model is loaded (before rendering)
onLoadModel: function(data, cbk) { cbk(); },
// Called before save
preSaveModel: function(item, cbk) { cbk(); },
// Called if the model has been saved
postSaveModel: function(item, cbk) { cbk(); },
// Called before closing
preCloseModel: function(cbk) { cbk(); },
//-----------------
// Element hooks
//-----------------
// Called when node is loaded from DB
onLoadNode: function(node, cbk) { cbk(); },
// Override node drawing (synchronous)
onDrawNode: function(node, display) { display(); },
// Override node item drawing (synchronous)
onDrawItem: function(node, data, display) { display(); },
// Called when link is loaded
onLoadLink: function(link, cbk) { cbk(); },
// Override link drawing (synchronous)
onDrawLink: function(link, display) { display(); },
//-----------------
// Desktop hooks
//-----------------
// When desktop is displayed with diagram
ready: function(desktop, cbk) { cbk(); },
// Override default diagram form (object Model on rowId)
onOpenModel: function(modelId, form) { form(); },
// Override default target form { object, id }
onOpenElement: function(target, form) { form(); },
// Prepare or Override default creation form (node or container)
onNewNode: function(nodeTemplate, container, position, form) { form(); },
// Prepare or Override default object selector (node or container) or call select(optional filters)
onInsertNode: function(nodeTemplate, position, container, select) { select(); },
// Called when node is added to desktop
onAddNode: function(node, cbk) { cbk(); },
// Called after node move
onMoveNode: function(node) {},
// Called after node remove from UI
onRemoveNode: function(node) {},
// Called after node deletion from DB
onDeleteNode: function(node) {},
// Override default content selector
onInsertContent: function(node, contentTemplate, select) { select(); },
// Override default content creation
onAddContent: function(node, contentTemplate, form) { form(); },
// Override default link creation
onCreateLink: function(fromNode, toNode, linkTemplate, create) { create(); },
// Called when link is added to desktop
onAddLink: function(link) {},
// Called after link remove from UI
onRemoveLink: function(link) {},
// Called after link deletion from DB
onDeleteLink: function(link) {},
// Called when container is loaded from DB
onLoadContainer: function(cont, cbk) { cbk(); },
// Called when container is added to desktop
onAddContainer: function(node, cbk) { cbk(); },
// Override container drawing (synchronous)
onDrawContainer: function(cont, display) { display(); },
// Called after container move
onMoveContainer: function(cont) {},
// Called after container remove from UI
onRemoveContainer: function(cont) {},
//-----------------
// Custom menu
//-----------------
customNodeMenu: function(node, item) {},
customLinkMenuAdd: function(from,to,pal) { return false; },
// Menu actions
canCreateNode: function(tplNode) { return true; },
canInsertNode: function(tplNode) { return true; },
canFetchNode: function(tplNode) { return true; },
canRemoveNode: function(tplNode) { return true; },
canDeleteNode: function(tplNode) { return false; },
canCreateContent: function(tplContent) { return true; },
canInsertContent: function(tplContent) { return true; },
canAddLink: function(tplLink) { return true; },
canDeleteLink: function(tplLink) { return false; },
canRemoveContainer: function(tpl) { return true; }
};