Modeler

Simplicite.Diagram. Modeler

new Modeler()

Description:
  • Model controller between Model servlet and desktop/palette/events

Methods

bind()

Description:
  • Bind events to element

canClose(confirm, cbk)

Description:
  • Can close the modeler

Parameters:
Name Type Description
confirm boolean

confirm save when has changed, auto-save if false

cbk function

callback if closeable

close(confirm)

Description:
  • Close the diagram

Parameters:
Name Type Description
confirm boolean

confirm save when has changed, auto-save if false

Description:
  • Create a link between 2 nodes (or note to node)

createLinkMany2Many()

Description:
  • Create a N,N link between 2 internal objects

createNode(tpl, pos, cont)

Description:
  • Launch a node/container creation in UI

Parameters:
Name Type Description
tpl string

node template

pos string

position {x,y}

cont boolean

container ? or node

del()

Description:
  • Delete object thru Ajax

Description:
  • Delete link from DB + UI

deleteNode()

Description:
  • Delete node from DB + UI

detach(dock)

Description:
  • Detach diagram from Parent/Popup window

Parameters:
Name Type Description
dock boolean

true to dock on parent window

fetchRelatedNodes(nodes, cbk)

Description:
  • Fetch related nodes

Parameters:
Name Type Description
nodes Array

arrays of nodes or data

cbk function

Optional callback(nodes)

forceUIAction()

Description:
  • Call action on object form

getNodeData(n, cbk)

Description:
  • Ajax call to retrieve node data

Parameters:
Name Type Description
n Object

{ object, id, template, keys }

cbk function

getStyles()

Description:
  • Get SVG inlined styles

hasChanged(b)

Description:
  • Content has changed ?

Parameters:
Name Type Description
b boolean

optional flag to set the value

hook(hook, cbk, params)

Description:
  • Generic hook call if exists in template

Parameters:
Name Type Description
hook string

hook name defined as a function in template

cbk function

optional callback (to be called at the end of hook)

params Array

optional parameters

imageSVG()

Description:
  • Image dialog with SVG source

info()

Description:
  • Get model data

insertNode(item, cbk)

Description:
  • Insert one node or a container

Parameters:
Name Type Description
item Object

{ object, id, template, x, y, keys, container? }

cbk function

Optional callback(node)

insertNodes(list, cbk)

Description:
  • Insert nodes

Parameters:
Name Type Description
list Object

Array of { object, id, template, x, y }

cbk function

Optional callback(nodes)

layoutSprings(data)

Description:
  • Nodes self-placement with Springs layout

Parameters:
Name Type Description
data Object

false to disable, or the $(svg) or the springs properties

loadModel(cbk)

Description:
  • Load model

Parameters:
Name Type Description
cbk function

post load function

loadTemplate()

Description:
  • Load the template definition

open(ctn, cbk, p)

Description:
  • Open a model

Parameters:
Name Type Description
ctn Object

container

cbk function

optional callback(model)

p Object

options

Properties
Name Type Description
sync boolean

synchronize all nodes with DB?

openForm(target)

Description:
  • Open target or related model form

Parameters:
Name Type Description
target Object

optional { object, id }

openWorkflow(name)

Description:
  • Open workflow on top window

Parameters:
Name Type Description
name string

workflow name

print()

Description:
  • Print preview

reload(cbk)

Description:
  • Reload all elements from DB

Parameters:
Name Type Description
cbk function

optional callback

reloadContainer(c, cbk)

Description:
  • Reload a container from DB

Parameters:
Name Type Description
c Simplicite.Diagram.Container

container (or jquery node)

cbk function

optional callback

reloadNode(n, cbk)

Description:
  • Reload a node from DB

Parameters:
Name Type Description
n Simplicite.Diagram.Node

node (or jquery node)

cbk function

optional callback

save(cbk, silent)

Description:
  • Save the model

Parameters:
Name Type Description
cbk function

optional callback

silent boolean

no alert?

selectNodeContent()

Description:
  • Select content to add in node

selectObjects(tpl, pos, cont)

Description:
  • Select objects and insert them on desktop

Parameters:
Name Type Description
tpl string

node/container template

pos string

position {x,y}

cont boolean

container ? or node

upd()

Description:
  • Update fields thru Ajax