Commit bdcdb5268a1c5bf56fdf2ba3a8d8fa79e7e8bcd3

Authored by Benjamin Renard
1 parent efca00de

Implements action to add plot tabs in current plot request

Showing 1 changed file with 24 additions and 1 deletions   Show diff stats
js/app/models/PlotNode.js
... ... @@ -76,6 +76,10 @@ Ext.define('amdaModel.PlotNode', {
76 76 }, {
77 77 fnId : 'leaf-deleteNode',
78 78 text : 'Delete Request'
  79 + }, {
  80 + fnId : 'leaf-insertTabs',
  81 + text : 'Insert in current Plot Request'
  82 +
79 83 }];
80 84  
81 85 return menuItems;
... ... @@ -124,7 +128,8 @@ Ext.define('amdaModel.PlotNode', {
124 128 case 'deleteMulti':
125 129 this.deleteMulti();
126 130 break;
127   -
  131 + case 'insertTabs':
  132 + this.insertPlotTabsRequest();
128 133 default:
129 134 break;
130 135 }
... ... @@ -140,6 +145,24 @@ Ext.define('amdaModel.PlotNode', {
140 145 var isFolder = (!this.isLeaf()) && (this.get('tabs') === false);
141 146 var dataToSend = {id : this.get('id'), old_name: this.get('name'), name: this.get('name'), parent : parentId, leaf: !isFolder, nodeType: this.get('nodeType')};
142 147 AmdaAction.renameObject(dataToSend, callBackFn);
  148 + },
  149 +
  150 + insertPlotTabsRequest: function() {
  151 + var me = this;
  152 + AmdaAction.getObject(me.get('id'), me.get('nodeType'), function (result,remoteEvent) {
  153 + var paramObj = Ext.create(me.get('objectDataModel'), result);
  154 + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) {
  155 + module.createWindow(function () {
  156 + var uiContent = module.getUiContent();
  157 + if (uiContent != null) {
  158 + paramObj.tabs().each(function (tab) {
  159 + var tabData = tab.getJsonValues();
  160 + uiContent.insertPlotTab(tabData);
  161 + });
  162 + }
  163 + });
  164 + });
  165 + });
143 166 }
144 167  
145 168 });
... ...