/** * Project  : AMDA-NG * Name : PlotPanelForm.js * @class amdaPlotComp.PlotPanelForm * @extends amdaPlotComp.PlotStandardForm * @brief Form to define panel options * @author Benjamin Renard * @version $Id: PlotPanelForm.js benjamin $ */ Ext.define('amdaPlotComp.PlotPanelForm', { extend: 'amdaPlotComp.PlotStandardForm', idProperty: 'id', 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'); //Instant time visibility var instantTimeField = this.getForm().findField('panel-instant-time'); instantTimeField.setVisible(plotType == 'instantPlot'); var startDate = this.up().up().up().timeSelector.intervalSel.items.items[0].getValue(); var stopDate = this.up().up().up().timeSelector.intervalSel.items.items[1].getValue(); if(startDate <= stopDate ){ var interval = (stopDate-startDate)/2 instantTimeField.setValue(new Date(stopDate-interval)); } //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 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-left', 'Left Margin', 0, 100, true), this.addStandardFloat('panel-margin-right', 'Right Margin', 0, 100, true) ]; var preferedDimItems = [ this.addStandardFloat('panel-prefered-width', 'Preferred Width', 0, 1, true), this.addStandardFloat('panel-prefered-height', 'Preferred Height', 0, 1, true) ]; var titleItems = [ this.addStandardText('panel-title-text', 'Text'), this.addColorsPicker('panel-title-color', 'Color', amdaDefaultConfigs.availableColorsNew), this.addStandardCombo('panel-title-position', 'Position', amdaDefaultConfigs.availableTitlePositions), this.addStandardCombo('panel-title-alignment', 'Alignment', amdaDefaultConfigs.availableTitleAlignments), this.addStandardFont('panel-title-font') ]; var statusItems = [ this.addStandardCombo('panel-status-position', 'Position', amdaDefaultConfigs.availableStatusBarPositions), this.addStandardCombo('panel-status-colormap', 'Color Map', amdaDefaultConfigs.availableStatusBarColorMaps) ]; var tickItems = [ this.addStandardText('panel-tick-format', 'Format') ]; var me = this; return [ this.addStandardCombo('panel-plot-type', 'Plot type', amdaDefaultConfigs.availablePlotTypes, function(name, value, oldValue) { if (value != me.object.get('panel-plot-type')) { me.object.changePlotType(value); if (me.crtTree.tabObject.get('tree-full-view')) { me.crtTree.buildPanelAxesNode(me.object); me.crtTree.buildPanelAdditionalObjectsNode(me.object); } me.object.set('panel-plot-type', value); me.crtTree.refresh(); me.updateOptions(value); } }), this.addStandardCheck('panel-scatter-isotropic', 'Orthonormal scale', function(name, value, oldValue) { me.object.set('panel-scatter-isotropic', value); me.crtTree.refresh(); }, 'When this option is selected, X-axis and Y-axis appear with the same scale in the panel'), this.addStandardText('panel-epoch-centertimeid', 'Epoch Center Time Id', function(name, value, oldValue) { me.object.set('panel-epoch-centertimeid', value); me.crtTree.refresh(); }), this.addStandardDate('panel-instant-time', 'Instant time', function(name, value, oldValue) { me.object.set('panel-instant-time', value); me.crtTree.refresh(); }), this.addColorsPicker('panel-background-color', 'Background Color', amdaDefaultConfigs.availableColorsNew, 'none'), this.addColorsPicker('panel-plotareabackground-color', 'Plot Area Background Color', amdaDefaultConfigs.availableColorsNew, 'none'), this.addStandardFieldSet('Manual Bounds', '', boundsItems), this.addStandardFieldSet('Manual Margins', '', marginItems), this.addStandardFieldSet('Preferred Dimensions', '', preferedDimItems), this.addStandardFieldSet('Title', '', titleItems), this.addStandardFont('panel-font'), this.addStandardFieldSet('Status Bars', '', statusItems), this.addStandardFieldSet('Ticks Bars', '', tickItems) ]; } });