diff --git a/js/app/models/PlotObjects/PlotObjectConfig.js b/js/app/models/PlotObjects/PlotObjectConfig.js index 98a1b83..ad85de0 100644 --- a/js/app/models/PlotObjects/PlotObjectConfig.js +++ b/js/app/models/PlotObjects/PlotObjectConfig.js @@ -22,6 +22,9 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { output : 'INTERACTIVE', oneFilePerInterval: false }, + tree : { + simplifiedView : false + }, page : { xMargin : 15., yMargin : 20., diff --git a/js/app/models/PlotObjects/PlotTabObject.js b/js/app/models/PlotObjects/PlotTabObject.js index def711a..5d0ae0d 100644 --- a/js/app/models/PlotObjects/PlotTabObject.js +++ b/js/app/models/PlotObjects/PlotTabObject.js @@ -2,7 +2,7 @@ * Project  : AMDA-NG * Name : PlotTabObject.js * @class amdaPlotObj.PlotTabObject - * @extends Ext.data.Model + * @extends amdaModel.AmdaTimeObject * @brief Plot Tab Business Object Definition * @author Benjamin Renard * @version $Id: PlotTabObject.js benjamin $ @@ -14,7 +14,7 @@ Ext.define('amdaPlotObj.PlotTabObject', { - extend: 'Ext.data.Model', + extend: 'amdaModel.AmdaTimeObject', idProperty: 'id', requires: [ @@ -27,6 +27,8 @@ Ext.define('amdaPlotObj.PlotTabObject', { fields : [ {name: 'id', type: 'int'}, + {name: 'tree-simplified-view', type: 'boolean'}, + {name: 'multi-plot-linked', type: 'boolean'}, {name: 'page-title-text', type: 'string'}, {name: 'page-title-color', type: 'string'}, {name: 'page-title-position', type: 'string'}, @@ -146,6 +148,10 @@ Ext.define('amdaPlotObj.PlotTabObject', { setDefaultValues: function() { + this.set('tree-simplified-view', amdaPlotObj.PlotObjectConfig.defaultValues.tree.simplifiedView); + + this.set('multi-plot-linked', false); + this.set('page-title-text', ''); this.set('page-title-color', amdaPlotObj.PlotObjectConfig.defaultValues.page.title.color); this.set('page-title-position', amdaPlotObj.PlotObjectConfig.defaultValues.page.title.position); @@ -196,6 +202,8 @@ Ext.define('amdaPlotObj.PlotTabObject', { var tabValues = new Object(); tabValues['id'] = this.get('id'); + tabValues['tree-simplified-view'] = this.get('tree-simplified-view'); + tabValues['multi-plot-linked'] = this.get('multi-plot-linked'); tabValues['page-title-text'] = this.get('page-title-text'); tabValues['page-title-color'] = this.get('page-title-color'); tabValues['page-title-position'] = this.get('page-title-position'); @@ -218,6 +226,32 @@ Ext.define('amdaPlotObj.PlotTabObject', { tabValues['page-font-bold'] = this.get('page-font-bold'); tabValues['page-font-italic'] = this.get('page-font-italic'); + tabValues['timesrc'] = this.get('timesrc'); + // if there's at least one timeTable name into 'timeTables' collection + if (this.get('timesrc') == amdaModel.AmdaTimeObject.inputTimeSrc[0] && this.get('timeTables') && this.get('timeTables').length){ + // get complete timeTables collection + var timeTables = this.get('timeTables'); + // init an empty array for timeTables + tabValues['timeTables'] = []; + // for each interval record + Ext.Array.each(timeTables, function(item, index, all){ + if (!item.$className) { + tabValues['timeTables'][index] = {timeTableName : item.timeTableName, id : item.id}; + } + // get Json simplified value + else { + tabValues['timeTables'][index] = item.getJsonValues(); + } + }); + } else { + tabValues['startDate'] = this.get('startDate'); + tabValues['stopDate'] = this.get('stopDate'); + tabValues['durationDay'] = this.get('durationDay'); + tabValues['durationHour'] = this.get('durationHour'); + tabValues['durationMin'] = this.get('durationMin'); + tabValues['durationSec'] = this.get('durationSec'); + } + tabValues['page-layout-type'] = this.get('page-layout-type'); if (this.get('page-layout-object') != null) tabValues['page-layout-object'] = this.get('page-layout-object').getJsonValues(); diff --git a/js/app/views/PlotComponents/PlotPanelForm.js b/js/app/views/PlotComponents/PlotPanelForm.js index f2935b9..1ad5cfd 100644 --- a/js/app/views/PlotComponents/PlotPanelForm.js +++ b/js/app/views/PlotComponents/PlotPanelForm.js @@ -120,7 +120,7 @@ Ext.define('amdaPlotComp.PlotPanelForm', { if (value != oldValue) { me.object.updatePlotType(value, true); - if (!me.crtTree.isSimplifiedView) + if (!me.crtTree.tabObject.get('tree-simplified-view')) { me.crtTree.buildPanelAxesNode(me.object); me.crtTree.buildPanelAdditionalObjectsNode(me.object); diff --git a/js/app/views/PlotComponents/PlotTabContent.js b/js/app/views/PlotComponents/PlotTabContent.js index a08c375..e1130ee 100644 --- a/js/app/views/PlotComponents/PlotTabContent.js +++ b/js/app/views/PlotComponents/PlotTabContent.js @@ -21,6 +21,12 @@ Ext.define('amdaPlotComp.PlotTabContent', { //Link to the Plot Element Panel plotElementPanel: null, + //linkk to the Plot Tab Panel + plotTabPanel : null, + + //Link to the time selctor + timeSelector : null, + //Tab Object object: null, @@ -32,15 +38,31 @@ Ext.define('amdaPlotComp.PlotTabContent', { setTabObject : function(object) { this.object = object; this.treePlot.buildTree(this.object); + this.timeSelector.intervalSel.setInterval(this.object.get('startDate'), this.object.get('stopDate')); + }, + + updateLinkedToMultiPlotMode : function (isLinkedToMultiPlotMode) { + this.timeSelector.setVisible(!isLinkedToMultiPlotMode); + this.plotTabPanel.updateLinkedToMultiPlotMode(isLinkedToMultiPlotMode); + }, + + updateTimeObject : function() { + var timeSource = this.timeSelector.getActiveTimeSource(); + var tabForm = this.getForm(); + tabForm.updateRecord(this.object); + this.object.set('timesrc', timeSource); + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) + this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items); }, init : function(config) { var me = this; this.plotElementPanel = config.plotElementPanel; + this.plotTabPanel = config.plotTabPanel; - //var timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelectorTab' + config.tabObjectId, flex: 2, hidden: true} ); - this.treePlot = new amdaPlotComp.PlotTree({flex: 3, plotElementPanel: this.plotElementPanel}); + this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelectorTab' + config.tabId, flex: 2, hidden: true} ); + this.treePlot = new amdaPlotComp.PlotTree({flex: 3, plotElementPanel: this.plotElementPanel, plotTabContent: this}); var myConf = { bodyStyle: { background : '#dfe8f6' }, @@ -53,8 +75,8 @@ Ext.define('amdaPlotComp.PlotTabContent', { align: 'stretch' }, items: [ - this.treePlot/*, - timeSelector */ + this.treePlot, + this.timeSelector ] }; diff --git a/js/app/views/PlotComponents/PlotTabPanel.js b/js/app/views/PlotComponents/PlotTabPanel.js index a42c338..9e18dfd 100644 --- a/js/app/views/PlotComponents/PlotTabPanel.js +++ b/js/app/views/PlotComponents/PlotTabPanel.js @@ -17,6 +17,9 @@ Ext.define('amdaPlotComp.PlotTabPanel', { //Link to the Plot Element Panel plotElementPanel: null, + + //Link to the Plot UI + plotUI : null, //Request object object: null, @@ -30,17 +33,19 @@ Ext.define('amdaPlotComp.PlotTabPanel', { { this.object = object; this.removeAll(); + var isFirstTab = true; this.object.tabs().each(function (rec) { - this.addPlotTab(rec); + this.addPlotTab(rec, isFirstTab); + isFirstTab = false; }, this); }, - addPlotTab: function(tabObject) + addPlotTab: function(tabObject, selectTab) { var tabNumber = this.getTabBar().items.getCount(); - var tabContent = new amdaPlotComp.PlotTabContent({plotElementPanel: this.plotElementPanel}); + var tabContent = new amdaPlotComp.PlotTabContent({plotElementPanel: this.plotElementPanel, plotTabPanel : this, tabId : tabObject.get('id')}); tabContent.setTabObject(tabObject); - this.add({ + var tabComp = this.add({ title: 'Plot '+tabNumber, closable: true, layout: 'fit', @@ -69,7 +74,10 @@ Ext.define('amdaPlotComp.PlotTabPanel', { this.updatePlotTabs(); } } - }).show(); + }); + + if (selectTab) + this.setActiveTab(tabComp); return tabContent; }, @@ -85,6 +93,17 @@ Ext.define('amdaPlotComp.PlotTabPanel', { } }, + updateLinkedToMultiPlotMode : function(isLinkedToMultiPlotMode) { + this.plotUI.updateLinkedToMultiPlotMode(isLinkedToMultiPlotMode); + }, + + updateTimeObject : function() { + for (i = 0; i < this.items.getCount(); ++i) + { + this.items.getAt(i).items.getAt(0).updateTimeObject(); + } + }, + getTreeFromPlotTab: function(plotTab) { return plotTab.child().treePlot; @@ -94,6 +113,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', { var me = this; this.plotElementPanel = config.plotElementPanel; + this.plotUI = config.plotUI; var myConf = { plain: true, @@ -108,7 +128,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', { text:'+', closable: false, handler:function(btn,e){ - var tabContent = me.addPlotTab(me.object.createNewTab()); + var tabContent = me.addPlotTab(me.object.createNewTab(), true); } }] }, @@ -121,6 +141,7 @@ Ext.define('amdaPlotComp.PlotTabPanel', { me.plotElementPanel.resetElement(); else me.plotElementPanel.setElement(selectedNode.type,selectedNode.object, newCardTree); + newCardTree.updateLinkedToMultiPlotMode(); }, scope: me } diff --git a/js/app/views/PlotComponents/PlotTree.js b/js/app/views/PlotComponents/PlotTree.js index a42b8a8..0edfe04 100644 --- a/js/app/views/PlotComponents/PlotTree.js +++ b/js/app/views/PlotComponents/PlotTree.js @@ -15,11 +15,16 @@ Ext.define('amdaPlotComp.PlotTree', { 'amdaPlotObj.PlotTreeNode' ], - // - isSimplifiedView: false, + //Link to the combo box to define the use of the simplified view + simplifiedViewCombo : null, + + //Link to the combo to attach the tab to the multi plot mode //Link to the Plot Element Panel plotElementPanel: null, + + //Link to the Plot Tab Content Panel + plotTabContent : null, //Tab object tabObject: null, @@ -32,18 +37,16 @@ Ext.define('amdaPlotComp.PlotTree', { this.callParent(arguments); }, - setSimplifiedMode: function(isSimplifiedView) { - this.isSimplifiedView = isSimplifiedView; - this.buildTree(this.tabObject); - }, - buildTree: function(tabObject) { if (this.store.getRootNode().hasChildNodes()) this.store.getRootNode().removeAll(); this.tabObject = tabObject; - if (!this.isSimplifiedView) + this.simplifiedViewCombo.setValue(this.tabObject.get('tree-simplified-view')); + this.linkToMultiPlotCombo.setValue(this.tabObject.get('multi-plot-linked')); + + if (!this.tabObject.get('tree-simplified-view')) { //Page Node var pageNode = this.store.getRootNode().appendChild(new amdaPlotObj.PlotPageTreeNode({object : tabObject})); @@ -129,7 +132,7 @@ Ext.define('amdaPlotComp.PlotTree', { //Retrieve corresponding panel node if (panelNode.object == panelObject) { - if (!me.isSimplifiedView) + if (!me.tabObject.get('tree-simplified-view')) { //Retrieve params node paramsNode = panelNode.findChild('type', 'params'); @@ -275,7 +278,7 @@ Ext.define('amdaPlotComp.PlotTree', { addPanelNode: function(panelObject) { var panelNode = this.panelsNode.appendChild(new amdaPlotObj.PlotPanelTreeNode({object : panelObject})); - if (!this.isSimplifiedView) + if (!this.tabObject.get('tree-simplified-view')) { //Axes node this.buildPanelAxesNode(panelObject); @@ -379,7 +382,7 @@ Ext.define('amdaPlotComp.PlotTree', { break; case 'param' : var panelObject = null; - if (!this.isSimplifiedView) + if (!this.tabObject.get('tree-simplified-view')) panelObject = record.parentNode.parentNode.object; else panelObject = record.parentNode.object; @@ -389,7 +392,7 @@ Ext.define('amdaPlotComp.PlotTree', { break; case 'text-legend' : var panelObject = null; - if (!this.isSimplifiedView) + if (!this.tabObject.get('tree-simplified-view')) panelObject = record.parentNode.parentNode.object; else panelObject = record.parentNode.object; @@ -398,7 +401,7 @@ Ext.define('amdaPlotComp.PlotTree', { break; case 'constant' : var panelObject = null; - if (!this.isSimplifiedView) + if (!this.tabObject.get('tree-simplified-view')) panelObject = record.parentNode.parentNode.object; else panelObject = record.parentNode.object; @@ -407,7 +410,7 @@ Ext.define('amdaPlotComp.PlotTree', { break; case 'text-obj' : var panelObject = null; - if (!this.isSimplifiedView) + if (!this.tabObject.get('tree-simplified-view')) panelObject = record.parentNode.parentNode.object; else panelObject = record.parentNode.object; @@ -416,7 +419,7 @@ Ext.define('amdaPlotComp.PlotTree', { break; case 'curve' : var panelObject = null; - if (!this.isSimplifiedView) + if (!this.tabObject.get('tree-simplified-view')) panelObject = record.parentNode.parentNode.object; else panelObject = record.parentNode.object; @@ -425,7 +428,7 @@ Ext.define('amdaPlotComp.PlotTree', { break; case 'fill' : var panelObject = null; - if (!this.isSimplifiedView) + if (!this.tabObject.get('tree-simplified-view')) panelObject = record.parentNode.parentNode.object; else panelObject = record.parentNode.object; @@ -693,6 +696,10 @@ Ext.define('amdaPlotComp.PlotTree', { } }, + updateLinkedToMultiPlotMode : function() { + this.plotTabContent.updateLinkedToMultiPlotMode(this.tabObject.get('multi-plot-linked')); + }, + init : function(config) { var me = this; @@ -706,6 +713,35 @@ Ext.define('amdaPlotComp.PlotTree', { this.plotElementPanel = config.plotElementPanel; + this.simplifiedViewCombo = Ext.create('Ext.form.field.Checkbox', { + xtype: 'checkbox', + boxLabel: 'Simplified View', + listeners: { + change: function(combo, newValue, oldValue, eOpts) { + if (this.tabObject) + this.tabObject.set('tree-simplified-view', newValue); + if (newValue != oldValue) + this.buildTree(this.tabObject); + }, + scope: this + } + }); + + this.linkToMultiPlotCombo = Ext.create('Ext.form.field.Checkbox', { + xtype: 'checkbox', + boxLabel: 'Link to MultiPlot', + listeners: { + change: function(combo, newValue, oldValue, eOpts) { + if (this.tabObject) + { + this.tabObject.set('multi-plot-linked', newValue); + this.updateLinkedToMultiPlotMode(); + } + }, + scope: this + } + }); + var myConf = { store: store, rootVisible: false, @@ -756,16 +792,9 @@ Ext.define('amdaPlotComp.PlotTree', { scope: this }, '->', - { - xtype: 'checkbox', - boxLabel: 'Simplified View', - listeners: { - change: function(combo, newValue, oldValue, eOpts) { - this.setSimplifiedMode(newValue); - }, - scope: this - } - } + this.linkToMultiPlotCombo, + ' ', + this.simplifiedViewCombo ] }; diff --git a/js/app/views/PlotUI.js b/js/app/views/PlotUI.js index 1474132..50bcc3b 100644 --- a/js/app/views/PlotUI.js +++ b/js/app/views/PlotUI.js @@ -24,6 +24,8 @@ Ext.define('amdaUI.PlotUI', { formPanel: null, + multiPlotIntervalPanel : null, + plotOutput: null, plotTabs : null, @@ -76,11 +78,12 @@ Ext.define('amdaUI.PlotUI', { */ doPlot : function(){ var timeSource = this.timeSelector.getActiveTimeSource(); - var basicForm = this.formPanel.getForm(); - basicForm.updateRecord(this.object); + var multiPlotForm = this.multiPlotIntervalPanel.getForm(); + multiPlotForm.updateRecord(this.object); this.object.set('timesrc', timeSource); if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items); + this.plotTabs.updateTimeObject(); // fire execution var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); @@ -122,14 +125,18 @@ Ext.define('amdaUI.PlotUI', { this.timeSelector.intervalSel.updateDuration(); }, + updateLinkedToMultiPlotMode : function(isLinkedToMultiPlotMode) { + this.multiPlotIntervalPanel.setVisible(isLinkedToMultiPlotMode); + }, + init : function(config) { - this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelector' + config.id, flex: 1} ); + this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelector' + config.id, flex: 1, title : 'MultiPlot Time Selection'} ); this.plotOutput = new amdaPlotComp.PlotOutputForm({flex: 2}); this.plotElement = new amdaPlotComp.PlotElementPanel({flex: 3}); - this.plotTabs = new amdaPlotComp.PlotTabPanel({flex: 2, plotElementPanel : this.plotElement}); + this.plotTabs = new amdaPlotComp.PlotTabPanel({flex: 2, plotElementPanel : this.plotElement, plotUI : this}); this.optionsPanel = new Ext.form.Panel({ layout: { @@ -147,6 +154,18 @@ Ext.define('amdaUI.PlotUI', { ] }); + this.multiPlotIntervalPanel = new Ext.form.Panel({ + layout: 'fit', + bodyStyle: { background : '#dfe8f6' }, + visible : false, + defaults: { + border: false + }, + items : [ + this.timeSelector + ] + }); + this.formPanel = new Ext.form.Panel({ region: 'center', layout: { @@ -173,7 +192,7 @@ Ext.define('amdaUI.PlotUI', { flex: 1, items: [ this.plotTabs, - this.timeSelector + this.multiPlotIntervalPanel ] }, { diff --git a/js/app/views/TimeSelectorUI.js b/js/app/views/TimeSelectorUI.js index 715823d..265e35d 100644 --- a/js/app/views/TimeSelectorUI.js +++ b/js/app/views/TimeSelectorUI.js @@ -220,7 +220,7 @@ Ext.define('amdaUI.TimeSelectorUI', var config = { - title: 'Time Selection', + title: (!this.title) ? 'Time Selection' : this.title, layout: 'fit', items: [ @@ -228,7 +228,7 @@ Ext.define('amdaUI.TimeSelectorUI', ] }; - Ext.apply(this, config); + Ext.apply(this, config); this.callParent(arguments); } }); -- libgit2 0.21.2