DFUQueryWidget.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  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/i18n",
  20. "dojo/i18n!./nls/common",
  21. "dojo/i18n!./nls/DFUQueryWidget",
  22. "dojo/_base/array",
  23. "dojo/dom",
  24. "dojo/dom-attr",
  25. "dojo/dom-construct",
  26. "dojo/dom-class",
  27. "dojo/dom-form",
  28. "dojo/date",
  29. "dojo/on",
  30. "dijit/registry",
  31. "dijit/Dialog",
  32. "dijit/Menu",
  33. "dijit/MenuItem",
  34. "dijit/MenuSeparator",
  35. "dijit/PopupMenuItem",
  36. "dijit/form/Textarea",
  37. "dijit/form/ValidationTextBox",
  38. "dgrid/Grid",
  39. "dgrid/Keyboard",
  40. "dgrid/Selection",
  41. "dgrid/editor",
  42. "dgrid/selector",
  43. "dgrid/extensions/ColumnResizer",
  44. "dgrid/extensions/DijitRegistry",
  45. "dgrid/extensions/Pagination",
  46. "hpcc/_TabContainerWidget",
  47. "hpcc/WsDfu",
  48. "hpcc/FileSpray",
  49. "hpcc/ESPUtil",
  50. "hpcc/ESPLogicalFile",
  51. "hpcc/ESPDFUWorkunit",
  52. "hpcc/LFDetailsWidget",
  53. "hpcc/SFDetailsWidget",
  54. "hpcc/DFUWUDetailsWidget",
  55. "hpcc/TargetSelectWidget",
  56. "hpcc/FilterDropDownWidget",
  57. "hpcc/SelectionGridWidget",
  58. "dojo/text!../templates/DFUQueryWidget.html",
  59. "dijit/layout/BorderContainer",
  60. "dijit/layout/TabContainer",
  61. "dijit/layout/ContentPane",
  62. "dijit/form/DateTextBox",
  63. "dijit/form/TimeTextBox",
  64. "dijit/form/Button",
  65. "dijit/form/DropDownButton",
  66. "dijit/form/Select",
  67. "dijit/Toolbar",
  68. "dijit/TooltipDialog",
  69. "dijit/Fieldset",
  70. "hpcc/TableContainer"
  71. ], function (declare, lang, i18n, nlsCommon, nlsSpecific, arrayUtil, dom, domAttr, domConstruct, domClass, domForm, date, on,
  72. registry, Dialog, Menu, MenuItem, MenuSeparator, PopupMenuItem, Textarea, ValidationTextBox,
  73. Grid, Keyboard, Selection, editor, selector, ColumnResizer, DijitRegistry, Pagination,
  74. _TabContainerWidget, WsDfu, FileSpray, ESPUtil, ESPLogicalFile, ESPDFUWorkunit, LFDetailsWidget, SFDetailsWidget, DFUWUDetailsWidget, TargetSelectWidget, FilterDropDownWidget, SelectionGridWidget,
  75. template) {
  76. return declare("DFUQueryWidget", [_TabContainerWidget, ESPUtil.FormHelper], {
  77. templateString: template,
  78. baseClass: "DFUQueryWidget",
  79. i18n: lang.mixin(nlsCommon, nlsSpecific),
  80. postCreate: function (args) {
  81. this.inherited(arguments);
  82. this.workunitsTab = registry.byId(this.id + "_Workunits");
  83. this.filter = registry.byId(this.id + "Filter");
  84. this.clusterTargetSelect = registry.byId(this.id + "ClusterTargetSelect");
  85. this.importForm = registry.byId(this.id + "ImportForm");
  86. this.importTargetSelect = registry.byId(this.id + "ImportTargetSelect");
  87. this.copyForm = registry.byId(this.id + "CopyForm");
  88. this.copyTargetSelect = registry.byId(this.id + "CopyTargetSelect");
  89. this.copyGrid = registry.byId(this.id + "CopyGrid");
  90. this.renameForm = registry.byId(this.id + "RenameForm");
  91. this.renameGrid = registry.byId(this.id + "RenameGrid");
  92. this.addToSuperFileForm = registry.byId(this.id + "AddToSuperfileForm");
  93. this.addToSuperfileGrid = registry.byId(this.id + "AddToSuperfileGrid");
  94. this.desprayForm = registry.byId(this.id + "DesprayForm");
  95. this.desprayTargetSelect = registry.byId(this.id + "DesprayTargetSelect");
  96. this.desprayGrid = registry.byId(this.id + "DesprayGrid");
  97. },
  98. startup: function (args) {
  99. this.inherited(arguments);
  100. this.initContextMenu();
  101. this.initFilter();
  102. },
  103. getTitle: function () {
  104. return this.i18n.title;
  105. },
  106. // Hitched actions ---
  107. _onRefresh: function (event) {
  108. this.refreshGrid();
  109. },
  110. _onOpen: function (event) {
  111. var selections = this.workunitsGrid.getSelected();
  112. var firstTab = null;
  113. for (var i = selections.length - 1; i >= 0; --i) {
  114. var tab = this.ensureLFPane(this.id + "_" + selections[i].Name, selections[i]);
  115. if (i == 0) {
  116. firstTab = tab;
  117. }
  118. }
  119. if (firstTab) {
  120. this.selectChild(firstTab, true);
  121. }
  122. },
  123. _onDelete: function (event) {
  124. if (confirm(this.i18n.DeleteSelectedFiles)) {
  125. var context = this;
  126. WsDfu.DFUArrayAction(this.workunitsGrid.getSelected(), this.i18n.Delete, {
  127. load: function (response) {
  128. context.refreshGrid(true);
  129. }
  130. });
  131. }
  132. },
  133. _handleResponse: function (wuidQualifier, response) {
  134. if (lang.exists(wuidQualifier, response)) {
  135. var wu = ESPDFUWorkunit.Get(lang.getObject(wuidQualifier, false, response));
  136. wu.startMonitor(true);
  137. var tab = this.ensureDFUWUPane(this.id + "_" + wu.ID, {
  138. Wuid: wu.ID
  139. });
  140. if (tab) {
  141. this.selectChild(tab);
  142. }
  143. }
  144. },
  145. _onImportOk: function (event) {
  146. if (this.importForm.validate()) {
  147. var request = domForm.toObject(this.importForm.id);
  148. var context = this;
  149. FileSpray.Copy({
  150. request: request
  151. }).then(function (response) {
  152. context._handleResponse("CopyResponse.result", response);
  153. });
  154. registry.byId(this.id + "ImportDropDown").closeDropDown();
  155. }
  156. },
  157. _onCopyOk: function (event) {
  158. if (this.copyForm.validate()) {
  159. var context = this;
  160. arrayUtil.forEach(this.copyGrid.store.data, function (item, idx) {
  161. var logicalFile = ESPLogicalFile.Get(item.Name);
  162. var request = domForm.toObject(context.id + "CopyForm");
  163. request.RenameSourceName = item.Name;
  164. request.destLogicalName = item.targetCopyName;
  165. logicalFile.copy({
  166. request: request
  167. }).then(function (response) {
  168. context._handleResponse("CopyResponse.result", response);
  169. });
  170. });
  171. registry.byId(this.id + "CopyDropDown").closeDropDown();
  172. }
  173. },
  174. _onRenameOk: function (event) {
  175. if (this.renameForm.validate()) {
  176. var context = this;
  177. arrayUtil.forEach(this.renameGrid.store.data, function (item, idx) {
  178. var logicalFile = ESPLogicalFile.Get(item.Name);
  179. var request = domForm.toObject(context.id + "RenameForm");
  180. request.RenameSourceName = item.Name;
  181. request.dstname = item.targetRenameName;
  182. logicalFile.rename({
  183. request: request
  184. }).then(function (response) {
  185. context._handleResponse("RenameResponse.wuid", response);
  186. });
  187. });
  188. registry.byId(this.id + "RenameDropDown").closeDropDown();
  189. }
  190. },
  191. _onAddToSuperfileOk: function (event) {
  192. if (this.addToSuperFileForm.validate()) {
  193. var context = this;
  194. var formData = domForm.toObject(this.id + "AddToSuperfileForm");
  195. WsDfu.AddtoSuperfile(this.workunitsGrid.getSelected(), formData.Superfile, formData.ExistingFile, {
  196. load: function (response) {
  197. context.refreshGrid();
  198. }
  199. });
  200. registry.byId(this.id + "AddtoDropDown").closeDropDown();
  201. }
  202. },
  203. _onDesprayOk: function (event) {
  204. if (this.desprayForm.validate()) {
  205. var context = this;
  206. arrayUtil.forEach(this.desprayGrid.store.data, function (item, idx) {
  207. var request = domForm.toObject(context.id + "DesprayForm");
  208. if (!context.endsWith(request.destPath, "/")) {
  209. request.destPath += "/";
  210. }
  211. request.destPath += item.targetName;
  212. item.despray({
  213. request: request
  214. }).then(function (response) {
  215. context._handleResponse("DesprayResponse.wuid", response);
  216. });
  217. });
  218. registry.byId(this.id + "DesprayDropDown").closeDropDown();
  219. }
  220. },
  221. _onRowDblClick: function (item) {
  222. var wuTab = this.ensureLFPane(this.id + "_" + item.Name, item);
  223. this.selectChild(wuTab);
  224. },
  225. _onRowContextMenu: function (item, colField, mystring) {
  226. this.menuFilterOwner.set("disabled", false);
  227. this.menuFilterCluster.set("disabled", false);
  228. if (item) {
  229. this.menuFilterOwner.set("label", this.i18n.Owner + ": " + item.Owner);
  230. this.menuFilterOwner.set("hpcc_value", item.Owner);
  231. this.menuFilterCluster.set("label", this.i18n.Cluster + ": " + item.ClusterName);
  232. this.menuFilterCluster.set("hpcc_value", item.ClusterName);
  233. }
  234. if (item.Owner == "") {
  235. this.menuFilterOwner.set("disabled", true);
  236. this.menuFilterOwner.set("label", this.i18n.Owner + ": " + this.i18n.NA);
  237. }
  238. if (item.ClusterName == "") {
  239. this.menuFilterCluster.set("disabled", true);
  240. this.menuFilterCluster.set("label", this.i18n.Cluster + ": " + this.i18n.NA);
  241. }
  242. },
  243. // Implementation ---
  244. getFilter: function () {
  245. var retVal = this.filter.toObject();
  246. lang.mixin(retVal, {
  247. StartDate: this.getISOString("FromDate", "FromTime"),
  248. EndDate: this.getISOString("ToDate", "ToTime")
  249. });
  250. if (retVal.StartDate != "" && retVal.EndDate != "") {
  251. } else if (retVal.FirstN) {
  252. var now = new Date();
  253. retVal.StartDate = date.add(now, "day", retVal.LastNDays * -1).toISOString();
  254. retVal.EndDate = now.toISOString();
  255. }
  256. return retVal;
  257. },
  258. // Implementation ---
  259. init: function (params) {
  260. if (this.inherited(arguments))
  261. return;
  262. this.clusterTargetSelect.init({
  263. Groups: true,
  264. includeBlank: true
  265. });
  266. var context = this;
  267. this.importTargetSelect.init({
  268. Groups: true
  269. });
  270. this.copyTargetSelect.init({
  271. Groups: true
  272. });
  273. this.desprayTargetSelect.init({
  274. DropZones: true,
  275. callback: function (value, item) {
  276. registry.byId(context.id + "DesprayTargetIPAddress").set("value", item.machine.Netaddress);
  277. registry.byId(context.id + "DesprayTargetPath").set("value", item.machine.Directory + "/");
  278. }
  279. });
  280. this.initWorkunitsGrid();
  281. this.selectChild(this.workunitsTab, true);
  282. this.filter.on("clear", function (evt) {
  283. context.refreshGrid();
  284. });
  285. this.filter.on("apply", function (evt) {
  286. context.refreshGrid();
  287. });
  288. },
  289. initTab: function() {
  290. var currSel = this.getSelectedChild();
  291. if (currSel && !currSel.initalized) {
  292. if (currSel.id == this.workunitsTab.id) {
  293. } else {
  294. if (!currSel.initalized) {
  295. currSel.init(currSel._hpccParams);
  296. }
  297. }
  298. }
  299. },
  300. addMenuItem: function (menu, details) {
  301. var menuItem = new MenuItem(details);
  302. menu.addChild(menuItem);
  303. return menuItem;
  304. },
  305. initContextMenu: function() {
  306. var context = this;
  307. var pMenu = new Menu({
  308. targetNodeIds: [this.id + "WorkunitsGrid"]
  309. });
  310. pMenu.addChild(new MenuItem({
  311. label: this.i18n.Refresh,
  312. onClick: function(args){context._onRefresh();}
  313. }));
  314. pMenu.addChild(new MenuSeparator());
  315. pMenu.addChild(new MenuItem({
  316. label: this.i18n.Open,
  317. onClick: function(args){context._onOpen();}
  318. }));
  319. pMenu.addChild(new MenuItem({
  320. label: this.i18n.Delete,
  321. onClick: function(args){context._onDelete();}
  322. }));
  323. pMenu.addChild(new MenuItem({
  324. label: this.i18n.AddToSuperfile,
  325. onClick: function(args){dijit.byId(context.id+"AddtoDropDown").openDropDown()}
  326. }));
  327. pMenu.addChild(new MenuSeparator());
  328. {
  329. var pSubMenu = new Menu();
  330. this.menuFilterOwner = this.addMenuItem(pSubMenu, {
  331. onClick: function (args) {
  332. context.filter.clear();
  333. context.filter.setValue(context.id + "Owner", context.menuFilterOwner.get("hpcc_value"));
  334. context.refreshGrid();
  335. }
  336. });
  337. this.menuFilterCluster = this.addMenuItem(pSubMenu, {
  338. onClick: function (args) {
  339. context.filter.clear();
  340. context.filter.setValue(context.id + "ClusterTargetSelect", context.menuFilterCluster.get("hpcc_value"));
  341. context.refreshGrid();
  342. }
  343. });
  344. pSubMenu.addChild(new MenuSeparator());
  345. this.menuFilterClearFilter = this.addMenuItem(pSubMenu, {
  346. label: this.i18n.Clear,
  347. onClick: function () {
  348. context.filter.clear();
  349. context.refreshGrid();
  350. }
  351. });
  352. pMenu.addChild(new PopupMenuItem({
  353. label: this.i18n.Filter,
  354. popup: pSubMenu
  355. }));
  356. }
  357. pMenu.startup();
  358. },
  359. initWorkunitsGrid: function() {
  360. var store = new ESPLogicalFile.CreateLFQueryStore();
  361. this.workunitsGrid = new declare([Grid, Pagination, Selection, ColumnResizer, Keyboard, DijitRegistry, ESPUtil.GridHelper])({
  362. allowSelectAll: true,
  363. deselectOnRefresh: false,
  364. store: store,
  365. rowsPerPage: 50,
  366. pagingLinks: 1,
  367. pagingTextBox: true,
  368. firstLastArrows: true,
  369. pageSizeOptions: [25, 50, 100],
  370. columns: {
  371. col1: selector({
  372. width: 27,
  373. selectorType: 'checkbox'
  374. }),
  375. isZipfile: {
  376. label: "C", width: 16, sortable: false,
  377. formatter: function (compressed) {
  378. if (compressed == true) {
  379. return "C";
  380. }
  381. return "";
  382. }
  383. },
  384. IsKeyFile: {
  385. label: "K", width: 16, sortable: false,
  386. formatter: function (keyfile) {
  387. if (keyfile == true) {
  388. return "K";
  389. }
  390. return "";
  391. }
  392. },
  393. isSuperfile: {
  394. label: "S", width: 16, sortable: false,
  395. formatter: function (superfile) {
  396. if (superfile == true) {
  397. return "S";
  398. }
  399. return "";
  400. }
  401. },
  402. Name: {
  403. label: this.i18n.LogicalName,
  404. formatter: function (name, idx) {
  405. return "<a href='#' rowIndex=" + idx + " class='" + context.id + "LogicalNameClick'>" + name + "</a>";
  406. }
  407. },
  408. Owner: { label: this.i18n.Owner, width: 72 },
  409. Description: { label: this.i18n.Description, width: 153 },
  410. ClusterName: { label: this.i18n.Cluster, width: 108 },
  411. RecordCount: { label: this.i18n.Records, width: 72, sortable: false },
  412. Totalsize: { label: this.i18n.Size, width: 72, sortable: false },
  413. Parts: { label: this.i18n.Parts, width: 45, sortable: false },
  414. Modified: { label: this.i18n.ModifiedUTCGMT, width: 155, sortable: false }
  415. }
  416. }, this.id + "WorkunitsGrid");
  417. this.workunitsGrid.noDataMessage = "<span class='dojoxGridNoData'>" + this.i18n.noDataMessage + "</span>";
  418. var context = this;
  419. on(document, "." + context.id + "LogicalNameClick:click", function (evt) {
  420. if (context._onRowDblClick) {
  421. var item = context.workunitsGrid.row(evt).data;
  422. context._onRowDblClick(item);
  423. }
  424. });
  425. this.workunitsGrid.on(".dgrid-row:dblclick", function (evt) {
  426. if (context._onRowDblClick) {
  427. var item = context.workunitsGrid.row(evt).data;
  428. context._onRowDblClick(item);
  429. }
  430. });
  431. this.workunitsGrid.on(".dgrid-row:contextmenu", function (evt) {
  432. if (context._onRowContextMenu) {
  433. var item = context.workunitsGrid.row(evt).data;
  434. var cell = context.workunitsGrid.cell(evt);
  435. var colField = cell.column.field;
  436. var mystring = "item." + colField;
  437. context._onRowContextMenu(item, colField, mystring);
  438. }
  439. });
  440. this.workunitsGrid.onSelectionChanged(function (event) {
  441. context.refreshActionState();
  442. });
  443. this.workunitsGrid.onContentChanged(function (object, removedFrom, insertedInto) {
  444. context.refreshActionState();
  445. });
  446. this.workunitsGrid.startup();
  447. this.copyGrid.createGrid({
  448. idProperty: "Name",
  449. columns: {
  450. targetCopyName: editor({
  451. label: this.i18n.TargetName,
  452. width: 144,
  453. autoSave: true,
  454. editor: "text"
  455. })
  456. }
  457. });
  458. this.renameGrid.createGrid({
  459. idProperty: "Name",
  460. columns: {
  461. targetRenameName: editor({
  462. label: this.i18n.TargetName,
  463. width: 144,
  464. autoSave: true,
  465. editor: "text"
  466. })
  467. }
  468. });
  469. this.addToSuperfileGrid.createGrid({
  470. idProperty: "Name",
  471. columns: {
  472. Name: {
  473. label: this.i18n.LogicalName
  474. }
  475. }
  476. });
  477. this.desprayGrid.createGrid({
  478. idProperty: "Name",
  479. columns: {
  480. Name: {
  481. label: this.i18n.LogicalName
  482. },
  483. targetName: editor({
  484. label: this.i18n.TargetName,
  485. width: 144,
  486. autoSave: true,
  487. editor: "text"
  488. })
  489. }
  490. });
  491. },
  492. initFilter: function () {
  493. this.validateDialog = new Dialog({
  494. title: this.i18n.Filter,
  495. content: this.i18n.NoFilterCriteriaSpecified
  496. });
  497. },
  498. refreshGrid: function (clearSelection) {
  499. this.workunitsGrid.set("query", this.getFilter());
  500. if (clearSelection) {
  501. this.workunitsGrid.clearSelection();
  502. }
  503. },
  504. refreshActionState: function () {
  505. var selection = this.workunitsGrid.getSelected();
  506. var hasSelection = false;
  507. for (var i = 0; i < selection.length; ++i) {
  508. hasSelection = true;
  509. }
  510. registry.byId(this.id + "Open").set("disabled", !hasSelection);
  511. registry.byId(this.id + "Delete").set("disabled", !hasSelection);
  512. registry.byId(this.id + "CopyDropDown").set("disabled", !hasSelection);
  513. registry.byId(this.id + "RenameDropDown").set("disabled", !hasSelection);
  514. registry.byId(this.id + "AddtoDropDown").set("disabled", !hasSelection);
  515. registry.byId(this.id + "AddtoDropDown").set("disabled", !hasSelection);
  516. registry.byId(this.id + "DesprayDropDown").set("disabled", !hasSelection);
  517. if (hasSelection) {
  518. var context = this;
  519. var data = [];
  520. var matchedPrefix = [];
  521. arrayUtil.forEach(selection, function (item, idx) {
  522. var nameParts = item.Name.split("::");
  523. if (idx === 0) {
  524. matchedPrefix = nameParts.slice(0, nameParts.length - 1);
  525. } else {
  526. var i = 0;
  527. for (var i = 0; i < matchedPrefix.length && i < nameParts.length - 1; ++i) {
  528. if (matchedPrefix[i] !== nameParts[i]) {
  529. break;
  530. }
  531. }
  532. matchedPrefix = matchedPrefix.slice(0, i);
  533. }
  534. lang.mixin(item, {
  535. targetName: nameParts[nameParts.length - 1],
  536. targetCopyName: item.Name + "_copy",
  537. targetRenameName: item.Name + "_rename"
  538. });
  539. data.push(item);
  540. });
  541. registry.byId(this.id + "AddToSuperfileTargetName").set("value", matchedPrefix.join("::") + "::superfile");
  542. this.copyGrid.setData(data);
  543. this.renameGrid.setData(data);
  544. this.addToSuperfileGrid.setData(data);
  545. this.desprayGrid.setData(data);
  546. }
  547. },
  548. ensureDFUWUPane: function (id, params) {
  549. var retVal = registry.byId(id);
  550. if (!retVal) {
  551. var context = this;
  552. retVal = new DFUWUDetailsWidget.fixCircularDependency({
  553. id: id,
  554. title: params.Wuid,
  555. closable: true,
  556. _hpccParams: params
  557. });
  558. this.addChild(retVal, 1);
  559. }
  560. return retVal;
  561. },
  562. ensureLFPane: function (id, params) {
  563. var obj = id.split("::");
  564. id = obj.join("");
  565. obj = id.split(".");
  566. id = obj.join("");
  567. var retVal = registry.byId(id);
  568. if (!retVal) {
  569. if (params.isSuperfile) {
  570. retVal = new SFDetailsWidget.fixCircularDependency({
  571. id: id,
  572. title: params.Name,
  573. closable: true,
  574. _hpccParams: params
  575. });
  576. } else {
  577. retVal = new LFDetailsWidget.fixCircularDependency({
  578. id: id,
  579. title: params.Name,
  580. closable: true,
  581. _hpccParams: {
  582. Name: params.Name
  583. }
  584. });
  585. }
  586. this.addChild(retVal, 1);
  587. }
  588. return retVal;
  589. }
  590. });
  591. });