Commit 6f513d3f48b3ad3ed3ae75e74bc3aef3a8a2b68a

Authored by Benjamin Renard
1 parent 940afd8d

WIP

js/app/controllers/PlotModule.js
... ... @@ -13,8 +13,8 @@ Ext.define('amdaDesktop.PlotModule', {
13 13  
14 14 requires: [
15 15 'amdaUI.PlotUI',
16   - 'amdaPlotObj.PlotRequestObject',
17   - 'amdaModel.PlotNode',
  16 + 'amdaPlotObj.MultiplotRequestObject',
  17 + 'amdaModel.MultiplotNode',
18 18 'amdaUI.PlotTabResultUI',
19 19 'amdaPlotComp.PlotPreviewUI'
20 20 ],
... ... @@ -26,7 +26,7 @@ Ext.define('amdaDesktop.PlotModule', {
26 26 * @cfg {String} data models
27 27 * @required
28 28 */
29   - nodeDataModel : 'amdaModel.PlotNode',
  29 + nodeDataModel : 'amdaModel.MultiplotNode',
30 30  
31 31 /**
32 32 * @cfg {String} window definitions
... ...
js/app/models/PlotObjects/MultiplotRequestObject.js
... ... @@ -16,9 +16,13 @@
16 16 Ext.define('amdaPlotObj.MultiplotRequestObject', {
17 17 extend: 'amdaModel.AmdaTimeObject',
18 18 idProperty: 'id',
  19 +
  20 + requires: [
  21 + 'amdaModel.PlotNode'
  22 + ],
19 23  
20 24 hasMany: {
21   - model : 'amdaPlotObj.PlotNode',
  25 + model : 'amdaModel.PlotNode',
22 26 name : 'plots',
23 27 associationKey:'plots'
24 28 },
... ... @@ -29,6 +33,12 @@ Ext.define('amdaPlotObj.MultiplotRequestObject', {
29 33 },
30 34  
31 35 createNewPlot: function() {
  36 + var plotNode = Ext.create('amdaModel.PlotNode', {
  37 + leaf : true,
  38 + contextNode : this
  39 + });
  40 + this.plots().add(plotNode);
  41 + return this.plots()[this.plots().count()-1];
32 42 },
33 43  
34 44 removePlotById: function(id) {
... ...
js/app/views/PlotComponents/PlotTabPanel.js
... ... @@ -15,57 +15,46 @@ Ext.define('amdaPlotComp.PlotTabPanel', {
15 15 'amdaPlotComp.PlotTabContent'
16 16 ],
17 17  
18   - //Link to the Plot Element Panel
19   - plotElementPanel: null,
20   -
21   - //Link to the Plot UI
22   - plotUI : null,
  18 + //Link to the Plot UI
  19 + plotUI : null,
23 20  
24 21 //Request object
25   - object: null,
  22 + multiplot_object: null,
26 23  
27 24 constructor: function(config) {
28 25 this.init(config);
29 26 this.callParent(arguments);
30 27 },
31 28  
32   - setRequestObject: function(object)
  29 + setMultiplotObject: function(multiplot_object)
33 30 {
34 31 var me = this;
35 32 this.removeAll();
36   - this.object = object;
  33 + this.multiplot_object = multiplot_object;
37 34  
38   - var haveSelectedTab = false;
39   - this.object.tabs().each(function (rec, index) {
40   - if (rec.get('id') == me.object.get('active-tab-id')) {
41   - haveSelectedTab = true;
42   - }
43   - });
44   -
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);
  35 + this.multiplot_object.plots().each(function (rec, index) {
  36 + this.addPlotNode(rec, index == 0);
48 37 }, this);
49 38 },
50 39  
51   - addPlotTab: function(tabObject, selectTab)
  40 + addPlotNode: function(plotNode, selectTab)
52 41 {
53 42 var tabNumber = this.getTabBar().items.getCount();
54   - var tabContent = new amdaPlotComp.PlotTabContent({plotElementPanel: this.plotElementPanel, plotTabPanel : this, tabId : tabObject.get('id')});
55   - tabContent.setTabObject(tabObject);
  43 + var tabContent = new amdaPlotComp.PlotTabContent();
  44 + tabContent.setPlotNode(plotNode);
56 45 var me = this;
57   - var tabComp = this.add({
58   - title: (tabObject.get('tab-name') != '') ? tabObject.get('tab-name') : 'Plot '+tabNumber,
59   - closable: true,
60   - layout: 'fit',
61   - bodyStyle: 'background: none',
62   - defaults: {
  46 + var tabComp = this.add({
  47 + title: (plotNode.get('text') != '') ? plotNode.get('text') : 'Plot '+tabNumber,
  48 + closable: true,
  49 + layout: 'fit',
  50 + bodyStyle: 'background: none',
  51 + defaults: {
63 52 border: false
64   - },
65   - items: [
  53 + },
  54 + items: [
66 55 tabContent
67   - ],
68   - listeners : {
  56 + ],
  57 + listeners : {
69 58 scope : this,
70 59 beforeclose: function( tab, eOpts ) {
71 60 if (this.items.getCount() == 1)
... ... @@ -190,7 +179,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', {
190 179 text:'+',
191 180 closable: false,
192 181 handler:function(btn,e){
193   - var tabContent = me.addPlotTab(me.object.createNewTab(), true);
  182 + var tabContent = me.addPlotNode(me.multiplot_object.createNewPlot(), true);
194 183 }
195 184 }]
196 185 },
... ...
js/app/views/PlotUI.js
... ... @@ -41,10 +41,13 @@ Ext.define('amdaUI.PlotUI', {
41 41  
42 42 setObject : function(object) {
43 43 this.object = object;
44   - this.plotOutput.setObject(this.object);
45   - this.plotTabs.setRequestObject(this.object);
46   - this.timeSelector.intervalSel.setInterval(this.object.get('startDate'), this.object.get('stopDate'));
47   - this.addTTs(this.object.get('timeTables'));
  44 + if (this.object.plots().count() == 0) {
  45 + this.object.createNewPlot();
  46 + }
  47 + //this.plotOutput.setObject(this.object);
  48 + this.plotTabs.setMultiplotObject(this.object);
  49 + //this.timeSelector.intervalSel.setInterval(this.object.get('startDate'), this.object.get('stopDate'));
  50 + //this.addTTs(this.object.get('timeTables'));
48 51 },
49 52  
50 53 /**
... ... @@ -325,15 +328,72 @@ Ext.define('amdaUI.PlotUI', {
325 328 },
326 329  
327 330 init : function(config) {
328   - this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'multiPlotTimeSelector' + config.id, title : 'MultiPlot Time Selection', border : false, collapsible : true, collapseDirection : 'bottom', visible : false, flex: 2 } );
  331 + //this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'multiPlotTimeSelector' + config.id, title : 'MultiPlot Time Selection', border : false, collapsible : true, collapseDirection : 'bottom', visible : false, flex: 2 } );
329 332  
330   - this.plotOutput = new amdaPlotComp.PlotOutputForm({flex: 2, collapseDirection : 'bottom', collapsible : true });
  333 + //this.plotOutput = new amdaPlotComp.PlotOutputForm({flex: 2, collapseDirection : 'bottom', collapsible : true });
331 334  
332   - this.plotElement = new amdaPlotComp.PlotElementPanel({flex: 4});
  335 + //this.plotElement = new amdaPlotComp.PlotElementPanel({flex: 4});
  336 +
  337 + this.plotTabs = new amdaPlotComp.PlotTabPanel({flex: 4, plotUI : this});
  338 +
  339 + this.formPanel = new Ext.form.Panel({
  340 + region: 'center',
  341 + layout: {
  342 +
  343 + },
  344 + bodyStyle: { background : '#dfe8f6' },
  345 + defaults: {
  346 + border: false
  347 + },
  348 + items: [
  349 + this.plotTabs
  350 + ],
  351 + fbar: [
  352 + {
  353 + xtype: 'button',
  354 + text: 'Plot',
  355 + scope: this,
  356 + handler: function(button) {
  357 + this.doPlot();
  358 + }
  359 + },' ', {
  360 + xtype: 'button',
  361 + text: 'Get Data',
  362 + scope: this,
  363 + handler: function(button) {
  364 + this.getDataProcess();
  365 + }
  366 + },' ', {
  367 + xtype: 'button',
  368 + text: 'Reset',
  369 + scope: this,
  370 + handler: function(button) {
  371 + this.resetProcess();
  372 + }
  373 + },'->', '-', {
  374 + xtype: 'splitbutton',
  375 + text: 'Save All Tabs',
  376 + menu: {
  377 + items: [
  378 + {
  379 + text: 'Save Current Tab',
  380 + scope: this,
  381 + handler: function() {
  382 + this.savePlotRequest(false);
  383 + }
  384 + },
  385 + ]
  386 + },
  387 + scope: this,
  388 + handler: function(button) {
  389 + this.savePlotRequest(true);
  390 + }
  391 + }
  392 + ]
  393 + });
333 394  
334   - this.plotTabs = new amdaPlotComp.PlotTabPanel({flex: 4, plotElementPanel : this.plotElement, plotUI : this});
335 395  
336   - this.optionsPanel = new Ext.form.Panel({
  396 + /*this.optionsPanel = new Ext.form.Panel({
337 397 layout: {
338 398 type: 'vbox',
339 399 pack: 'start',
... ... @@ -434,7 +494,7 @@ Ext.define('amdaUI.PlotUI', {
434 494 }
435 495 }
436 496 ]
437   - });
  497 + });*/
438 498  
439 499 var myConf = {
440 500 layout: 'border',
... ...