update.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. /**
  2. * Update plugin. Use updateUrl and updateInterval (optional, default is 60000ms)
  3. * in the meta data of the diagram to configure the plugin. (Alternatively, the
  4. * update-url and update-interval URL parameters may be used instead.)
  5. *
  6. * It will send the XML of the current page to the given URL as a POST request
  7. * (with a parameter called xml) and allows for the following type of XML response
  8. * (with CORS headers):
  9. *
  10. * <updates>
  11. * <update ...>
  12. * <model>...</model>
  13. * <view ...>
  14. * <fit ...>
  15. * </updates>
  16. *
  17. * The outermost updates node may contain an optional url and interval property
  18. * to change the current updateUrl and updateInterval.
  19. *
  20. * Where update must contain an id attribute to reference the cell in the diagram.
  21. *
  22. * - An optional value attribute that contains XML markup is used as the value for
  23. * the cell, with label and tooltip for the label and tooltip, respectively.
  24. * Additionally, placeholders="1" can be used to enable placeholders in the label
  25. * or tooltip of the cell.
  26. *
  27. * Example: <object label="Hello, %var1%!" var1="World" tooltip=
  28. * "Click <a href=\"https://www.draw.io\">here</a>" placeholders="1">
  29. *
  30. * - An optional replace-value attribute that contains 1 can be specified to
  31. * replace the value of the cell. Default is to add the attributes of the XML
  32. * value specified above to the existing value of the cell. (Attributes with
  33. * an empty string value are removed.)
  34. *
  35. * - An optional style attribute that contains the cell style is used to replace
  36. * the existing cell style.
  37. *
  38. * Example: fillColor=red;gradientColor=white;"
  39. *
  40. * - An optional icon attribute that contains JSON is used to add an icon to the
  41. * given cell. The object value that the icon attribute is parsed and may contain
  42. * a tooltip (string), align ("left"|"center"|"right", default is "right"), valign
  43. * (top|middle|bottom, default is bottom) and append (true|false, default is false)
  44. * for adding or replacing existing icons. The image attribute is an object value
  45. * with src, width and height for defining the icon to be displayed (default is
  46. * mxGraph.warningImage). An empty string for the attribute removes all icons.
  47. *
  48. * Example: JSON.stringify({tooltip: 'Locked', append: true, image:
  49. * {src: IMAGE_PATH + '/locked.png', width: 26, height:26}}
  50. *
  51. * - An optional geometry attribute that contains a JSON mxGeometry object can be used
  52. * to replace the current geometry of the refenced cell. In addition to the existing
  53. * field names in mxGeometry, dx and dy can be used to define a vector for moving the
  54. * shape, and dh and dw can be used to resize the cell.
  55. *
  56. * Example: JSON.stringify({dx: (Math.random() * 100) - 50, dh: (Math.random() * 100) - 50}))
  57. *
  58. * - Additionally a model node may be specified to set the current graph model.
  59. *
  60. * Example: <model><mxGraphModel><root><mxCell id="0"/></mxCell>...</root></mxGraphModel></model>
  61. *
  62. * - A view node may be specified with a scale, dx and dy attribute to change the current
  63. * scale and translate.
  64. *
  65. * Example: <view scale="0.5" dx="100" dy="100"/>
  66. *
  67. * - A fit node may be specified with a max-scale property to fit the diagram to the
  68. * available viewport with the specified max-scale.
  69. */
  70. Draw.loadPlugin(function(editorUi)
  71. {
  72. if (editorUi.editor.chromeless)
  73. {
  74. var graph = editorUi.editor.graph;
  75. var updateInterval = parseInt(urlParams['update-interval'] || 60000);
  76. var updateUrlParam = urlParams['update-url'];
  77. var updateUrl = null;
  78. if (updateUrlParam != null)
  79. {
  80. updateUrl = decodeURIComponent(updateUrlParam);
  81. // Creates empty file if update URL is in URL parameter
  82. if (editorUi.getCurrentFile() == null)
  83. {
  84. editorUi.createFile(editorUi.defaultFilename, null, null, null, null, null, null, true);
  85. }
  86. }
  87. function createOverlay(desc)
  88. {
  89. var overlay = new mxCellOverlay(desc.image || graph.warningImage,
  90. desc.tooltip, desc.align, desc.valign, desc.offset);
  91. // Installs a handler for clicks on the overlay
  92. overlay.addListener(mxEvent.CLICK, function(sender, evt)
  93. {
  94. editorUi.alert(desc.tooltip);
  95. });
  96. return overlay;
  97. };
  98. function parseResponse(xml)
  99. {
  100. if (xml != null && xml.length > 0)
  101. {
  102. var doc = mxUtils.parseXml(xml);
  103. var node = (doc != null) ? doc.documentElement : null;
  104. if (node != null && node.nodeName == 'updates')
  105. {
  106. if (node.hasAttribute('url'))
  107. {
  108. updateUrl = node.getAttribute('url');
  109. }
  110. if (node.hasAttribute('interval'))
  111. {
  112. updateInterval = node.getAttribute('interval');
  113. }
  114. var model = graph.getModel();
  115. model.beginUpdate();
  116. var fit = null;
  117. try
  118. {
  119. node = node.firstChild;
  120. while (node != null)
  121. {
  122. if (node.nodeName == 'update')
  123. {
  124. // Resolves the cell ID
  125. var cell = model.getCell(node.getAttribute('id'));
  126. if (cell != null)
  127. {
  128. // Changes the value
  129. try
  130. {
  131. var value = node.getAttribute('value');
  132. if (value != null)
  133. {
  134. var valueNode = mxUtils.parseXml(value).documentElement;
  135. if (valueNode != null)
  136. {
  137. if (valueNode.getAttribute('replace-value') == '1')
  138. {
  139. model.setValue(cell, valueNode);
  140. }
  141. else
  142. {
  143. var attrs = valueNode.attributes;
  144. for (var j = 0; j < attrs.length; j++)
  145. {
  146. graph.setAttributeForCell(cell, attrs[j].nodeName,
  147. (attrs[j].nodeValue.length > 0) ? attrs[j].nodeValue : null);
  148. }
  149. }
  150. }
  151. }
  152. }
  153. catch (e)
  154. {
  155. console.log('Error in value for ' + cell.id + ': ' + e);
  156. }
  157. // Changes the style
  158. try
  159. {
  160. var style = node.getAttribute('style');
  161. if (style != null)
  162. {
  163. graph.model.setStyle(cell, style);
  164. }
  165. }
  166. catch (e)
  167. {
  168. console.log('Error in style for ' + cell.id + ': ' + e);
  169. }
  170. // Adds or removes an overlay icon
  171. try
  172. {
  173. var icon = node.getAttribute('icon');
  174. if (icon != null)
  175. {
  176. var desc = (icon.length > 0) ? JSON.parse(icon) : null;
  177. if (desc == null || !desc.append)
  178. {
  179. graph.removeCellOverlays(cell);
  180. }
  181. if (desc != null)
  182. {
  183. graph.addCellOverlay(cell, createOverlay(desc));
  184. }
  185. }
  186. }
  187. catch (e)
  188. {
  189. console.log('Error in icon for ' + cell.id + ': ' + e);
  190. }
  191. // Replaces the geometry
  192. try
  193. {
  194. var geo = node.getAttribute('geometry');
  195. if (geo != null)
  196. {
  197. geo = JSON.parse(geo);
  198. var curr = graph.getCellGeometry(cell);
  199. if (curr != null)
  200. {
  201. curr = curr.clone();
  202. // Partially overwrites geometry
  203. for (key in geo)
  204. {
  205. var val = parseFloat(geo[key]);
  206. if (key == 'dx')
  207. {
  208. curr.x += val;
  209. }
  210. else if (key == 'dy')
  211. {
  212. curr.y += val;
  213. }
  214. else if (key == 'dw')
  215. {
  216. curr.width += val;
  217. }
  218. else if (key == 'dh')
  219. {
  220. curr.height += val;
  221. }
  222. else
  223. {
  224. curr[key] = parseFloat(geo[key]);
  225. }
  226. }
  227. graph.model.setGeometry(cell, curr);
  228. }
  229. }
  230. }
  231. catch (e)
  232. {
  233. console.log('Error in icon for ' + cell.id + ': ' + e);
  234. }
  235. } // if cell != null
  236. } // if node.nodeName == 'update
  237. else if (node.nodeName == 'model')
  238. {
  239. // Finds first child element
  240. var dataNode = node.firstChild;
  241. while (dataNode != null && dataNode.nodeType != mxConstants.NODETYPE_ELEMENT)
  242. {
  243. dataNode = dataNode.nextSibling;
  244. }
  245. if (dataNode != null)
  246. {
  247. var dec = new mxCodec(node.firstChild);
  248. dec.decode(dataNode, model);
  249. }
  250. }
  251. else if (node.nodeName == 'view')
  252. {
  253. if (node.hasAttribute('scale'))
  254. {
  255. graph.view.scale = parseFloat(node.getAttribute('scale'));
  256. }
  257. if (node.hasAttribute('dx') || node.hasAttribute('dy'))
  258. {
  259. graph.view.translate = new mxPoint(parseFloat(node.getAttribute('dx') || 0),
  260. parseFloat(node.getAttribute('dy') || 0));
  261. }
  262. }
  263. else if (node.nodeName == 'fit')
  264. {
  265. if (node.hasAttribute('max-scale'))
  266. {
  267. fit = parseFloat(node.getAttribute('max-scale'));
  268. }
  269. else
  270. {
  271. fit = 1;
  272. }
  273. }
  274. node = node.nextSibling;
  275. } // end of while
  276. }
  277. finally
  278. {
  279. model.endUpdate();
  280. }
  281. if (fit != null && editorUi.chromelessResize)
  282. {
  283. editorUi.chromelessResize(true, fit);
  284. }
  285. }
  286. }
  287. };
  288. var currentThread = null;
  289. function scheduleUpdates()
  290. {
  291. var page = editorUi.currentPage;
  292. var root = editorUi.editor.graph.getModel().getRoot();
  293. var result = false;
  294. if (urlParams['update-url'] || (root.value != null && typeof(root.value) == 'object'))
  295. {
  296. if (root.value != null && typeof(root.value) == 'object')
  297. {
  298. updateInterval = parseInt(root.value.getAttribute('updateInterval') || updateInterval);
  299. updateUrl = root.value.getAttribute('updateUrl') || updateUrl;
  300. }
  301. if (updateUrl != null)
  302. {
  303. var currentXml = mxUtils.getXml(editorUi.editor.getGraphXml());
  304. function doUpdate()
  305. {
  306. if (updateUrl === 'demo')
  307. {
  308. parseResponse(mxUtils.getXml(createDemoResponse().documentElement));
  309. schedule();
  310. }
  311. else
  312. {
  313. mxUtils.post(updateUrl, 'xml=' + encodeURIComponent(currentXml), function(req)
  314. {
  315. if (page === editorUi.currentPage)
  316. {
  317. if (req.getStatus() >= 200 && req.getStatus() <= 300)
  318. {
  319. parseResponse(mxUtils.getXml(req.getDocumentElement()));
  320. schedule();
  321. }
  322. else
  323. {
  324. editorUi.handleError({message: mxResources.get('error') + ' ' +
  325. req.getStatus()});
  326. }
  327. }
  328. }, function(err)
  329. {
  330. editorUi.handleError(err);
  331. });
  332. }
  333. };
  334. function schedule()
  335. {
  336. currentThread = window.setTimeout(doUpdate, updateInterval);
  337. };
  338. doUpdate();
  339. result = true;
  340. }
  341. }
  342. return result;
  343. };
  344. function startUpdates()
  345. {
  346. var result = scheduleUpdates();
  347. if (result)
  348. {
  349. editorUi.editor.addListener('pageSelected', function()
  350. {
  351. window.clearTimeout(currentThread);
  352. scheduleUpdates();
  353. });
  354. }
  355. return result;
  356. };
  357. function createDemoResponse()
  358. {
  359. var doc = mxUtils.createXmlDocument();
  360. var status = doc.createElement('updates');
  361. for (var id in graph.model.cells)
  362. {
  363. var cell = graph.model.cells[id];
  364. if (graph.model.isEdge(cell))
  365. {
  366. // Ignores short edges
  367. var state = graph.view.getState(cell);
  368. if (Math.random() > 0.5 && state.length > 50)
  369. {
  370. var update = doc.createElement('update');
  371. update.setAttribute('id', cell.id);
  372. update.setAttribute('value', '<object label="%load% minutes" load="' +
  373. Math.round(Math.random() * 100) + '" placeholders="1">');
  374. update.setAttribute('style', cell.style + ';strokeColor=red;strokeWidth=' +
  375. Math.round(Math.random() * 5) + ';');
  376. status.appendChild(update);
  377. }
  378. else
  379. {
  380. var update = doc.createElement('update');
  381. update.setAttribute('id', cell.id);
  382. update.setAttribute('value', '<object label="" load="' +
  383. Math.round(Math.random() * 100) + '" placeholders="1">');
  384. update.setAttribute('style', cell.style + ';strokeColor=black;strokeWidth=;');
  385. status.appendChild(update);
  386. }
  387. }
  388. else if (graph.model.isVertex(cell))
  389. {
  390. // For the purpose of the demo we flag stuff to update with update="1".
  391. // This is not needed for the general case.
  392. if (cell.value != null && typeof(cell.value) == 'object' &&
  393. cell.value.getAttribute('update') == '1')
  394. {
  395. // Restores original style in demo roundtrip
  396. if (cell.prevStyle == null)
  397. {
  398. cell.prevStyle = cell.style;
  399. }
  400. if (Math.random() > 0.5)
  401. {
  402. var update = doc.createElement('update');
  403. update.setAttribute('id', cell.id);
  404. update.setAttribute('value', '<object tooltip="%load%% Done" load="' +
  405. Math.round(Math.random() * 100) + '" placeholders="1">');
  406. update.setAttribute('style', cell.prevStyle + ';fillColor=red;gradientColor=white;');
  407. update.setAttribute('icon', JSON.stringify({tooltip: 'Alert', align: 'right',
  408. valign: 'top', image: {src: 'mxgraph/images/warning.gif', width: 26, height: 26}}));
  409. // update.setAttribute('geometry', JSON.stringify({dx: (Math.random() * 100) - 50,
  410. // y: cell.geometry.y + (Math.random() * 100) - 50, dh: (Math.random() * 100) - 50}));
  411. status.appendChild(update);
  412. // Adds another icon
  413. if (Math.random() > 0.5)
  414. {
  415. var update = doc.createElement('update');
  416. update.setAttribute('id', cell.id);
  417. update.setAttribute('icon', JSON.stringify({tooltip: 'Busy', append: true,
  418. image: {src: IMAGE_PATH + '/spin.gif', width: 26, height:26}}));
  419. status.appendChild(update);
  420. }
  421. }
  422. else
  423. {
  424. var update = doc.createElement('update');
  425. update.setAttribute('id', cell.id);
  426. update.setAttribute('style', cell.prevStyle + ';fillColor=#d4e1f5;gradientColor=white;');
  427. update.setAttribute('value',
  428. '<object tooltip="Click <a href=\"https://www.draw.io\">here</a>">');
  429. update.setAttribute('icon', '');
  430. status.appendChild(update);
  431. }
  432. }
  433. }
  434. }
  435. // var modelNode = mxUtils.parseXml('<model><mxGraphModel> <root> <mxCell id="0"/> <mxCell id="1" parent="0"/> <mxCell id="12" value="Program" style="rounded=0;shadow=0;strokeWidth=1;fontSize=12;fillColor=#F0F0F0;" vertex="1" parent="1"> <mxGeometry x="274" y="227" width="100" height="40" as="geometry"/> </mxCell> <mxCell id="13" value="PDF&#xa;Outline" style="ellipse;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="80" y="247" width="90" height="40" as="geometry"/> </mxCell> <mxCell id="14" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="13" target="12" parent="1"> <mxGeometry relative="1" as="geometry"/> </mxCell> <mxCell id="15" value="HTML&#xa;Outline" style="ellipse;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="118" y="140" width="90" height="40" as="geometry"/> </mxCell> <mxCell id="16" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="15" target="12" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="267" y="158.2814070351758" as="targetPoint"/> </mxGeometry> </mxCell> <mxCell id="17" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="18" target="12" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="413.7317073170732" y="171" as="targetPoint"/> </mxGeometry> </mxCell> <mxCell id="18" value="Name" style="ellipse;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="274" y="100" width="90" height="40" as="geometry"/> </mxCell> <mxCell id="19" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="20" target="12" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="464.5244755244755" y="227" as="targetPoint"/> </mxGeometry> </mxCell> <mxCell id="20" value="Description" style="ellipse;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="437" y="124" width="90" height="40" as="geometry"/> </mxCell> <mxCell id="21" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="22" target="12" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="436.80419580419584" y="319" as="targetPoint"/> </mxGeometry> </mxCell> <mxCell id="22" value="Admission&#xa;Deadline" style="ellipse;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="495" y="216" width="90" height="40" as="geometry"/> </mxCell> <mxCell id="23" value="courses" style="rhombus;whiteSpace=wrap;html=1;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="284" y="349" width="80" height="50" as="geometry"/> </mxCell> <mxCell id="24" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="23" target="12" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="495.26224188188667" y="238.15603653581252" as="sourcePoint"/> <mxPoint x="374" y="244.4537037037037" as="targetPoint"/> </mxGeometry> </mxCell> <mxCell id="25" value="Course" style="rounded=0;shadow=0;strokeWidth=1;fontSize=12;fillColor=#F0F0F0;" vertex="1" parent="1"> <mxGeometry x="274" y="458" width="100" height="40" as="geometry"/> </mxCell> <mxCell id="26" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="23" target="25" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="324" y="349" as="sourcePoint"/> <mxPoint x="324" y="267" as="targetPoint"/> </mxGeometry> </mxCell> <mxCell id="27" value="Course&#xa;Number" style="ellipse;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="80" y="418" width="90" height="40" as="geometry"/> </mxCell> <mxCell id="28" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="27" target="25" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="271.91489361702133" y="652" as="targetPoint"/> </mxGeometry> </mxCell> <mxCell id="29" value="Subject" style="ellipse;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="80" y="514" width="90" height="40" as="geometry"/> </mxCell> <mxCell id="30" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="29" target="25" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="274" y="563.9497487437186" as="targetPoint"/> </mxGeometry> </mxCell> <mxCell id="31" value="PDF&#xa;Outline" style="ellipse;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="163" y="587" width="90" height="40" as="geometry"/> </mxCell> <mxCell id="32" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="31" target="25" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="364" y="584.070351758794" as="targetPoint"/> </mxGeometry> </mxCell> <mxCell id="33" value="HTML&#xa;Outline" style="ellipse;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="279" y="626" width="90" height="40" as="geometry"/> </mxCell> <mxCell id="34" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="33" target="25" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="401.97468354430384" y="537" as="targetPoint"/> </mxGeometry> </mxCell> <mxCell id="35" value="Description" style="ellipse;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="420" y="567" width="90" height="40" as="geometry"/> </mxCell> <mxCell id="36" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="35" target="25" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="465" y="456" as="targetPoint"/> </mxGeometry> </mxCell> <mxCell id="37" value="Name" style="ellipse;rounded=0;shadow=0;strokeWidth=1;fillColor=none;fontSize=12;" vertex="1" parent="1"> <mxGeometry x="495" y="458" width="90" height="40" as="geometry"/> </mxCell> <mxCell id="38" style="rounded=0;html=0;shadow=0;startArrow=none;endArrow=none;endFill=0;endSize=10;strokeColor=#000000;strokeWidth=1;fontSize=12;startFill=0;" edge="1" source="37" target="25" parent="1"> <mxGeometry relative="1" as="geometry"> <mxPoint x="437.1935483870968" y="381" as="targetPoint"/> </mxGeometry> </mxCell> </root></mxGraphModel></model>');
  436. // status.appendChild(modelNode.documentElement);
  437. //
  438. // var fitNode = mxUtils.parseXml('<view scale="0.5" dx="0"/>');
  439. // status.appendChild(fitNode.documentElement);
  440. doc.appendChild(status);
  441. return doc;
  442. };
  443. // Wait for file to be loaded if no animation data is present
  444. if (!startUpdates())
  445. {
  446. editorUi.editor.addListener('fileLoaded', startUpdates);
  447. }
  448. }
  449. });