From 003ba315034bd2e1e6fee20a756ec5d3c9e72bad Mon Sep 17 00:00:00 2001 From: Benjamin Renard <benjamin.renard@akka.eu> Date: Thu, 27 Aug 2015 09:04:29 +0200 Subject: [PATCH] Add Epoch Plot and Layouts for plot definition --- js/app/models/PlotObjects/PlotLayoutAutoObject.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ js/app/models/PlotObjects/PlotLayoutManualObject.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ js/app/models/PlotObjects/PlotLayoutVerticalObject.js | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ js/app/models/PlotObjects/PlotObjectConfig.js | 24 +++++++++++++++++++++--- js/app/models/PlotObjects/PlotPanelObject.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++--------- js/app/models/PlotObjects/PlotParamObject.js | 4 +++- js/app/models/PlotObjects/PlotRequestObject.js | 2 +- js/app/models/PlotObjects/PlotSerieObject.js | 5 ++++- js/app/models/PlotObjects/PlotTabObject.js | 46 ++++++++++++++++++++++++++++++++++++++++++++-- js/app/models/PlotObjects/PlotTreeNode.js | 16 +++++++++++++--- js/app/views/NewPlotUI.js | 12 +++++++++++- js/app/views/PlotComponents/PlotElementPanel.js | 6 +++++- js/app/views/PlotComponents/PlotEpochAxisForm.js | 2 +- js/app/views/PlotComponents/PlotLayoutAutoForm.js | 26 ++++++++++++++++++++++++++ js/app/views/PlotComponents/PlotLayoutForm.js | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ js/app/views/PlotComponents/PlotLayoutManualForm.js | 35 +++++++++++++++++++++++++++++++++++ js/app/views/PlotComponents/PlotLayoutVerticalForm.js | 38 ++++++++++++++++++++++++++++++++++++++ js/app/views/PlotComponents/PlotPageForm.js | 12 ++++++++++-- js/app/views/PlotComponents/PlotPanelForm.js | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------- js/app/views/PlotComponents/PlotParamForm.js | 1 + js/app/views/PlotComponents/PlotSerieForm.js | 3 +++ js/app/views/PlotComponents/PlotStandardForm.js | 9 +++++++-- js/app/views/PlotComponents/PlotTree.js | 6 ++++-- 23 files changed, 604 insertions(+), 42 deletions(-) create mode 100644 js/app/models/PlotObjects/PlotLayoutAutoObject.js create mode 100644 js/app/models/PlotObjects/PlotLayoutManualObject.js create mode 100644 js/app/models/PlotObjects/PlotLayoutVerticalObject.js create mode 100644 js/app/views/PlotComponents/PlotLayoutAutoForm.js create mode 100644 js/app/views/PlotComponents/PlotLayoutForm.js create mode 100644 js/app/views/PlotComponents/PlotLayoutManualForm.js create mode 100644 js/app/views/PlotComponents/PlotLayoutVerticalForm.js diff --git a/js/app/models/PlotObjects/PlotLayoutAutoObject.js b/js/app/models/PlotObjects/PlotLayoutAutoObject.js new file mode 100644 index 0000000..f0c30e4 --- /dev/null +++ b/js/app/models/PlotObjects/PlotLayoutAutoObject.js @@ -0,0 +1,46 @@ +/** + * Project : AMDA-NG + * Name : PlotLayoutAutoObject.js + * @class amdaPlotObj.PlotLayoutAutoObject + * @extends Ext.data.Model + * @brief Plot Auto Layout Business Object Definition + * @author Benjamin Renard + * @version $Id: PlotLayoutAutoObject.js benjamin $ + ****************************************************************************** + * FT Id : Date : Name - Description + ****************************************************************************** + * : :25/08/2015: BRE - file creation + */ + + +Ext.define('amdaPlotObj.PlotLayoutAutoObject', { + extend: 'Ext.data.Model', + + requires: [ + 'amdaPlotObj.PlotObjectConfig' + ], + + fields : [ + {name: 'layout-panel-height', type: 'float'}, + {name: 'layout-panel-spacing', type: 'float'}, + {name: 'layout-expand', type: 'boolean'} + ], + + setDefaultValues: function() + { + this.set('layout-panel-height', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight); + this.set('layout-panel-spacing', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing); + this.set('layout-expand', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand); + }, + + getJsonValues : function() + { + var layoutValues = new Object(); + + layoutValues['layout-panel-height'] = this.get('layout-panel-height'); + layoutValues['layout-panel-spacing'] = this.get('layout-panel-spacing'); + layoutValues['layout-expand'] = this.get('layout-expand'); + + return layoutValues; + } +}); \ No newline at end of file diff --git a/js/app/models/PlotObjects/PlotLayoutManualObject.js b/js/app/models/PlotObjects/PlotLayoutManualObject.js new file mode 100644 index 0000000..ac3ceaf --- /dev/null +++ b/js/app/models/PlotObjects/PlotLayoutManualObject.js @@ -0,0 +1,49 @@ +/** + * Project : AMDA-NG + * Name : PlotLayoutManualObject.js + * @class amdaPlotObj.PlotLayoutManualObject + * @extends Ext.data.Model + * @brief Plot Manual Layout Business Object Definition + * @author Benjamin Renard + * @version $Id: PlotLayoutManualObject.js benjamin $ + ****************************************************************************** + * FT Id : Date : Name - Description + ****************************************************************************** + * : :25/08/2015: BRE - file creation + */ + + +Ext.define('amdaPlotObj.PlotLayoutManualObject', { + extend: 'Ext.data.Model', + + requires: [ + 'amdaPlotObj.PlotObjectConfig' + ], + + fields : [ + {name: 'layout-timeplot-margin-left', type: 'float', useNull:true}, + {name: 'layout-timeplot-margin-right', type: 'float', useNull:true}, + {name: 'layout-xyplot-margin-left', type: 'float', useNull:true}, + {name: 'layout-xyplot-margin-right', type: 'float', useNull:true} + ], + + setDefaultValues: function() + { + this.set('layout-timeplot-margin-left', null); + this.set('layout-timeplot-margin-right', null); + this.set('layout-xyplot-margin-left', null); + this.set('layout-xyplot-margin-right', null); + }, + + getJsonValues : function() + { + var layoutValues = new Object(); + + layoutValues['layout-timeplot-margin-left'] = this.get('layout-timeplot-margin-left') ? this.get('layout-timeplot-margin-left') : -1; + layoutValues['layout-timeplot-margin-right'] = this.get('layout-timeplot-margin-right') ? this.get('layout-timeplot-margin-right') : -1; + layoutValues['layout-xyplot-margin-left'] = this.get('layout-xyplot-margin-left') ? this.get('layout-xyplot-margin-left') : -1; + layoutValues['layout-xyplot-margin-right'] = this.get('layout-xyplot-margin-right') ? this.get('layout-xyplot-margin-right') : -1; + + return layoutValues; + } +}); \ No newline at end of file diff --git a/js/app/models/PlotObjects/PlotLayoutVerticalObject.js b/js/app/models/PlotObjects/PlotLayoutVerticalObject.js new file mode 100644 index 0000000..c4f5cf8 --- /dev/null +++ b/js/app/models/PlotObjects/PlotLayoutVerticalObject.js @@ -0,0 +1,58 @@ +/** + * Project : AMDA-NG + * Name : PlotLayoutVerticalObject.js + * @class amdaPlotObj.PlotLayoutVerticalObject + * @extends Ext.data.Model + * @brief Plot Vertical Layout Business Object Definition + * @author Benjamin Renard + * @version $Id: PlotLayoutVerticalObject.js benjamin $ + ****************************************************************************** + * FT Id : Date : Name - Description + ****************************************************************************** + * : :25/08/2015: BRE - file creation + */ + + +Ext.define('amdaPlotObj.PlotLayoutVerticalObject', { + extend: 'Ext.data.Model', + + requires: [ + 'amdaPlotObj.PlotObjectConfig' + ], + + fields : [ + {name: 'layout-panel-height', type: 'float'}, + {name: 'layout-panel-spacing', type: 'float'}, + {name: 'layout-expand', type: 'boolean'}, + //{name: 'layout-timeplot-width', type: 'float', useNull:true}, + {name: 'layout-timeplot-height', type: 'float', useNull:true}, + {name: 'layout-xyplot-width', type: 'float', useNull:true}, + {name: 'layout-xyplot-height', type: 'float', useNull:true} + ], + + setDefaultValues: function() + { + this.set('layout-panel-height', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight); + this.set('layout-panel-spacing', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing); + this.set('layout-expand', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand); + //this.set('layout-timeplot-width', null); + this.set('layout-timeplot-height', null); + this.set('layout-xyplot-width', null); + this.set('layout-xyplot-height', null); + }, + + getJsonValues : function() + { + var layoutValues = new Object(); + + layoutValues['layout-panel-height'] = this.get('layout-panel-height'); + layoutValues['layout-panel-spacing'] = this.get('layout-panel-spacing'); + layoutValues['layout-expand'] = this.get('layout-expand'); + //layoutValues['layout-timeplot-width'] = this.get('layout-timeplot-width') ? this.get('layout-timeplot-width') : -1; + layoutValues['layout-timeplot-height'] = this.get('layout-timeplot-height') ? this.get('layout-timeplot-height') : -1; + layoutValues['layout-xyplot-width'] = this.get('layout-xyplot-width') ? this.get('layout-xyplot-width') : -1; + layoutValues['layout-xyplot-height'] = this.get('layout-xyplot-height') ? this.get('layout-xyplot-height') : -1; + + return layoutValues; + } +}); \ No newline at end of file diff --git a/js/app/models/PlotObjects/PlotObjectConfig.js b/js/app/models/PlotObjects/PlotObjectConfig.js index 3029f7b..175c75e 100644 --- a/js/app/models/PlotObjects/PlotObjectConfig.js +++ b/js/app/models/PlotObjects/PlotObjectConfig.js @@ -36,6 +36,12 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { font : { name : 'sans-serif', size: '12' + }, + layout : { + type : 'vertical', + panelHeight : 0.5, + panelSpacing : 0.05, + expand : false } }, panel : { @@ -79,9 +85,10 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { }, symbols : { type : 'dot', - size : 1, + size : 3, color : 'auto' - } + }, + resamplingMode : 'xparam' }, spectro : { yAxis : 'y-left' @@ -222,5 +229,16 @@ Ext.define('amdaPlotObj.PlotObjectConfig', { {'key' : '0', 'value' : '0'}, {'key' : '1', 'value' : '1'}, {'key' : '2', 'value' : '2'} - ] + ], + + availablePageLayouts : [ + {'key' : 'vertical', 'value' : 'Vertical'}, + {'key' : 'auto', 'value' : 'Auto'}, + {'key' : 'manual', 'value' : 'Manual'} + ], + + availableResamplingModes : [ + {'key' : 'xparam', 'value' : 'X Parameter'}, + {'key' : 'yparam', 'value' : 'Y Parameter'} + ] }); \ No newline at end of file diff --git a/js/app/models/PlotObjects/PlotPanelObject.js b/js/app/models/PlotObjects/PlotPanelObject.js index 38cc224..a55a497 100644 --- a/js/app/models/PlotObjects/PlotPanelObject.js +++ b/js/app/models/PlotObjects/PlotPanelObject.js @@ -36,19 +36,31 @@ Ext.define('amdaPlotObj.PlotPanelObject', { {name: 'panel-title-font-size', type: 'int'}, {name: 'panel-title-font-bold', type: 'boolean'}, {name: 'panel-title-font-italic', type: 'boolean'}, - {name: 'panel-margin-x', type: 'float'}, - {name: 'panel-margin-y', type: 'float'}, {name: 'panel-plot-type', type: 'string'}, {name: 'panel-font-activated', type: 'boolean'}, {name: 'panel-font-name', type: 'string'}, {name: 'panel-font-size', type: 'int'}, {name: 'panel-font-bold', type: 'boolean'}, {name: 'panel-font-italic', type: 'boolean'}, + //Only used with layout Manual + {name: 'panel-bounds-x', type: 'float'}, + {name: 'panel-bounds-y', type: 'float'}, + {name: 'panel-bounds-width', type: 'float'}, + {name: 'panel-bounds-height', type: 'float'}, + {name: 'panel-margin-left', type: 'float', useNull:true}, + {name: 'panel-margin-right', type: 'float', useNull:true}, + //Only used with layout Vertical + {name: 'panel-prefered-width', type: 'float', useNull:true}, + {name: 'panel-prefered-height', type: 'float', useNull:true}, + //Only used for xyPlot + {name: 'panel-scatter-isotropic', type: 'boolean'}, //Only used for statusPlot and timePlot {name: 'panel-status-position', type: 'string'}, {name: 'panel-status-colormap', type: 'int'}, //Only used for tickPlot and timePlot - {name: 'panel-tick-format', type: 'int'} + {name: 'panel-tick-format', type: 'int'}, + //Only used for epochPlot + {name: 'panel-epoch-centertimeid', type: 'string'} ], associations : [ @@ -142,7 +154,9 @@ Ext.define('amdaPlotObj.PlotPanelObject', { return true; }, - updatePlotType: function(plotType, forceUpdate = false) { + updatePlotType: function(plotType, forceUpdate) { + forceUpdate = (typeof forceUpdate !== 'undefined') ? forceUpdate : false; + if (!forceUpdate && (plotType == this.get('panel-plot-type'))) return; @@ -178,20 +192,32 @@ Ext.define('amdaPlotObj.PlotPanelObject', { this.set('panel-title-font-bold', false); this.set('panel-title-font-italic', false); - this.set('panel-margin-x', 0); - this.set('panel-margin-y', 0); - this.set('panel-font-activated', false); this.set('panel-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.panel.font.name); this.set('panel-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.panel.font.size); this.set('panel-font-bold', false); this.set('panel-font-italic', false); + this.set('panel-bounds-x', 0); + this.set('panel-bounds-y', 0); + this.set('panel-bounds-width', 1); + this.set('panel-bounds-height', 1); + + this.set('panel-margin-left', null); + this.set('panel-margin-right', null); + + this.set('panel-prefered-width', null); + this.set('panel-prefered-height', null); + + this.set('panel-scatter-isotropic', false); + this.set('panel-status-position', amdaPlotObj.PlotObjectConfig.defaultValues.panel.status.position); this.set('panel-status-colormap', amdaPlotObj.PlotObjectConfig.defaultValues.panel.status.colorMap); this.set('panel-tick-format', ""); + this.set('panel-epoch-centertimeid', ""); + this.updatePlotType(amdaPlotObj.PlotObjectConfig.defaultValues.panel.plotType); }, @@ -209,8 +235,6 @@ Ext.define('amdaPlotObj.PlotPanelObject', { panelValues['panel-title-font-size'] = this.get('panel-title-font-size'); panelValues['panel-title-font-bold'] = this.get('panel-title-font-bold'); panelValues['panel-title-font-italic'] = this.get('panel-title-font-italic'); - panelValues['panel-margin-x'] = this.get('panel-margin-x'); - panelValues['panel-margin-y'] = this.get('panel-margin-y'); panelValues['panel-plot-type'] = this.get('panel-plot-type'); panelValues['panel-font-activated'] = this.get('panel-font-activated'); panelValues['panel-font-name'] = this.get('panel-font-name'); @@ -218,6 +242,20 @@ Ext.define('amdaPlotObj.PlotPanelObject', { panelValues['panel-font-bold'] = this.get('panel-font-bold'); panelValues['panel-font-italic'] = this.get('panel-font-italic'); + panelValues['panel-bounds-x'] = this.get('panel-bounds-x'); + panelValues['panel-bounds-y'] = this.get('panel-bounds-y'); + panelValues['panel-bounds-width'] = this.get('panel-bounds-width'); + panelValues['panel-bounds-height'] = this.get('panel-bounds-height'); + + panelValues['panel-margin-left'] = this.get('panel-margin-left') ? this.get('panel-margin-left') : -1; + panelValues['panel-margin-right'] = this.get('panel-margin-right') ? this.get('panel-margin-right') : -1; + + panelValues['panel-prefered-width'] = this.get('panel-prefered-width') ? this.get('panel-prefered-width') : -1; + panelValues['panel-prefered-height'] = this.get('panel-prefered-height') ? this.get('panel-prefered-height') : -1; + + if (this.get('panel-plot-type') == 'xyPlot') + panelValues['panel-scatter-isotropic'] = this.get('panel-scatter-isotropic'); + if ((this.get('panel-plot-type') == 'statusPlot') || (this.get('panel-plot-type') == 'timePlot')) { panelValues['panel-status-position'] = this.get('panel-status-position'); @@ -229,6 +267,9 @@ Ext.define('amdaPlotObj.PlotPanelObject', { panelValues['panel-tick-format'] = this.get('panel-tick-format'); } + if (this.get('panel-plot-type') == 'epochPlot') + panelValues['panel-epoch-centertimeid'] = this.get('panel-epoch-centertimeid'); + panelValues['axes'] = []; this.axes().each(function (axe, index) { diff --git a/js/app/models/PlotObjects/PlotParamObject.js b/js/app/models/PlotObjects/PlotParamObject.js index 8711261..5d56f15 100644 --- a/js/app/models/PlotObjects/PlotParamObject.js +++ b/js/app/models/PlotObjects/PlotParamObject.js @@ -39,8 +39,10 @@ Ext.define('amdaPlotObj.PlotParamObject', { } ], - updateDrawingType: function(type, forceUpdate = false) + updateDrawingType: function(type, forceUpdate) { + forceUpdate = (typeof forceUpdate !== 'undefined') ? forceUpdate : false; + if (!forceUpdate && (type == this.get('param-drawing-type'))) return; diff --git a/js/app/models/PlotObjects/PlotRequestObject.js b/js/app/models/PlotObjects/PlotRequestObject.js index a66e070..19d5489 100644 --- a/js/app/models/PlotObjects/PlotRequestObject.js +++ b/js/app/models/PlotObjects/PlotRequestObject.js @@ -74,7 +74,7 @@ Ext.define('amdaPlotObj.PlotRequestObject', { requestValues['one-file-per-interval'] = this.get('one-file-per-interval'); requestValues['request-name'] = this.get('request-name'); - requestValues['timesrc'] = "Interval";//BRE - ToDo this.get('timesrc'); + requestValues['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 diff --git a/js/app/models/PlotObjects/PlotSerieObject.js b/js/app/models/PlotObjects/PlotSerieObject.js index f806152..b69a136 100644 --- a/js/app/models/PlotObjects/PlotSerieObject.js +++ b/js/app/models/PlotObjects/PlotSerieObject.js @@ -32,7 +32,8 @@ Ext.define('amdaPlotObj.PlotSerieObject', { {name: 'serie-symbols-color', type: 'string'}, {name: 'serie-colored-param', type: 'string'}, //Only used for xyPlot - {name: 'serie-xaxis-param', type: 'string'} + {name: 'serie-xaxis-param', type: 'string'}, + {name: 'serie-resampling-mode', type: 'string'} ], setDefaultValues: function() @@ -48,6 +49,7 @@ Ext.define('amdaPlotObj.PlotSerieObject', { this.set('serie-symbols-color', amdaPlotObj.PlotObjectConfig.defaultValues.serie.symbols.color); this.set('serie-colored-param', ''); this.set('serie-xaxis-param', ''); + this.set('serie-resampling-mode', amdaPlotObj.PlotObjectConfig.defaultValues.serie.resamplingMode); }, getJsonValues : function() @@ -65,6 +67,7 @@ Ext.define('amdaPlotObj.PlotSerieObject', { serieValues['serie-symbols-color'] = this.get('serie-symbols-color'); serieValues['serie-colored-param'] = this.get('serie-colored-param'); serieValues['serie-xaxis-param'] = this.get('serie-xaxis-param'); + serieValues['serie-resampling-mode'] = this.get('serie-resampling-mode'); return serieValues; } diff --git a/js/app/models/PlotObjects/PlotTabObject.js b/js/app/models/PlotObjects/PlotTabObject.js index 0a40c97..c89bb36 100644 --- a/js/app/models/PlotObjects/PlotTabObject.js +++ b/js/app/models/PlotObjects/PlotTabObject.js @@ -21,7 +21,10 @@ Ext.define('amdaPlotObj.PlotTabObject', { requires: [ 'amdaPlotObj.PlotObjectConfig', - 'amdaPlotObj.PlotPanelObject' + 'amdaPlotObj.PlotPanelObject', + 'amdaPlotObj.PlotLayoutVerticalObject', + 'amdaPlotObj.PlotLayoutAutoObject', + 'amdaPlotObj.PlotLayoutManualObject' ], fields : [ @@ -46,7 +49,9 @@ Ext.define('amdaPlotObj.PlotTabObject', { {name: 'page-font-name', type: 'string'}, {name: 'page-font-size', type: 'int'}, {name: 'page-font-bold', type: 'boolean'}, - {name: 'page-font-italic', type: 'boolean'} + {name: 'page-font-italic', type: 'boolean'}, + {name: 'page-layout-type', type: 'string'}, + {name: 'page-layout-object', type: 'auto'} ], associations : [ @@ -77,6 +82,36 @@ Ext.define('amdaPlotObj.PlotTabObject', { return true; }, + setLayout: function(layoutType, forceUpdate) + { + forceUpdate = (typeof forceUpdate !== 'undefined') ? forceUpdate : false; + + if (!forceUpdate && (layoutType == this.get('page-layout-type'))) + return; + + this.set('page-layout-type', layoutType); + + //Create layout object in relation with the type + switch (layoutType) + { + case 'vertical' : + this.set('page-layout-object', new amdaPlotObj.PlotLayoutVerticalObject()); + break; + case 'auto' : + this.set('page-layout-object', new amdaPlotObj.PlotLayoutAutoObject()); + break; + case 'manual' : + this.set('page-layout-object', new amdaPlotObj.PlotLayoutManualObject()); + break; + default : + this.set('page-layout-object', null); + } + + //Set layout object to default status + if (this.get('page-layout-object') != null) + this.get('page-layout-object').setDefaultValues(); + }, + setDefaultValues: function() { this.set('page-title-text', ''); @@ -102,6 +137,9 @@ Ext.define('amdaPlotObj.PlotTabObject', { this.set('page-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.page.font.size); this.set('page-font-bold', false); this.set('page-font-italic', false); + + this.set('page-layout-type', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.type); + this.setLayout(amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.type, true); }, getJsonValues : function() @@ -130,6 +168,10 @@ Ext.define('amdaPlotObj.PlotTabObject', { tabValues['page-font-bold'] = this.get('page-font-bold'); tabValues['page-font-italic'] = this.get('page-font-italic'); + 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(); + tabValues['panels'] = []; this.panels().each(function (panel, index) { diff --git a/js/app/models/PlotObjects/PlotTreeNode.js b/js/app/models/PlotObjects/PlotTreeNode.js index 36e77f6..e463334 100644 --- a/js/app/models/PlotObjects/PlotTreeNode.js +++ b/js/app/models/PlotObjects/PlotTreeNode.js @@ -66,7 +66,11 @@ Ext.define('amdaPlotObj.PlotPageTreeNode', { getAdditionalText: function() { - return ' ('+this.object.get('page-dimension')+', '+this.object.get('page-orientation')+')'; + var addText = ' ('+this.object.get('page-dimension')+', '+this.object.get('page-orientation'); + if (this.object.get('page-superpose-mode')) + addText += ', superpose'; + addText += ')'; + return addText; } }); @@ -79,7 +83,12 @@ Ext.define('amdaPlotObj.PlotLayoutTreeNode', { text: 'Layout', - type: 'layout' + type: 'layout', + + getAdditionalText: function() + { + return ' ('+this.object.get('page-layout-type')+')'; + } }); Ext.define('amdaPlotObj.PlotPanelsTreeNode', { @@ -105,7 +114,8 @@ Ext.define('amdaPlotObj.PlotPanelTreeNode', { getAdditionalText: function() { - return ' ('+this.object.get('panel-plot-type')+')'; + var addText = ' ('+this.object.get('panel-plot-type')+')'; + return addText; } }); diff --git a/js/app/views/NewPlotUI.js b/js/app/views/NewPlotUI.js index 8681311..1ede97e 100644 --- a/js/app/views/NewPlotUI.js +++ b/js/app/views/NewPlotUI.js @@ -55,7 +55,7 @@ Ext.define('amdaUI.NewPlotUI', { var basicForm = this.formPanel.getForm(); basicForm.updateRecord(this.object); this.object.set('timesrc', timeSource); - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items); // fire execution @@ -76,6 +76,16 @@ Ext.define('amdaUI.NewPlotUI', { return false; }, + addTT : function(newTTName,newTTid) + { + this.timeSelector.addTT(newTTName,newTTid); + }, + + addTTs : function(TTarray) { + // set TTTab + this.timeSelector.setTTTab(TTarray); + }, + init : function(config) { this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'plotTimeSelector' + config.id, flex: 1} ); diff --git a/js/app/views/PlotComponents/PlotElementPanel.js b/js/app/views/PlotComponents/PlotElementPanel.js index c985056..4f4e540 100644 --- a/js/app/views/PlotComponents/PlotElementPanel.js +++ b/js/app/views/PlotComponents/PlotElementPanel.js @@ -18,7 +18,8 @@ Ext.define('amdaPlotComp.PlotElementPanel', { 'amdaPlotComp.PlotTimeAxisForm', 'amdaPlotComp.PlotEpochAxisForm', 'amdaPlotComp.PlotColorAxisForm', - 'amdaPlotComp.PlotParamForm' + 'amdaPlotComp.PlotParamForm', + 'amdaPlotComp.PlotLayoutForm' ], elementFormsManager : new Ext.AbstractManager(), @@ -82,6 +83,9 @@ Ext.define('amdaPlotComp.PlotElementPanel', { case 'param' : this.elementFormsManager.register(new amdaPlotComp.PlotParamForm({id : formId})); break; + case 'layout' : + this.elementFormsManager.register(new amdaPlotComp.PlotLayoutForm({id : formId})); + break; case '' : this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'Select an element to the tree to show options'})); break; diff --git a/js/app/views/PlotComponents/PlotEpochAxisForm.js b/js/app/views/PlotComponents/PlotEpochAxisForm.js index 5a320b4..8622d37 100644 --- a/js/app/views/PlotComponents/PlotEpochAxisForm.js +++ b/js/app/views/PlotComponents/PlotEpochAxisForm.js @@ -19,6 +19,6 @@ Ext.define('amdaPlotComp.PlotEpochAxisForm', { this.addStandardCheck('axis-epoch-normalized', 'Normalized') ]; - return Ext.Array.merge(timeItems, this.callParent()); + return Ext.Array.merge(epochItems, this.callParent()); } }); \ No newline at end of file diff --git a/js/app/views/PlotComponents/PlotLayoutAutoForm.js b/js/app/views/PlotComponents/PlotLayoutAutoForm.js new file mode 100644 index 0000000..f1520d8 --- /dev/null +++ b/js/app/views/PlotComponents/PlotLayoutAutoForm.js @@ -0,0 +1,26 @@ +/** + * Project : AMDA-NG + * Name : PlotLayoutAutoForm.js + * @class amdaPlotComp.PlotLayoutAutoForm + * @extends amdaPlotComp.PlotStandardForm + * @brief Form to define specifics Auto layout options + * @author Benjamin Renard + * @version $Id: PlotLayoutAutoForm.js benjamin $ + */ + +Ext.define('amdaPlotComp.PlotLayoutAutoForm', { + extend: 'amdaPlotComp.PlotStandardForm', + + setObject : function(object) { + this.object = object.get('page-layout-object'); + this.loadRecord(this.object); + }, + + getFormItems: function() { + return [ + this.addStandardFloat('layout-panel-height', 'Panels height', 0, 1), + this.addStandardFloat('layout-panel-spacing', 'Panels spacing', 0, 1), + this.addStandardCheck('layout-expand', 'Expand panels') + ]; + } +}); \ No newline at end of file diff --git a/js/app/views/PlotComponents/PlotLayoutForm.js b/js/app/views/PlotComponents/PlotLayoutForm.js new file mode 100644 index 0000000..43fd15f --- /dev/null +++ b/js/app/views/PlotComponents/PlotLayoutForm.js @@ -0,0 +1,91 @@ +/** + * Project : AMDA-NG + * Name : PlotLayoutForm.js + * @class amdaPlotComp.PlotLayoutForm + * @extends amdaPlotComp.PlotStandardForm + * @brief Form to define layout options + * @author Benjamin Renard + * @version $Id: PlotLayoutForm.js benjamin $ + */ + +Ext.define('amdaPlotComp.PlotLayoutForm', { + extend: 'amdaPlotComp.PlotStandardForm', + + requires: [ + 'amdaPlotComp.PlotLayoutVerticalForm', + 'amdaPlotComp.PlotLayoutAutoForm', + 'amdaPlotComp.PlotLayoutManualForm' + ], + + layoutOptionsContainer: null, + + layoutOptionsFormsManager : new Ext.AbstractManager(), + + setObject : function(object) { + this.object = object; + this.loadRecord(this.object); + this.updateLayoutOptions(); + }, + + getLayoutOptionsForm: function(type) { + var formId = ''; + if (!type || (type == '')) + formId = 'none'; + else + formId = type; + + formId += '-layout-options-form'; + + if (!this.layoutOptionsFormsManager.get(formId)) + { + switch(type) + { + //Create layout options form + case 'vertical' : + this.layoutOptionsFormsManager.register(new amdaPlotComp.PlotLayoutVerticalForm({id : formId})); + break; + case 'auto' : + this.layoutOptionsFormsManager.register(new amdaPlotComp.PlotLayoutAutoForm({id : formId})); + break; + case 'manual' : + this.layoutOptionsFormsManager.register(new amdaPlotComp.PlotLayoutManualForm({id : formId})); + break; + default : + this.layoutOptionsFormsManager.register(new Ext.form.Label({id : formId, text: 'No available options for this layout type'})); + } + } + + return this.layoutOptionsFormsManager.get(formId); + + }, + + updateLayoutOptions: function(forceUpdate) { + var typeField = this.getForm().findField('page-layout-type'); + var layoutType = typeField.getValue(); + this.object.setLayout(layoutType, forceUpdate); + + this.layoutOptionsContainer.removeAll(false); + + var layoutOptionsForm = this.getLayoutOptionsForm(layoutType); + this.layoutOptionsContainer.add(layoutOptionsForm); + layoutOptionsForm.crtTree = this.crtTree; + if (layoutOptionsForm.setObject) + layoutOptionsForm.setObject(this.object); + }, + + getFormItems: function() { + var me = this; + + this.layoutOptionsContainer = Ext.create('Ext.container.Container', { + layout: 'fit' + }); + + return [ + this.addStandardCombo('page-layout-type', 'Layout type', amdaPlotObj.PlotObjectConfig.availablePageLayouts, function(name, value, oldValue) { + me.updateLayoutOptions(value != oldValue); + me.crtTree.getView().refresh(); + }), + this.layoutOptionsContainer + ]; + } +}); \ No newline at end of file diff --git a/js/app/views/PlotComponents/PlotLayoutManualForm.js b/js/app/views/PlotComponents/PlotLayoutManualForm.js new file mode 100644 index 0000000..1b13880 --- /dev/null +++ b/js/app/views/PlotComponents/PlotLayoutManualForm.js @@ -0,0 +1,35 @@ +/** + * Project : AMDA-NG + * Name : PlotLayoutManualForm.js + * @class amdaPlotComp.PlotLayoutManualForm + * @extends amdaPlotComp.PlotStandardForm + * @brief Form to define specifics Manual layout options + * @author Benjamin Renard + * @version $Id: PlotLayoutManualForm.js benjamin $ + */ + +Ext.define('amdaPlotComp.PlotLayoutManualForm', { + extend: 'amdaPlotComp.PlotStandardForm', + + setObject : function(object) { + this.object = object.get('page-layout-object'); + this.loadRecord(this.object); + }, + + getFormItems: function() { + var timePlotMarginItems = [ + this.addStandardFloat('layout-timeplot-margin-left', 'Panels left margin', 0, 100, true), + this.addStandardFloat('layout-timeplot-margin-right', 'Panels right margin', 0, 100, true) + ]; + + var xyPlotMarginItems = [ + this.addStandardFloat('layout-xyplot-margin-left', 'Panels left margin', 0, 100, true), + this.addStandardFloat('layout-xyplot-margin-right', 'Panels right margin', 0, 100, true) + ]; + + return [ + this.addStandardFieldSet('Time / Epoch Panels Margins', '', timePlotMarginItems), + this.addStandardFieldSet('Scatter / Instant Panels Margins', '', xyPlotMarginItems) + ]; + } +}); \ No newline at end of file diff --git a/js/app/views/PlotComponents/PlotLayoutVerticalForm.js b/js/app/views/PlotComponents/PlotLayoutVerticalForm.js new file mode 100644 index 0000000..553180f --- /dev/null +++ b/js/app/views/PlotComponents/PlotLayoutVerticalForm.js @@ -0,0 +1,38 @@ +/** + * Project : AMDA-NG + * Name : PlotLayoutVerticalForm.js + * @class amdaPlotComp.PlotLayoutVerticalForm + * @extends amdaPlotComp.PlotStandardForm + * @brief Form to define specifics vertical layout options + * @author Benjamin Renard + * @version $Id: PlotLayoutVerticalForm.js benjamin $ + */ + +Ext.define('amdaPlotComp.PlotLayoutVerticalForm', { + extend: 'amdaPlotComp.PlotStandardForm', + + setObject : function(object) { + this.object = object.get('page-layout-object'); + this.loadRecord(this.object); + }, + + getFormItems: function() { + var timePlotDimItems = [ + //this.addStandardFloat('layout-timeplot-width', 'Panels width', 0, 1, true), + this.addStandardFloat('layout-timeplot-height', 'Panels height', 0, 1, true) + ]; + + var xyPlotDimItems = [ + this.addStandardFloat('layout-xyplot-width', 'Panels width', 0, 1, true), + this.addStandardFloat('layout-xyplot-height', 'Panels height', 0, 1, true) + ]; + + return [ + this.addStandardFloat('layout-panel-height', 'General Panels height', 0, 1), + this.addStandardFloat('layout-panel-spacing', 'Panels spacing', 0, 1), + this.addStandardCheck('layout-expand', 'Expand panels'), + this.addStandardFieldSet('Time / Epoch Panels Dimensions', '', timePlotDimItems), + this.addStandardFieldSet('Scatter / Instant Panels Dimensions', '', xyPlotDimItems) + ]; + } +}); \ No newline at end of file diff --git a/js/app/views/PlotComponents/PlotPageForm.js b/js/app/views/PlotComponents/PlotPageForm.js index 4f86b04..8faa724 100644 --- a/js/app/views/PlotComponents/PlotPageForm.js +++ b/js/app/views/PlotComponents/PlotPageForm.js @@ -25,10 +25,18 @@ Ext.define('amdaPlotComp.PlotPageForm', { this.addStandardFloat('page-margin-y', 'Vertical', 0, 100) ]; + var me = this; return [ //this.addStandardCombo('page-mode', 'Mode', amdaPlotObj.PlotObjectConfig.availablePageModes), - this.addStandardCombo('page-orientation', 'Orientation', amdaPlotObj.PlotObjectConfig.availablePageOrientations), - this.addStandardCombo('page-dimension', 'Dimension', amdaPlotObj.PlotObjectConfig.availablePageDimensions), + this.addStandardCombo('page-orientation', 'Orientation', amdaPlotObj.PlotObjectConfig.availablePageOrientations, function(name, value) { + me.crtTree.getView().refresh(); + }), + this.addStandardCombo('page-dimension', 'Dimension', amdaPlotObj.PlotObjectConfig.availablePageDimensions, function(name, value) { + me.crtTree.getView().refresh(); + }), + this.addStandardCheck('page-superpose-mode', 'Epoch Superposed Mode', function(name, value) { + me.crtTree.getView().refresh(); + }), this.addStandardFieldSet('Title', '', titleItems), this.addStandardFieldSet('Margins', 'page-margins-activated', marginItems), this.addStandardFont('page-font') diff --git a/js/app/views/PlotComponents/PlotPanelForm.js b/js/app/views/PlotComponents/PlotPanelForm.js index f9fdf06..30ef5a2 100644 --- a/js/app/views/PlotComponents/PlotPanelForm.js +++ b/js/app/views/PlotComponents/PlotPanelForm.js @@ -11,27 +11,90 @@ Ext.define('amdaPlotComp.PlotPanelForm', { extend: 'amdaPlotComp.PlotStandardForm', - updateStatusOptions: function(plotType) { + setObject : function(object) { + this.object = object; + this.loadRecord(this.object); + this.updateOptions(this.object.get('panel-plot-type')); + }, + + updateOptions: function(plotType) { var plotTypeField = this.getForm().findField('panel-plot-type'); + + //Scatter field set visibility + var isotropicField = this.getForm().findField('panel-scatter-isotropic'); + + isotropicField.setVisible(plotType == 'xyPlot'); + + //Status field set visibility var statusBarAvailable = ((plotType == 'timePlot') || (plotType == 'statusPlot')); var statusPositionField = this.getForm().findField('panel-status-position'); var statusFieldSet = statusPositionField.findParentByType('fieldset'); + statusFieldSet.setVisible(statusBarAvailable); + + //Tick field set visibility + var tickBarAvailable = ((plotType == 'timePlot') || (plotType == 'tickPlot')); + + var tickFormatField = this.getForm().findField('panel-tick-format'); + var tickFieldSet = tickFormatField.findParentByType('fieldset'); + + tickFieldSet.setVisible(tickBarAvailable); + + //Epoch center time id visibility + var centerTimeIdField = this.getForm().findField('panel-epoch-centertimeid'); + + centerTimeIdField.setVisible(plotType == 'epochPlot'); + + //Options in relation with the layout + this.updateLayoutOptions(plotType); + }, + + updateLayoutOptions: function(plotType) { + //Margins and Bounds visibility in relation with the layout type + var isManualLayout = this.crtTree.tabObject && (this.crtTree.tabObject.get('page-layout-type') == 'manual'); + var isVerticalLayout = this.crtTree.tabObject && (this.crtTree.tabObject.get('page-layout-type') == 'vertical'); + + var xBoundsField = this.getForm().findField('panel-bounds-x'); + var boundFieldSet = xBoundsField.findParentByType('fieldset'); + boundFieldSet.setVisible(isManualLayout); + + var marginLeftField = this.getForm().findField('panel-margin-left'); + var marginsFieldSet = marginLeftField.findParentByType('fieldset'); + marginsFieldSet.setVisible(isManualLayout); + + var preferedWidthField = this.getForm().findField('panel-prefered-width'); + var preferedDimFieldSet = preferedWidthField.findParentByType('fieldset'); + preferedDimFieldSet.setVisible(isVerticalLayout); + preferedWidthField.setVisible((plotType == 'xyPlot') || (plotType == 'instantPlot')); }, getFormItems: function() { - var titleItems = [ - this.addStandardText('panel-title-text', 'Text'), - this.addStandardColor('panel-title-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors), - this.addStandardCombo('panel-title-position', 'Position', amdaPlotObj.PlotObjectConfig.availableTitlePositions), - this.addStandardCombo('panel-title-alignment', 'Alignment', amdaPlotObj.PlotObjectConfig.availableTitleAlignments), - this.addStandardFont('panel-title-font') + + + var boundsItems = [ + this.addStandardFloat('panel-bounds-x', 'X Position', 0, 1), + this.addStandardFloat('panel-bounds-y', 'Y Position', 0, 1), + this.addStandardFloat('panel-bounds-width', 'Width', 0, 1), + this.addStandardFloat('panel-bounds-height', 'Height', 0, 1) ]; var marginItems = [ - this.addStandardFloat('panel-margin-x', 'Horizontal', 0, 100), - this.addStandardFloat('panel-margin-y', 'Vertical', 0, 100) + this.addStandardFloat('panel-margin-left', 'Left Margin', 0, 100, true), + this.addStandardFloat('panel-margin-right', 'Right Margin', 0, 100, true) + ]; + + var preferedDimItems = [ + this.addStandardFloat('panel-prefered-width', 'Prefered Width', 0, 1, true), + this.addStandardFloat('panel-prefered-height', 'Prefered Height', 0, 1, true) + ]; + + var titleItems = [ + this.addStandardText('panel-title-text', 'Text'), + this.addStandardColor('panel-title-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors), + this.addStandardCombo('panel-title-position', 'Position', amdaPlotObj.PlotObjectConfig.availableTitlePositions), + this.addStandardCombo('panel-title-alignment', 'Alignment', amdaPlotObj.PlotObjectConfig.availableTitleAlignments), + this.addStandardFont('panel-title-font') ]; var statusItems = [ @@ -43,20 +106,27 @@ Ext.define('amdaPlotComp.PlotPanelForm', { this.addStandardText('panel-tick-format', 'Format') ]; + + var me = this; return [ this.addStandardCombo('panel-plot-type', 'Plot type', amdaPlotObj.PlotObjectConfig.availablePlotTypes, function(name, value, oldValue) { if (value != oldValue) { me.object.updatePlotType(value, true); - if (me.crtTree.isSimplifiedView) - me.crtTree.buildPanelAxesNode(me.object); - me.updateStatusOptions(value); + if (!me.crtTree.isSimplifiedView) + me.crtTree.buildPanelAxesNode(me.object); + me.crtTree.getView().refresh(); + me.updateOptions(value); } }), + this.addStandardCheck('panel-scatter-isotropic', 'Isotropic'), + this.addStandardText('panel-epoch-centertimeid', 'Epoch Center Time Id'), this.addStandardColor('panel-background-color', 'Background Color', amdaPlotObj.PlotObjectConfig.availableBackgroundColors), + this.addStandardFieldSet('Manual Bounds', '', boundsItems), + this.addStandardFieldSet('Manual Margins', '', marginItems), + this.addStandardFieldSet('Prefered Dimensions', '', preferedDimItems), this.addStandardFieldSet('Title', '', titleItems), - this.addStandardFieldSet('Margins', '', marginItems), this.addStandardFont('panel-font'), this.addStandardFieldSet('Status Bars', '', statusItems), this.addStandardFieldSet('Ticks Bars', '', tickItems) diff --git a/js/app/views/PlotComponents/PlotParamForm.js b/js/app/views/PlotComponents/PlotParamForm.js index 4d23137..c708aa8 100644 --- a/js/app/views/PlotComponents/PlotParamForm.js +++ b/js/app/views/PlotComponents/PlotParamForm.js @@ -92,6 +92,7 @@ Ext.define('amdaPlotComp.PlotParamForm', { return [ this.addStandardCombo('param-drawing-type', 'Drawing type', [{'key' : '', 'value' : 'None'}], function(name, value, oldValue) { me.updateDrawingOptions(value != oldValue); + me.crtTree.getView().refresh(); }), this.drawingOptionsContainer ]; diff --git a/js/app/views/PlotComponents/PlotSerieForm.js b/js/app/views/PlotComponents/PlotSerieForm.js index e75ab44..55888b2 100644 --- a/js/app/views/PlotComponents/PlotSerieForm.js +++ b/js/app/views/PlotComponents/PlotSerieForm.js @@ -19,8 +19,10 @@ Ext.define('amdaPlotComp.PlotSerieForm', { updateOptions: function(plotType) { var xParamField = this.getForm().findField('serie-xaxis-param'); + var resamplingModeField = this.getForm().findField('serie-resampling-mode'); var isScatter = (plotType == 'xyPlot'); xParamField.setVisible(isScatter); + resamplingModeField.setVisible(isScatter); }, getFormItems: function() { @@ -38,6 +40,7 @@ Ext.define('amdaPlotComp.PlotSerieForm', { return [ this.addStandardParamDropTarget('serie-xaxis-param', 'X Parameter'), + this.addStandardCombo('serie-resampling-mode', 'Reference parameter for resampling', amdaPlotObj.PlotObjectConfig.availableResamplingModes), this.addStandardCombo('serie-yaxis', 'Y axis', amdaPlotObj.PlotObjectConfig.availableYAxes), this.addStandardParamDropTarget('serie-colored-param', 'Colored Parameter'), this.addStandardFieldSet('Lines', 'serie-lines-activated', linesItems), diff --git a/js/app/views/PlotComponents/PlotStandardForm.js b/js/app/views/PlotComponents/PlotStandardForm.js index 8a874c7..74df8b0 100644 --- a/js/app/views/PlotComponents/PlotStandardForm.js +++ b/js/app/views/PlotComponents/PlotStandardForm.js @@ -50,7 +50,9 @@ Ext.define('amdaPlotComp.PlotStandardForm', { }; }, - addStandardFloat: function(name, label, min, max) { + addStandardFloat: function(name, label, min, max, allowBlank) { + allowBlank = (typeof allowBlank !== 'undefined') ? allowBlank : false; + return { xtype: 'numberfield', name: name, @@ -58,6 +60,7 @@ Ext.define('amdaPlotComp.PlotStandardForm', { decimalPrecision : 3, minValue : min, maxValue : max, + allowBlank : allowBlank, listeners: { change: function(field, newValue, oldValue, eOpts) { this.object.set(name, newValue); @@ -93,7 +96,7 @@ Ext.define('amdaPlotComp.PlotStandardForm', { }; }, - addStandardCheck: function(name, label) { + addStandardCheck: function(name, label, onChange) { return { xtype: 'checkbox', name: name, @@ -101,6 +104,8 @@ Ext.define('amdaPlotComp.PlotStandardForm', { listeners: { change: function(combo, newValue, oldValue, eOpts) { this.object.set(name, newValue); + if (onChange != null) + onChange(name, newValue); }, scope: this } diff --git a/js/app/views/PlotComponents/PlotTree.js b/js/app/views/PlotComponents/PlotTree.js index 85ec3bf..1560398 100644 --- a/js/app/views/PlotComponents/PlotTree.js +++ b/js/app/views/PlotComponents/PlotTree.js @@ -49,7 +49,7 @@ Ext.define('amdaPlotComp.PlotTree', { var pageNode = this.store.getRootNode().appendChild(new amdaPlotObj.PlotPageTreeNode({object : tabObject})); //Layout node - pageNode.appendChild(new amdaPlotObj.PlotLayoutTreeNode()); + pageNode.appendChild(new amdaPlotObj.PlotLayoutTreeNode({object : tabObject})); //Panels node this.panelsNode = pageNode.appendChild(new amdaPlotObj.PlotPanelsTreeNode()); @@ -119,7 +119,9 @@ Ext.define('amdaPlotComp.PlotTree', { this.getView().refresh(); }, - buildPanelParamsNode: function(panelObject, selectedParamId = '') { + buildPanelParamsNode: function(panelObject, selectedParamId) { + selectedParamId = (typeof selectedParamId !== 'undefined') ? selectedParamId : ''; + var paramsNode = null; var me = this; -- libgit2 0.21.2