Commit fbadedf4877fb234795c4f3123ba6db4d28b9195

Authored by Benjamin Renard
2 parents 37f1898e d648a5c0

Merge branch 'wip' into save-plot-request

js/app/controllers/AmdaModule.js
@@ -99,7 +99,12 @@ Ext.define('amdaDesktop.AmdaModule', { @@ -99,7 +99,12 @@ Ext.define('amdaDesktop.AmdaModule', {
99 show : onshowfn, 99 show : onshowfn,
100 scope : this 100 scope : this
101 }); 101 });
102 - }  
103 - win.show(); 102 + }
  103 + if (!win.isVisible()) {
  104 + win.show();
  105 + }
  106 + else if (onshowfn) {
  107 + onshowfn();
  108 + }
104 } 109 }
105 }); 110 });
js/app/controllers/InteractiveModule.js
@@ -144,7 +144,13 @@ Ext.define('amdaDesktop.InteractiveModule', { @@ -144,7 +144,13 @@ Ext.define('amdaDesktop.InteractiveModule', {
144 // second arg 'true' is used in CatalogUI to mark if Grid Reconfiguration is needed 144 // second arg 'true' is used in CatalogUI to mark if Grid Reconfiguration is needed
145 this.getUiContent().setObject(this.linkedNode.get('object'), true); 145 this.getUiContent().setObject(this.linkedNode.get('object'), true);
146 } 146 }
147 - win.show(); 147 +
  148 + if (!win.isVisible()) {
  149 + win.show();
  150 + }
  151 + else if (onShowEvent) {
  152 + onShowEvent();
  153 + }
148 }, 154 },
149 /** 155 /**
150 * Mechanism to attach a Module to the Workspace Explorer to enable interactions 156 * Mechanism to attach a Module to the Workspace Explorer to enable interactions
@@ -256,4 +262,4 @@ Ext.define('amdaDesktop.InteractiveModule', { @@ -256,4 +262,4 @@ Ext.define('amdaDesktop.InteractiveModule', {
256 return null; 262 return null;
257 } 263 }
258 264
259 -});  
260 \ No newline at end of file 265 \ No newline at end of file
  266 +});
js/app/controllers/PlotModule.js
@@ -208,5 +208,12 @@ Ext.define('amdaDesktop.PlotModule', { @@ -208,5 +208,12 @@ Ext.define('amdaDesktop.PlotModule', {
208 getWindowResult: function(winResultId){ 208 getWindowResult: function(winResultId){
209 if (!this.plotResultWindowsManager.get(winResultId)) return null; 209 if (!this.plotResultWindowsManager.get(winResultId)) return null;
210 return this.plotResultWindowsManager.get(winResultId); 210 return this.plotResultWindowsManager.get(winResultId);
  211 + },
  212 +
  213 + forceTabSelection: function(tabId) {
  214 + var uiContent = this.getUiContent();
  215 + if (uiContent != null) {
  216 + uiContent.forceActiveTab(tabId);
211 } 217 }
  218 + }
212 }); 219 });
js/app/models/AmdaNode.js
@@ -128,6 +128,14 @@ Ext.define('amdaModel.AmdaNode', { @@ -128,6 +128,14 @@ Ext.define('amdaModel.AmdaNode', {
128 } 128 }
129 // if this node is a leaf and have no child 129 // if this node is a leaf and have no child
130 else if (this.isLeaf() || this.get('nodeType' ) == 'derivedParam' ) { 130 else if (this.isLeaf() || this.get('nodeType' ) == 'derivedParam' ) {
  131 + if (this.get('nodeType') == 'plottab') {
  132 + itemKind = amdaUI.ExplorerUI.ITEM_KIND_PTAB;
  133 + }
  134 + else {
  135 + itemKind = amdaUI.ExplorerUI.ITEM_KIND_LEAF;
  136 + }
  137 + }
  138 + else if (this.get('nodeType') == 'request') {
131 itemKind = amdaUI.ExplorerUI.ITEM_KIND_LEAF; 139 itemKind = amdaUI.ExplorerUI.ITEM_KIND_LEAF;
132 } 140 }
133 else if (this.get('isParameter') && this.get('nodeType' ) != 'derivedParam' ) { 141 else if (this.get('isParameter') && this.get('nodeType' ) != 'derivedParam' ) {
js/app/models/PlotNode.js
@@ -10,15 +10,45 @@ @@ -10,15 +10,45 @@
10 Ext.define('amdaModel.PlotNode', { 10 Ext.define('amdaModel.PlotNode', {
11 extend: 'amdaModel.ExecutableNode', 11 extend: 'amdaModel.ExecutableNode',
12 12
  13 + fields : [
  14 + {name : 'tabs', type:'auto', defaultValue:[], persist: false}
  15 + ],
  16 +
13 statics: { 17 statics: {
14 nodeType: 'request' 18 nodeType: 'request'
15 }, 19 },
16 20
  21 + requires:[
  22 + 'amdaModel.PlotTabNode'
  23 + ],
  24 +
17 constructor : function(config){ 25 constructor : function(config){
18 this.callParent(arguments); 26 this.callParent(arguments);
19 this.set('moduleId',myDesktopApp.dynamicModules.plot.id); 27 this.set('moduleId',myDesktopApp.dynamicModules.plot.id);
20 this.set('objectDataModel','amdaPlotObj.PlotRequestObject'); 28 this.set('objectDataModel','amdaPlotObj.PlotRequestObject');
21 this.set('nodeType',this.self.nodeType); 29 this.set('nodeType',this.self.nodeType);
  30 + this.updateTabs(this.get('tabs'));
  31 + },
  32 +
  33 + updateTabs : function(tabs) {
  34 + if (tabs) {
  35 + var oneTab = (tabs.length == 1);
  36 + this.set('leaf', oneTab);
  37 + this.set('iconCls', oneTab ? 'icon-plot-page' : 'icon-plot-pages');
  38 + this.removeAll();
  39 + if (tabs.length > 1) {
  40 + var me = this;
  41 + Ext.Array.each(tabs, function(tab) {
  42 + var tabNode = new amdaModel.PlotTabNode({text: tab.name, tabid: tab.id});
  43 + me.appendChild(tabNode);
  44 + });
  45 + }
  46 + this.set('tabs', tabs);
  47 + }
  48 + },
  49 +
  50 + specialUpdate : function(res) {
  51 + this.updateTabs(res.tabs);
22 }, 52 },
23 53
24 allMenuItems : function() { 54 allMenuItems : function() {
js/app/models/PlotObjects/PlotRequestObject.js
@@ -30,8 +30,7 @@ Ext.define('amdaPlotObj.PlotRequestObject', { @@ -30,8 +30,7 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
30 {name: 'one-file-per-interval', type: 'boolean'}, 30 {name: 'one-file-per-interval', type: 'boolean'},
31 {name: 'last-plotted-tab', type: 'int', defaultValue: 0}, 31 {name: 'last-plotted-tab', type: 'int', defaultValue: 0},
32 {name: 'last-tab-id', type: 'int', defaultValue: 0}, 32 {name: 'last-tab-id', type: 'int', defaultValue: 0},
33 - {name: 'active-tab-id', type: 'int', defaultValue: 1},  
34 - {name: 'all-in-one', type: 'boolean', defaultValue: false} 33 + {name: 'active-tab-id', type: 'int', defaultValue: 1}
35 ], 34 ],
36 35
37 hasMany: { 36 hasMany: {
@@ -74,10 +73,19 @@ Ext.define('amdaPlotObj.PlotRequestObject', { @@ -74,10 +73,19 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
74 73
75 createNewTab: function() { 74 createNewTab: function() {
76 this.set('last-tab-id', this.get('last-tab-id') + 1); 75 this.set('last-tab-id', this.get('last-tab-id') + 1);
77 - var recs = this.tabs().add({id : this.get('last-tab-id')});  
78 - recs[0].setDefaultValues(); 76 + var data = {id: this.get('last-tab-id')};
  77 + var applyDefault = true;
  78 + if ((arguments.length > 0) && arguments[0]) {
  79 + data = arguments[0];
  80 + data['id'] = this.get('last-tab-id');
  81 + applyDefault = false;
  82 + }
  83 + var recs = this.tabs().add(data);
  84 + if (applyDefault) {
  85 + recs[0].setDefaultValues();
  86 + }
79 this.dirty = true; 87 this.dirty = true;
80 - return recs[0]; 88 + return recs[0];
81 }, 89 },
82 90
83 removeTabById: function(tabId) { 91 removeTabById: function(tabId) {
@@ -124,7 +132,6 @@ Ext.define('amdaPlotObj.PlotRequestObject', { @@ -124,7 +132,6 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
124 requestValues['one-file-per-interval'] = this.get('one-file-per-interval'); 132 requestValues['one-file-per-interval'] = this.get('one-file-per-interval');
125 requestValues['last-plotted-tab'] = this.get('last-plotted-tab'); 133 requestValues['last-plotted-tab'] = this.get('last-plotted-tab');
126 requestValues['name'] = this.get('name'); 134 requestValues['name'] = this.get('name');
127 - requestValues['all-in-one'] = this.get('all-in-one');  
128 135
129 requestValues['timesrc'] = this.get('timesrc'); 136 requestValues['timesrc'] = this.get('timesrc');
130 137
@@ -153,26 +160,15 @@ Ext.define('amdaPlotObj.PlotRequestObject', { @@ -153,26 +160,15 @@ Ext.define('amdaPlotObj.PlotRequestObject', {
153 requestValues['durationSec'] = this.get('durationSec'); 160 requestValues['durationSec'] = this.get('durationSec');
154 } 161 }
155 162
156 - requestValues['tabs'] = []; 163 + requestValues['tabs'] = [];
157 164
158 - if (this.get('all-in-one')) {  
159 - this.tabs().each(function (tab, index) {  
160 - requestValues['tabs'][index] = tab.getJsonValues();  
161 - }); 165 + this.tabs().each(function (tab, index) {
  166 + requestValues['tabs'][index] = tab.getJsonValues();
  167 + });
162 168
163 - requestValues['active-tab-id'] = this.get('active-tab-id');  
164 - requestValues['last-tab-id'] = this.get('last-tab-id');  
165 - }  
166 - else {  
167 - var tab = this.tabs().getAt(this.get('active-tab-id')-1);  
168 - requestValues['tabs'][0] = tab.getJsonValues();  
169 -  
170 - requestValues['tabs'][0]['id'] = "1";  
171 - requestValues['active-tab-id'] = "1";  
172 - requestValues['last-tab-id'] = "1";  
173 - requestValues['last-plotted-tab'] = "0";  
174 - } 169 + requestValues['active-tab-id'] = this.get('active-tab-id');
  170 + requestValues['last-tab-id'] = this.get('last-tab-id');
175 171
176 - return requestValues; 172 + return requestValues;
177 } 173 }
178 -});  
179 \ No newline at end of file 174 \ No newline at end of file
  175 +});
js/app/models/PlotObjects/PlotTabObject.js
@@ -27,6 +27,7 @@ Ext.define('amdaPlotObj.PlotTabObject', { @@ -27,6 +27,7 @@ Ext.define('amdaPlotObj.PlotTabObject', {
27 27
28 fields : [ 28 fields : [
29 {name: 'id', type: 'int'}, 29 {name: 'id', type: 'int'},
  30 + {name: 'tab-name', type: 'string', defaultValue: ''},
30 {name: 'tree-full-view', type: 'boolean'}, 31 {name: 'tree-full-view', type: 'boolean'},
31 {name: 'multi-plot-linked', type: 'boolean'}, 32 {name: 'multi-plot-linked', type: 'boolean'},
32 {name: 'page-node-state', type: 'int', defaultValue: 2}, //0 : collapsed, 1 : expanded, 2 : not set 33 {name: 'page-node-state', type: 'int', defaultValue: 2}, //0 : collapsed, 1 : expanded, 2 : not set
@@ -223,6 +224,7 @@ Ext.define('amdaPlotObj.PlotTabObject', { @@ -223,6 +224,7 @@ Ext.define('amdaPlotObj.PlotTabObject', {
223 var tabValues = new Object(); 224 var tabValues = new Object();
224 225
225 tabValues['id'] = this.get('id'); 226 tabValues['id'] = this.get('id');
  227 + tabValues['tab-name'] = this.get('tab-name');
226 tabValues['tree-full-view'] = this.get('tree-full-view'); 228 tabValues['tree-full-view'] = this.get('tree-full-view');
227 tabValues['multi-plot-linked'] = this.get('multi-plot-linked'); 229 tabValues['multi-plot-linked'] = this.get('multi-plot-linked');
228 tabValues['page-node-state'] = this.get('page-node-state'); 230 tabValues['page-node-state'] = this.get('page-node-state');
@@ -289,4 +291,4 @@ Ext.define('amdaPlotObj.PlotTabObject', { @@ -289,4 +291,4 @@ Ext.define('amdaPlotObj.PlotTabObject', {
289 291
290 return tabValues; 292 return tabValues;
291 } 293 }
292 -});  
293 \ No newline at end of file 294 \ No newline at end of file
  295 +});
js/app/models/PlotTabNode.js 0 โ†’ 100644
@@ -0,0 +1,142 @@ @@ -0,0 +1,142 @@
  1 +/**
  2 + * Project : AMDA-NG4
  3 + * Name : PlotTabNode.js
  4 + * @class amdaModel.PlotTabNode
  5 + * @extends amdaModel.ExecutableNode
  6 + * @brief Basic Model of Node corresponding to a tab of a plot request
  7 + * @author Benjamin Renard
  8 + */
  9 +
  10 +Ext.define('amdaModel.PlotTabNode', {
  11 + extend: 'amdaModel.ExecutableNode',
  12 +
  13 + fields : [
  14 + {name : 'tabid', type:'string', defaultValue:'', persist: false}
  15 + ],
  16 +
  17 + statics: {
  18 + nodeType: 'plottab'
  19 + },
  20 +
  21 + constructor : function(config){
  22 + this.callParent(arguments);
  23 + this.set('moduleId',myDesktopApp.dynamicModules.plot.id);
  24 + //this.set('objectDataModel','amdaPlotObj.PlotRequestObject');
  25 + this.set('nodeType',this.self.nodeType);
  26 + this.set('leaf',true);
  27 + this.set('iconCls','icon-plot-page');
  28 + },
  29 +
  30 + allMenuItems : function() {
  31 + var menuItems =
  32 + [
  33 + {
  34 + fnId : 'ptab-openTab',
  35 + text : 'Open in new Plot Request'
  36 + }, {
  37 + fnId : 'ptab-insertTab',
  38 + text : 'Insert in current Plot Request'
  39 + }, {
  40 + fnId : 'ptab-renameTab',
  41 + text : 'Rename Plot Tab'
  42 + }];
  43 +
  44 + return menuItems;
  45 + },
  46 +
  47 + allMenuMultiItems : function() {
  48 + var menuMulti = [
  49 + ];
  50 + return menuMulti;
  51 + },
  52 +
  53 + getAllContextMenuItems: function(){
  54 + return this.allMenuItems();
  55 + },
  56 +
  57 + getMultiContextMenuItems: function(){
  58 + return this.allMenuMultiItems();
  59 + },
  60 +
  61 + onMenuItemClick : function(menu,item,event) {
  62 +
  63 + var fnId = Ext.util.Format.substr(item.fnId, 5, item.fnId.length);
  64 +
  65 + switch (fnId) {
  66 +
  67 + case 'openTab':
  68 + this.insertPlotTabRequest(true);
  69 + break;
  70 +
  71 + case 'insertTab':
  72 + this.insertPlotTabRequest(false);
  73 + break;
  74 +
  75 + case 'renameTab':
  76 + console.log('renameTab');
  77 + break;
  78 + default:
  79 + break;
  80 + }
  81 + },
  82 +
  83 + insertPlotTabRequest : function(inNewRequest) {
  84 + var me = this;
  85 + amdaModel.InteractiveNode.preloadNodes(this.parentNode.getRootNode(), function() {
  86 + AmdaAction.getObject(me.parentNode.get('id'), me.parentNode.get('nodeType'), function (result,remoteEvent) {
  87 + var paramObj = Ext.create(me.parentNode.get('objectDataModel'), result);
  88 + var tabData = null;
  89 + paramObj.tabs().each(function(tab) {
  90 + if (tab.get('id') == me.get('tabid')) {
  91 + tabData = tab.getJsonValues();
  92 + }
  93 + });
  94 + if (tabData != null) {
  95 + if (inNewRequest) {
  96 + tabData['id'] = 1;
  97 + paramObj.set('id','');
  98 + paramObj.set('name', '');
  99 + paramObj.set('folderId', '');
  100 + paramObj.set('active-tab-id', 1);
  101 + paramObj.set('last-tab-id', 1);
  102 + paramObj.set('last-plotted-tab', 1);
  103 + paramObj.loadTabs([tabData]);
  104 + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) {
  105 + module.setContextNode(me.parentNode.getRootNode());
  106 + module.createWindow(function () {
  107 + var uiContent = module.getUiContent();
  108 + if (uiContent != null) {
  109 + uiContent.resetProcess(paramObj.getJsonValues());
  110 + }
  111 + });
  112 + });
  113 + }
  114 + else {
  115 + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) {
  116 + module.createWindow(function () {
  117 + var uiContent = module.getUiContent();
  118 + if (uiContent != null) {
  119 + var tabObj = new amdaPlotObj.PlotTabObject(tabData);
  120 + uiContent.insertPlotTab(tabData);
  121 + }
  122 + });
  123 + });
  124 + }
  125 + }
  126 + }, me);
  127 + });
  128 + },
  129 +
  130 + editPlotTab : function() {
  131 + var me = this;
  132 + this.parentNode.editLeaf(function () {
  133 + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) {
  134 + var uiContent = module.getUiContent();
  135 + if (uiContent != null) {
  136 + uiContent.forceActiveTab(me.get('tabid'));
  137 + }
  138 + });
  139 + });
  140 + }
  141 +
  142 +});
