GraphPageWidget.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. /*##############################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################## */
  16. define([
  17. "dojo/_base/declare",
  18. "dojo/_base/lang",
  19. "dojo/_base/array",
  20. "dojo/_base/Deferred",
  21. "dojo/dom",
  22. "dojo/dom-construct",
  23. "dojo/on",
  24. "dojo/html",
  25. "dojo/store/Memory",
  26. "dojo/store/Observable",
  27. "dijit/layout/BorderContainer",
  28. "dijit/layout/TabContainer",
  29. "dijit/layout/ContentPane",
  30. "dijit/registry",
  31. "dijit/Dialog",
  32. "dojox/html/entities",
  33. "dgrid/OnDemandGrid",
  34. "dgrid/Keyboard",
  35. "dgrid/Selection",
  36. "dgrid/selector",
  37. "dgrid/extensions/ColumnResizer",
  38. "dgrid/extensions/DijitRegistry",
  39. "hpcc/_Widget",
  40. "hpcc/GraphWidget",
  41. "hpcc/ESPUtil",
  42. "hpcc/ESPWorkunit",
  43. "hpcc/TimingGridWidget",
  44. "hpcc/TimingTreeMapWidget",
  45. "dojo/text!../templates/GraphPageWidget.html",
  46. "dijit/PopupMenuItem",
  47. "dijit/Menu",
  48. "dijit/MenuItem",
  49. "dijit/MenuSeparator",
  50. "dijit/Dialog",
  51. "dijit/form/TextBox",
  52. "dijit/form/SimpleTextarea",
  53. "dijit/form/NumberSpinner",
  54. "dijit/form/DropDownButton"
  55. ], function (declare, lang, arrayUtil, Deferred, dom, domConstruct, on, html, Memory, Observable,
  56. BorderContainer, TabContainer, ContentPane, registry, Dialog,
  57. entities,
  58. OnDemandGrid, Keyboard, Selection, selector, ColumnResizer, DijitRegistry,
  59. _Widget, GraphWidget, ESPUtil, ESPWorkunit, TimingGridWidget, TimingTreeMapWidget,
  60. template) {
  61. return declare("GraphPageWidget", [_Widget], {
  62. templateString: template,
  63. baseClass: "GraphPageWidget",
  64. borderContainer: null,
  65. rightBorderContainer: null,
  66. graphName: "",
  67. wu: null,
  68. editorControl: null,
  69. global: null,
  70. main: null,
  71. overview: null,
  72. local: null,
  73. timingGrid: null,
  74. timingTreeMap: null,
  75. subgraphsGrid: null,
  76. verticesGrid: null,
  77. edgesGrid: null,
  78. xgmmlDialog: null,
  79. infoDialog: null,
  80. findField: null,
  81. findText: "",
  82. found: [],
  83. foundIndex: 0,
  84. overviewDepth: null,
  85. localDepth: null,
  86. localDistance: null,
  87. buildRendering: function (args) {
  88. this.inherited(arguments);
  89. },
  90. postCreate: function (args) {
  91. this.inherited(arguments);
  92. this.borderContainer = registry.byId(this.id + "BorderContainer");
  93. this.rightBorderContainer = registry.byId(this.id + "RightBorderContainer");
  94. this.findField = registry.byId(this.id + "FindField");
  95. this.mainDepth = registry.byId(this.id + "MainDepth");
  96. this.overviewDepth = registry.byId(this.id + "OverviewDepth");
  97. this.localDepth = registry.byId(this.id + "LocalDepth");
  98. this.localDistance = registry.byId(this.id + "LocalDistance");
  99. this._initGraphControls();
  100. this._initTimings();
  101. this._initDialogs();
  102. },
  103. startup: function (args) {
  104. this.inherited(arguments);
  105. this._initSubgraphs();
  106. this._initVertices();
  107. this._initEdges();
  108. var splitter = this.borderContainer.getSplitter("right");
  109. this.main.watchSplitter(splitter);
  110. this.overview.watchSplitter(splitter);
  111. this.local.watchSplitter(splitter);
  112. splitter = this.rightBorderContainer.getSplitter("bottom");
  113. this.main.watchSplitter(splitter);
  114. this.overview.watchSplitter(splitter);
  115. this.local.watchSplitter(splitter);
  116. this.main.watchSelect(registry.byId(this.id + "AdvancedMenu"));
  117. },
  118. resize: function (args) {
  119. this.inherited(arguments);
  120. this.borderContainer.resize();
  121. },
  122. layout: function (args) {
  123. this.inherited(arguments);
  124. },
  125. destroy: function (args) {
  126. this.xgmmlDialog.destroyRecursive();
  127. this.infoDialog.destroyRecursive();
  128. this.inherited(arguments);
  129. },
  130. // Implementation ---
  131. _initGraphControls: function () {
  132. var context = this;
  133. this.global = registry.byId(this.id + "GlobalGraphWidget");
  134. this.main = registry.byId(this.id + "MainGraphWidget");
  135. this.main.onSelectionChanged = function (items) {
  136. context.syncSelectionFrom(context.main);
  137. };
  138. this.main.onLayoutFinished = function () {
  139. // TODO: Could be too expensive ---
  140. //context.wu.setGraphSvg(context.graphName, context.main.svg);
  141. };
  142. this.main.onDoubleClick = function (globalID) {
  143. var mainItem = context.main.getItem(globalID);
  144. context.main.centerOnItem(mainItem, true);
  145. };
  146. this.overview = registry.byId(this.id + "MiniGraphWidget");
  147. this.overview.onSelectionChanged = function (items) {
  148. context.syncSelectionFrom(context.overview);
  149. };
  150. this.overview.onDoubleClick = function (globalID) {
  151. var mainItem = context.main.getItem(globalID);
  152. context.main.centerOnItem(mainItem, true);
  153. };
  154. this.local = registry.byId(this.id + "LocalGraphWidget");
  155. this.local.onSelectionChanged = function (items) {
  156. context.syncSelectionFrom(context.local);
  157. };
  158. this.local.onDoubleClick = function (globalID) {
  159. var mainItem = context.main.getItem(globalID);
  160. context._onLocalRefresh();
  161. context.main.centerOnItem(mainItem, true);
  162. context.syncSelectionFrom(context.local);
  163. };
  164. },
  165. _initTimings: function () {
  166. this.timingGrid = registry.byId(this.id + "TimingsGrid");
  167. var context = this;
  168. this.timingGrid.onClick = function (items) {
  169. context.syncSelectionFrom(context.timingGrid);
  170. };
  171. this.timingGrid.onDblClick = function (item) {
  172. var subgraphID = item.SubGraphId;
  173. var mainItem = context.main.getItem(subgraphID);
  174. context.main.centerOnItem(mainItem, true);
  175. };
  176. this.timingTreeMap = registry.byId(this.id + "TimingsTreeMap");
  177. this.timingTreeMap.onClick = function (value) {
  178. context.syncSelectionFrom(context.timingTreeMap);
  179. }
  180. this.timingTreeMap.onDblClick = function (value) {
  181. var mainItem = context.main.getItem(value.SubGraphId);
  182. context.main.centerOnItem(mainItem, true);
  183. }
  184. },
  185. _initDialogs: function () {
  186. var context = this;
  187. this.infoDialog = registry.byId(this.id + "InfoDialog");
  188. on(dom.byId(this.id + "InfoDialogCancel"), "click", function (event) {
  189. context.infoDialog.hide();
  190. });
  191. this.xgmmlDialog = registry.byId(this.id + "XGMMLDialog");
  192. this.xgmmlTextArea = registry.byId(this.id + "XGMMLTextArea");
  193. on(dom.byId(this.id + "XGMMLDialogApply"), "click", function (event) {
  194. context.xgmmlDialog.hide();
  195. if (context.xgmmlDialog.get("hpccMode") === "XGMML") {
  196. var xgmml = context.xgmmlTextArea.get("value");
  197. context.loadGraphFromXGMML(xgmml);
  198. } else if (context.xgmmlDialog.get("hpccMode") === "DOT") {
  199. var dot = context.xgmmlTextArea.get("value");
  200. context.loadGraphFromDOT(dot);
  201. } else if (context.xgmmlDialog.get("hpccMode") === "DOTATTRS") {
  202. var dotAttrs = context.xgmmlTextArea.get("value");
  203. context.global.setDotMetaAttributes(dotAttrs);
  204. context.main.setDotMetaAttributes(dotAttrs);
  205. context.overview.setDotMetaAttributes(dotAttrs);
  206. context.local.setDotMetaAttributes(dotAttrs);
  207. context._onMainRefresh();
  208. }
  209. });
  210. on(dom.byId(this.id + "XGMMLDialogCancel"), "click", function (event) {
  211. context.xgmmlDialog.hide();
  212. });
  213. },
  214. _initItemGrid: function (grid) {
  215. var context = this;
  216. grid.on(".dgrid-row:click", function (evt) {
  217. context.syncSelectionFrom(grid);
  218. });
  219. grid.on(".dgrid-row:dblclick", function (evt) {
  220. var item = grid.row(evt).data;
  221. if (item._globalID) {
  222. var mainItem = context.main.getItem(item._globalID);
  223. context.main.centerOnItem(mainItem, true);
  224. }
  225. });
  226. },
  227. _initSubgraphs: function () {
  228. var store = new Memory({
  229. idProperty: "id",
  230. data: []
  231. });
  232. this.subgraphsStore = Observable(store);
  233. this.subgraphsGrid = new declare([OnDemandGrid, Keyboard, Selection, ColumnResizer, DijitRegistry, ESPUtil.GridHelper])({
  234. store: this.subgraphsStore
  235. }, this.id + "SubgraphsGrid");
  236. this._initItemGrid(this.subgraphsGrid);
  237. },
  238. _initVertices: function () {
  239. var store = new Memory({
  240. idProperty: "id",
  241. data: []
  242. });
  243. this.verticesStore = Observable(store);
  244. this.verticesGrid = new declare([OnDemandGrid, Keyboard, Selection, ColumnResizer, DijitRegistry, ESPUtil.GridHelper])({
  245. store: this.verticesStore
  246. }, this.id + "VerticesGrid");
  247. this._initItemGrid(this.verticesGrid);
  248. },
  249. _initEdges: function () {
  250. var store = new Memory({
  251. idProperty: "id",
  252. data: []
  253. });
  254. this.edgesStore = Observable(store);
  255. this.edgesGrid = new declare([OnDemandGrid, Keyboard, Selection, ColumnResizer, DijitRegistry, ESPUtil.GridHelper])({
  256. store: this.edgesStore
  257. }, this.id + "EdgesGrid");
  258. this._initItemGrid(this.edgesGrid);
  259. },
  260. _onMainRefresh: function () {
  261. this.main.setMessage("Performing Layout...");
  262. this.main.startLayout("dot");
  263. },
  264. _onLocalRefresh: function () {
  265. this.refreshLocal(this.local.getSelectionAsGlobalID());
  266. },
  267. _doFind: function (prev) {
  268. if (this.findText != this.findField.value) {
  269. this.findText = this.findField.value;
  270. this.found = this.global.findAsGlobalID(this.findText);
  271. this.global.setSelectedAsGlobalID(this.found);
  272. this.syncSelectionFrom(this.global);
  273. this.foundIndex = -1;
  274. }
  275. this.foundIndex += prev ? -1 : +1;
  276. if (this.foundIndex < 0) {
  277. this.foundIndex = this.found.length - 1;
  278. } else if (this.foundIndex >= this.found.length) {
  279. this.foundIndex = 0;
  280. }
  281. if (this.found.length) {
  282. this.main.centerOnGlobalID(this.found[this.foundIndex], true);
  283. this.local.centerOnGlobalID(this.found[this.foundIndex], true);
  284. }
  285. },
  286. _onFind: function (prev) {
  287. this.findText = "";
  288. this._doFind(false);
  289. },
  290. _onFindNext: function () {
  291. this._doFind(false);
  292. },
  293. _onFindPrevious: function () {
  294. this._doFind(true);
  295. },
  296. _onAbout: function () {
  297. html.set(dom.byId(this.id + "InfoDialogContent"), "<div style='width: 320px; height: 120px; text-align: center;'><p>Version: " + this.main.getVersion() + "</p><p>" + this.main.getResourceLinks() + "</p>");
  298. this.infoDialog.set("title", "About HPCC Systems Graph Control");
  299. this.infoDialog.show();
  300. },
  301. _onGetSVG: function () {
  302. html.set(dom.byId(this.id + "InfoDialogContent"), "<textarea rows='25' cols='80'>" + entities.encode(this.main.getSVG()) + "</textarea>");
  303. this.infoDialog.set("title", "SVG Source");
  304. this.infoDialog.show();
  305. },
  306. _onRenderSVG: function () {
  307. var context = this
  308. this.main.localLayout(function (svg) {
  309. html.set(dom.byId(context.id + "InfoDialogContent"), "<div style='border: 1px inset grey; width: 640px; height: 480px; overflow : auto; '>" + svg + "</div>");
  310. context.infoDialog.set("title", "Rendered SVG");
  311. context.infoDialog.show();
  312. });
  313. },
  314. _onGetXGMML: function () {
  315. this.xgmmlDialog.set("title", "XGMML");
  316. this.xgmmlDialog.set("hpccMode", "XGMML");
  317. this.xgmmlTextArea.set("value", this.main.getXGMML());
  318. this.xgmmlDialog.show();
  319. },
  320. _onEditDOT: function () {
  321. this.xgmmlDialog.set("title", "DOT");
  322. this.xgmmlDialog.set("hpccMode", "DOT");
  323. this.xgmmlTextArea.set("value", this.main.getDOT());
  324. this.xgmmlDialog.show();
  325. },
  326. _onGetGraphAttributes: function () {
  327. this.xgmmlDialog.set("title", "DOT Attributes");
  328. this.xgmmlDialog.set("hpccMode", "DOTATTRS");
  329. this.xgmmlTextArea.set("value", this.global.getDotMetaAttributes());
  330. this.xgmmlDialog.show();
  331. },
  332. _onMainDepthChange: function (value) {
  333. this.refreshMain();
  334. },
  335. _onOverviewDepthChange: function (value) {
  336. this.refreshOverview();
  337. },
  338. _onLocalDepthChange: function (value) {
  339. this._onLocalRefresh();
  340. },
  341. _onLocalDistanceChange: function (value) {
  342. this._onLocalRefresh();
  343. },
  344. init: function (params) {
  345. if (this.inherited(arguments))
  346. return;
  347. if (params.SafeMode && params.SafeMode != "false") {
  348. this.overviewDepth.set("value", 0)
  349. this.mainDepth.set("value", 1)
  350. this.localDepth.set("value", 2)
  351. var dotAttrs = this.global.getDotMetaAttributes();
  352. dotAttrs += "\r\ngraph[splines=\"line\"];";
  353. this.global.setDotMetaAttributes(dotAttrs);
  354. }
  355. if (params.Wuid) {
  356. this.graphName = params.GraphName;
  357. this.wu = ESPWorkunit.Get(params.Wuid);
  358. var firstLoad = true;
  359. var context = this;
  360. this.wu.monitor(function () {
  361. context.wu.getInfo({
  362. onGetApplicationValues: function (applicationValues) {
  363. },
  364. onGetGraphs: function (graphs) {
  365. if (firstLoad == true) {
  366. firstLoad = false;
  367. context.loadGraph(context.wu, context.graphName).then(function (response) {
  368. context.refresh(params);
  369. });
  370. } else {
  371. context.refreshGraph(context.wu, context.graphName);
  372. }
  373. }
  374. });
  375. });
  376. }
  377. this.timingGrid.init(lang.mixin({
  378. query: this.graphName
  379. }, params));
  380. this.timingTreeMap.init(lang.mixin({
  381. query: this.graphName,
  382. hideHelp: true
  383. }, params));
  384. },
  385. refresh: function (params) {
  386. if (params && params.SubGraphId) {
  387. this.global.setSelectedAsGlobalID([params.SubGraphId]);
  388. this.syncSelectionFrom(this.global);
  389. }
  390. },
  391. loadGraphFromXGMML: function (xgmml) {
  392. this.global.loadXGMML(xgmml, false);
  393. this.refreshMain();
  394. this.refreshOverview();
  395. this.loadSubgraphs();
  396. this.loadVertices();
  397. this.loadEdges();
  398. },
  399. loadGraphFromDOT: function (dot) {
  400. this.global.loadDOT(dot);
  401. this.refreshMain();
  402. this.refreshOverview();
  403. this.loadSubgraphs();
  404. this.loadVertices();
  405. this.loadEdges();
  406. },
  407. loadGraph: function (wu, graphName) {
  408. var deferred = new Deferred();
  409. this.overview.setMessage("Fetching Data...");
  410. this.main.setMessage("Fetching Data...");
  411. this.local.setMessage("Fetching Data...");
  412. var context = this;
  413. wu.fetchGraphXgmmlByName(graphName, function (xgmml, svg) {
  414. context.overview.setMessage("");
  415. context.main.setMessage("");
  416. context.local.setMessage("");
  417. context.loadGraphFromXGMML(xgmml, svg);
  418. deferred.resolve();
  419. });
  420. return deferred.promise;
  421. },
  422. refreshGraph: function (wu, graphName) {
  423. var context = this;
  424. wu.fetchGraphXgmmlByName(graphName, function (xgmml) {
  425. context.main.mergeXGMML(xgmml);
  426. context.loadSubgraphs();
  427. context.loadVertices();
  428. context.loadEdges();
  429. });
  430. },
  431. loadSubgraphs: function () {
  432. var subgraphs = this.main.getSubgraphsWithProperties();
  433. var layoutMap = [];
  434. for (var i = 0; i < subgraphs.length; ++i) {
  435. for (var key in subgraphs[i]) {
  436. if (key != "id" && key.substring(0, 1) != "_") {
  437. layoutMap[key] = true;
  438. }
  439. }
  440. }
  441. var layout = [
  442. { label: "ID", field: "id", width: 50 }
  443. ];
  444. for (var key in layoutMap) {
  445. layout.push({ label: key, field: key, width: 100 });
  446. }
  447. this.subgraphsStore.setData(subgraphs);
  448. this.subgraphsGrid.set("columns", layout);
  449. this.subgraphsGrid.refresh();
  450. },
  451. loadVertices: function () {
  452. var vertices = this.main.getVerticesWithProperties();
  453. var layoutMap = [];
  454. for (var i = 0; i < vertices.length; ++i) {
  455. for (var key in vertices[i]) {
  456. if (key != "id" && key != "ecl" && key != "label" && key.substring(0, 1) != "_") {
  457. layoutMap[key] = true;
  458. }
  459. }
  460. }
  461. var layout = [
  462. { label: "ID", field: "id", width: 50 },
  463. { label: "Label", field: "label", width: 150 }
  464. ];
  465. for (var key in layoutMap) {
  466. layout.push({ label: key, field: key, width: 200 });
  467. }
  468. layout.push({ label: "ECL", field: "ecl", width: 1024 });
  469. this.verticesStore.setData(vertices);
  470. this.verticesGrid.set("columns", layout);
  471. this.verticesGrid.refresh();
  472. },
  473. loadEdges: function () {
  474. var edges = this.main.getEdgesWithProperties();
  475. var layoutMap = [];
  476. for (var i = 0; i < edges.length; ++i) {
  477. for (var key in edges[i]) {
  478. if (key != "id" && key.substring(0, 1) != "_") {
  479. layoutMap[key] = true;
  480. }
  481. }
  482. }
  483. var layout = [
  484. { label: "ID", field: "id", width: 50 }
  485. ];
  486. for (var key in layoutMap) {
  487. layout.push({ label: key, field: key, width: 100 });
  488. }
  489. this.edgesStore.setData(edges);
  490. this.edgesGrid.set("columns", layout);
  491. this.edgesGrid.refresh();
  492. },
  493. syncSelectionFrom: function (sourceControl) {
  494. var selectedGlobalIDs = [];
  495. // Get Selected Items ---
  496. if (sourceControl == this.timingGrid || sourceControl == this.timingTreeMap) {
  497. var items = sourceControl.getSelected();
  498. for (var i = 0; i < items.length; ++i) {
  499. if (items[i].SubGraphId) {
  500. selectedGlobalIDs.push(items[i].SubGraphId);
  501. }
  502. }
  503. } else if (sourceControl == this.verticesGrid || sourceControl == this.edgesGrid || sourceControl == this.subgraphsGrid) {
  504. var items = sourceControl.getSelected();
  505. for (var i = 0; i < items.length; ++i) {
  506. if (items[i]._globalID) {
  507. selectedGlobalIDs.push(items[i]._globalID);
  508. }
  509. }
  510. } else {
  511. selectedGlobalIDs = sourceControl.getSelectionAsGlobalID();
  512. }
  513. // Set Selected Items ---
  514. if (sourceControl != this.timingGrid) {
  515. this.timingGrid.setSelectedAsGlobalID(selectedGlobalIDs);
  516. }
  517. if (sourceControl != this.timingTreeMap) {
  518. this.timingTreeMap.setSelectedAsGlobalID(selectedGlobalIDs);
  519. }
  520. if (sourceControl != this.subgraphsGrid && this.subgraphsGrid.store) {
  521. this.subgraphsGrid.setSelection(selectedGlobalIDs);
  522. }
  523. if (sourceControl != this.verticesGrid && this.verticesGrid.store) {
  524. this.verticesGrid.setSelection(selectedGlobalIDs);
  525. }
  526. if (sourceControl != this.edgesGrid && this.edgesGrid.store) {
  527. this.edgesGrid.setSelection(selectedGlobalIDs);
  528. }
  529. if (sourceControl != this.main) {
  530. this.main.setSelectedAsGlobalID(selectedGlobalIDs);
  531. }
  532. if (sourceControl != this.overview) {
  533. this.overview.setSelectedAsGlobalID(selectedGlobalIDs);
  534. }
  535. if (sourceControl != this.local) {
  536. this.refreshLocal(selectedGlobalIDs);
  537. }
  538. var propertiesDom = dom.byId(this.id + "Properties");
  539. propertiesDom.innerHTML = "";
  540. for (var i = 0; i < selectedGlobalIDs.length; ++i) {
  541. this.global.displayProperties(selectedGlobalIDs[i], propertiesDom);
  542. }
  543. },
  544. resetPage: function () {
  545. this.main.clear();
  546. },
  547. refreshMain: function () {
  548. var xgmml = this.global.getLocalisedXGMML([0], this.mainDepth.get("value"));
  549. this.main.loadXGMML(xgmml);
  550. },
  551. refreshOverview: function () {
  552. var xgmml = this.global.getLocalisedXGMML([0], this.overviewDepth.get("value"));
  553. this.overview.loadXGMML(xgmml);
  554. },
  555. refreshLocal: function (selectedGlobalIDs) {
  556. var globalItems = [];
  557. for (var i = 0; i < selectedGlobalIDs.length; ++i) {
  558. globalItems.push(this.global.getItem(selectedGlobalIDs[i]));
  559. }
  560. var xgmml = this.global.getLocalisedXGMML(globalItems, this.localDepth.get("value"), this.localDistance.get("value"));
  561. this.local.loadXGMML(xgmml);
  562. this.local.setSelectedAsGlobalID(selectedGlobalIDs);
  563. },
  564. displayGraphs: function (graphs) {
  565. for (var i = 0; i < graphs.length; ++i) {
  566. this.wu.fetchGraphXgmml(i, function (xgmml) {
  567. this.main.loadXGMML(xgmml, true);
  568. });
  569. }
  570. }
  571. });
  572. });