js/app/views/ExplorerUI.js
@@ -102,6 +102,7 @@ Ext.define('amdaUI.ExplorerUI', { @@ -102,6 +102,7 @@ Ext.define('amdaUI.ExplorerUI', {
102 ITEM_KIND_LEAF : 'leaf', 102 ITEM_KIND_LEAF : 'leaf',
103 ITEM_KIND_DIRE : 'dire', 103 ITEM_KIND_DIRE : 'dire',
104 ITEM_KIND_PARA : 'para', 104 ITEM_KIND_PARA : 'para',
  105 + ITEM_KIND_PTAB : 'ptab', //plot tab
105 ITEM_KIND_MISS : 'miss' 106 ITEM_KIND_MISS : 'miss'
106 }, 107 },
107 108
@@ -575,13 +576,13 @@ Ext.define('amdaUI.ExplorerUI', { @@ -575,13 +576,13 @@ Ext.define('amdaUI.ExplorerUI', {
575 }); 576 });
576 } 577 }
577 578
578 - if (record.isLeaf() || record.data.isParameter) 579 + if (record.isLeaf() || record.data.isParameter || (record.data.tabs && (record.data.tabs.length > 0)))
579 switch (record.get('nodeType')) 580 switch (record.get('nodeType'))
580 { 581 {
581 case 'myData' : 582 case 'myData' :
582 case 'myDataParam' : 583 case 'myDataParam' :
583 case 'derivedParam' : 584 case 'derivedParam' :
584 - case 'timeTable' : 585 + case 'timeTable' :
585 case 'sharedtimeTable' : 586 case 'sharedtimeTable' :
586 case 'sharedcatalog' : 587 case 'sharedcatalog' :
587 case 'catalog' : 588 case 'catalog' :
@@ -589,6 +590,9 @@ Ext.define('amdaUI.ExplorerUI', { @@ -589,6 +590,9 @@ Ext.define('amdaUI.ExplorerUI', {
589 case 'condition' : 590 case 'condition' :
590 record.editLeaf(); 591 record.editLeaf();
591 break; 592 break;
  593 + case 'plottab' :
  594 + record.editPlotTab();
  595 + break;
592 case 'localParam' : 596 case 'localParam' :
593 case 'remoteParam': 597 case 'remoteParam':
594 case 'remoteSimuParam': 598 case 'remoteSimuParam':
js/app/views/PlotComponents/PlotTabPanel.js
@@ -31,16 +31,20 @@ Ext.define('amdaPlotComp.PlotTabPanel', { @@ -31,16 +31,20 @@ Ext.define('amdaPlotComp.PlotTabPanel', {
31 31
32 setRequestObject: function(object) 32 setRequestObject: function(object)
33 { 33 {
  34 + var me = this;
34 this.removeAll(); 35 this.removeAll();
35 this.object = object; 36 this.object = object;
36 - var selectedTab = this.object.get('active-tab-id');  
37 37
  38 + var haveSelectedTab = false;
38 this.object.tabs().each(function (rec, index) { 39 this.object.tabs().each(function (rec, index) {
39 - var isSelected = false;  
40 - if (index+1 == selectedTab)  
41 - isSelected = true; 40 + if (rec.get('id') == me.object.get('active-tab-id')) {
  41 + haveSelectedTab = true;
  42 + }
  43 + });
42 44
43 - this.addPlotTab(rec, isSelected); 45 + this.object.tabs().each(function (rec, index) {
  46 + var isSelectedTab = haveSelectedTab ? (rec.get('id') == me.object.get('active-tab-id')) : (index == 0);
  47 + this.addPlotTab(rec, isSelectedTab);
44 }, this); 48 }, this);
45 }, 49 },
46 50
@@ -141,7 +145,13 @@ Ext.define('amdaPlotComp.PlotTabPanel', { @@ -141,7 +145,13 @@ Ext.define('amdaPlotComp.PlotTabPanel', {
141 handler:function(btn,e){ 145 handler:function(btn,e){
142 var tabContent = me.addPlotTab(me.object.createNewTab(), true); 146 var tabContent = me.addPlotTab(me.object.createNewTab(), true);
143 } 147 }
144 - }] 148 + }],
  149 + listeners: {
  150 + click: function(tabBar, e, eOpts) {
  151 + console.log('click');
  152 + },
  153 + scope: me
  154 + }
145 }, 155 },
146 156
147 listeners: { 157 listeners: {
js/app/views/PlotUI.js
@@ -32,8 +32,6 @@ Ext.define('amdaUI.PlotUI', { @@ -32,8 +32,6 @@ Ext.define('amdaUI.PlotUI', {
32 32
33 plotElement : null, 33 plotElement : null,
34 34
35 - allPlots : false,  
36 -  
37 constructor: function(config) { 35 constructor: function(config) {
38 this.init(config); 36 this.init(config);
39 this.callParent(arguments); 37 this.callParent(arguments);
@@ -47,12 +45,6 @@ Ext.define('amdaUI.PlotUI', { @@ -47,12 +45,6 @@ Ext.define('amdaUI.PlotUI', {
47 this.plotTabs.setRequestObject(this.object); 45 this.plotTabs.setRequestObject(this.object);
48 this.timeSelector.intervalSel.setInterval(this.object.get('startDate'), this.object.get('stopDate')); 46 this.timeSelector.intervalSel.setInterval(this.object.get('startDate'), this.object.get('stopDate'));
49 this.addTTs(this.object.get('timeTables')); 47 this.addTTs(this.object.get('timeTables'));
50 - this.updateRequestOption(this.object.get('all-in-one'));  
51 - },  
52 -  
53 - updateRequestOption : function(allInOne) {  
54 - var requestOptionCB = this.formPanel.getForm().findField('all-in-one');  
55 - requestOptionCB.setValue(allInOne);  
56 }, 48 },
57 49
58 /** 50 /**
@@ -92,7 +84,11 @@ Ext.define('amdaUI.PlotUI', { @@ -92,7 +84,11 @@ Ext.define('amdaUI.PlotUI', {
92 resetProcess : function(){ 84 resetProcess : function(){
93 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); 85 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
94 plotModule.createLinkedNode(); 86 plotModule.createLinkedNode();
95 - plotModule.createObject(); 87 + var obj = null;
  88 + if ((arguments.length > 0) && (arguments[0] != null)) {
  89 + obj = arguments[0];
  90 + }
  91 + plotModule.createObject(obj);
96 this.setObject(plotModule.linkedNode.get('object')); 92 this.setObject(plotModule.linkedNode.get('object'));
97 }, 93 },
98 94
@@ -119,7 +115,6 @@ Ext.define('amdaUI.PlotUI', { @@ -119,7 +115,6 @@ Ext.define('amdaUI.PlotUI', {
119 doPlot : function(){ 115 doPlot : function(){
120 116
121 this.updateObject(); 117 this.updateObject();
122 - this.object.set('all-in-one', true);  
123 this.object.set('last-plotted-tab', this.plotTabs.getSelectedTabId()); 118 this.object.set('last-plotted-tab', this.plotTabs.getSelectedTabId());
124 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); 119 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
125 if (plotModule) 120 if (plotModule)
@@ -180,10 +175,70 @@ Ext.define('amdaUI.PlotUI', { @@ -180,10 +175,70 @@ Ext.define('amdaUI.PlotUI', {
180 175
181 this.timeSelector.intervalSel.setInterval(dateStart, dateStop); 176 this.timeSelector.intervalSel.setInterval(dateStart, dateStop);
182 }, 177 },
  178 +
  179 + forceActiveTab : function(tabId) {
  180 + for (var i = 0; i < this.plotTabs.items.getCount(); ++i) {
  181 + var plotTab = this.plotTabs.items.getAt(i).items.getAt(0);
  182 + if (plotTab.tabId == tabId) {
  183 + this.plotTabs.setActiveTab(i);
  184 + return;
  185 + }
  186 + }
  187 + },
  188 +
  189 + insertPlotTab : function(tabData) {
  190 + var newTab = this.object.createNewTab(tabData);
  191 + this.plotTabs.addPlotTab(newTab,true);
  192 + },
183 193
184 updateLinkedToMultiPlotMode : function(isLinkedToMultiPlotMode) { 194 updateLinkedToMultiPlotMode : function(isLinkedToMultiPlotMode) {
185 this.timeSelector.setVisible(isLinkedToMultiPlotMode); 195 this.timeSelector.setVisible(isLinkedToMultiPlotMode);
186 }, 196 },
  197 +
  198 + savePlotRequest : function(allTabs = false) {
  199 + var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
  200 + if (!plotModule)
  201 + return;
  202 + this.updateObject();
  203 + this.object.set('active-tab-id', this.plotTabs.getSelectedTabId());
  204 +
  205 + if ((this.object.get('id') != '') && (plotModule.linkedNode.get('text') == this.object.get('name'))) {
  206 + //update existing request
  207 + plotModule.linkedNode.update();
  208 + return;
  209 + }
  210 +
  211 + //save new request
  212 + var me = this;
  213 + plotModule.linkedNode.isValidName(this.object.get('name'), function (res) {
  214 + if (!res) {
  215 + myDesktopApp.errorMsg('Error during object validation');
  216 + return;
  217 + }
  218 + if (!res.valid) {
  219 + if (res.error) {
  220 + if (res.error.search('subtree') != -1) {
  221 + Ext.Msg.show( { title : 'Warning',
  222 + msg: res.error + '<br/>Do you want to overwrite it?',
  223 + width: 300,
  224 + buttons: Ext.Msg.OKCANCEL,
  225 + icon: Ext.Msg.WARNING,
  226 + fn : me.overwriteProcess,
  227 + scope : me
  228 + });
  229 + }
  230 + else {
  231 + myDesktopApp.errorMsg(res.error);
  232 + }
  233 + }
  234 + else {
  235 + myDesktopApp.errorMsg('Invalid object name');
  236 + }
  237 + return;
  238 + }
  239 + me.saveProcess(false);
  240 + });
  241 + },
187 242
188 init : function(config) { 243 init : function(config) {
189 this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'multiPlotTimeSelector' + config.id, title : 'MultiPlot Time Selection', border : false, collapsible : true, collapseDirection : 'bottom', visible : false, flex: 2 } ); 244 this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'multiPlotTimeSelector' + config.id, title : 'MultiPlot Time Selection', border : false, collapsible : true, collapseDirection : 'bottom', visible : false, flex: 2 } );
@@ -252,7 +307,8 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, { @@ -252,7 +307,8 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
252 ] 307 ]
253 } 308 }
254 ], 309 ],
255 - fbar: [{ 310 + fbar: [
  311 + {
256 xtype: 'button', 312 xtype: 'button',
257 text: 'Plot', 313 text: 'Plot',
258 scope: this, 314 scope: this,
@@ -275,68 +331,24 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, { @@ -275,68 +331,24 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
275 } 331 }
276 }, 332 },
277 '->', '-', { 333 '->', '-', {
278 - xtype: 'button',  
279 - text: 'Save Request', 334 + xtype: 'splitbutton',
  335 + text: 'Save All Tabs',
  336 + menu: {
  337 + items: [
  338 + {
  339 + text: 'Save Current Tab',
  340 + scope: this,
  341 + handler: function() {
  342 + this.savePlotRequest(false);
  343 + }
  344 + },
  345 + ]
  346 + },
280 scope: this, 347 scope: this,
281 handler: function(button) { 348 handler: function(button) {
282 - var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);  
283 - if (!plotModule)  
284 - return;  
285 -  
286 - this.updateObject();  
287 - this.object.set('active-tab-id', this.plotTabs.getSelectedTabId());  
288 - this.object.set('all-in-one', this.allPlots);  
289 -  
290 - //update existing request  
291 - if ((this.object.get('id') != '') &&  
292 - (plotModule.linkedNode.get('text') == this.object.get('name')))  
293 - plotModule.linkedNode.update();  
294 - else {  
295 - var me = this;  
296 - plotModule.linkedNode.isValidName(this.object.get('name'), function (res) {  
297 - if (!res) {  
298 - myDesktopApp.errorMsg('Error during object validation');  
299 - return;  
300 - }  
301 - if (!res.valid) {  
302 - if (res.error) {  
303 - if (res.error.search('subtree') != -1) {  
304 - Ext.Msg.show( { title : 'Warning',  
305 - msg: res.error + '<br/>Do you want to overwrite it?',  
306 - width: 300,  
307 - buttons: Ext.Msg.OKCANCEL,  
308 - icon: Ext.Msg.WARNING,  
309 - fn : me.overwriteProcess,  
310 - scope : me  
311 - });  
312 - }  
313 - else {  
314 - myDesktopApp.errorMsg(res.error);  
315 - }  
316 - }  
317 - else {  
318 - myDesktopApp.errorMsg('Invalid object name');  
319 - }  
320 -  
321 - return;  
322 - }  
323 - me.saveProcess(false);  
324 - })  
325 - }  
326 - }  
327 - }, ' ',  
328 - myDesktopApp.addAmdaInfo('plotSaveRequest'),  
329 - ' ', {  
330 - xtype: 'checkbox',  
331 - boxLabel: 'All Plot Tabs',  
332 - name : 'all-in-one',  
333 - listeners : {  
334 - scope: this,  
335 - change: function (cb, nv, ov) {  
336 - this.allPlots = nv;  
337 - } 349 + this.savePlotRequest(true);
338 } 350 }
339 - } 351 + }
340 ] 352 ]
341 }); 353 });
342 354
js/resources/css/amda.css
@@ -456,6 +456,10 @@ p + p { @@ -456,6 +456,10 @@ p + p {
456 background-image:url( ../images/16x16/plot_page.png ) !important; 456 background-image:url( ../images/16x16/plot_page.png ) !important;
457 } 457 }
458 458
  459 +.icon-plot-pages {
  460 + background-image:url( ../images/16x16/plot_pages.png ) !important;
  461 +}
  462 +
459 .icon-plot-layout { 463 .icon-plot-layout {
460 background-image:url( ../images/16x16/plot_layout.png ) !important; 464 background-image:url( ../images/16x16/plot_layout.png ) !important;
461 } 465 }
js/resources/images/16x16/plot_pages.png 0 โ†’ 100644

150 Bytes

php/classes/AmdaAction.php
@@ -151,6 +151,7 @@ class AmdaAction @@ -151,6 +151,7 @@ class AmdaAction
151 $isParameter = false; 151 $isParameter = false;
152 $isAddable = false; 152 $isAddable = false;
153 $isSimulation = false; 153 $isSimulation = false;
  154 + $plotTabs = FALSE;
154 $rank = null; 155 $rank = null;
155 $skip = FALSE; 156 $skip = FALSE;
156 157
@@ -178,12 +179,25 @@ class AmdaAction @@ -178,12 +179,25 @@ class AmdaAction
178 case 'request': 179 case 'request':
179 $objectMgr = new RequestMgr(); 180 $objectMgr = new RequestMgr();
180 $objplot = $objectMgr->getObject($id); 181 $objplot = $objectMgr->getObject($id);
181 - for ($i=0; $i < count($objplot->children); $i++)  
182 - {  
183 - for ($j=0; $j < count($objplot->children[$i]->children); $j++) {  
184 - $info = $info.' . '.$objplot->children[$i]->children[$j]->name; 182 + if (isset($objplot->name)) {
  183 + $info = $objplot->name;
  184 + }
  185 + else {
  186 + $info = $id;
  187 + }
  188 +
  189 + $isLeaf = isset($objplot->tabs);
  190 + if ($isLeaf) {
  191 + $plotTabs = array();
  192 + foreach ($objplot->tabs as $index => $tab) {
  193 + $plotTabs[$index] = array(
  194 + "name" => "Plot ".($index+1),
  195 + "id" => $tab->id,
  196 + );
185 } 197 }
186 } 198 }
  199 + else
  200 + $plotTabs = FALSE;
187 break; 201 break;
188 202
189 case 'alias': 203 case 'alias':
@@ -313,6 +327,7 @@ class AmdaAction @@ -313,6 +327,7 @@ class AmdaAction
313 } 327 }
314 } 328 }
315 329
  330 +
316 if ($isParameter) { 331 if ($isParameter) {
317 $objectMgr = new AliasMgr(); 332 $objectMgr = new AliasMgr();
318 $alias = $objectMgr->getAlias($id); 333 $alias = $objectMgr->getAlias($id);
@@ -561,7 +576,7 @@ class AmdaAction @@ -561,7 +576,7 @@ class AmdaAction
561 } 576 }
562 577
563 $childrenToReturn[] = array('text' => $name, 'id' => $id, 'nodeType' => $nodeType, 'info' => $info, 578 $childrenToReturn[] = array('text' => $name, 'id' => $id, 'nodeType' => $nodeType, 'info' => $info,
564 - 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter, 'dim_1' => $dim_1, 'dim_2' => $dim_2); 579 + 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter, 'dim_1' => $dim_1, 'dim_2' => $dim_2, 'tabs' => $plotTabs);
565 } 580 }
566 } 581 }
567 // if $childrenToReturn we have to return [] 582 // if $childrenToReturn we have to return []
php/classes/RequestMgr.php
@@ -177,6 +177,19 @@ class RequestMgr extends AmdaObjectMgr @@ -177,6 +177,19 @@ class RequestMgr extends AmdaObjectMgr
177 } 177 }
178 } 178 }
179 } 179 }
  180 +
  181 + $additional = array();
  182 + if ($this->type == 'request') {
  183 + $additional['tabs'] = array();
  184 + if (isset($p->tabs)) {
  185 + foreach ($p->tabs as $index => $tab) {
  186 + $additional['tabs'][$index] = array(
  187 + "name" => "Plot ".($index+1),
  188 + "id" => $tab->id,
  189 + );
  190 + }
  191 + }
  192 + }
180 193
181 $this->descFileName = USERREQDIR.$this->id; 194 $this->descFileName = USERREQDIR.$this->id;
182 $p->id = $this->id; 195 $p->id = $this->id;
@@ -187,7 +200,7 @@ class RequestMgr extends AmdaObjectMgr @@ -187,7 +200,7 @@ class RequestMgr extends AmdaObjectMgr
187 200
188 $this -> addToContent($p, $folder); 201 $this -> addToContent($p, $folder);
189 202
190 - return array('id' => $this->id, 'info' => $info); 203 + return array('id' => $this->id, 'info' => $info) + $additional;
191 } 204 }
192 205
193 public static function checkRequest($obj) 206 public static function checkRequest($obj)