/** * Project  : AMDA-NG * Name : PlotElementPanel.js * @class amdaPlotComp.PlotElementPanel * @extends Ext.form.Panel * @brief Element of a plot request definition * @author Benjamin Renard * @version $Id: PlotElementPanel.js benjamin $ */ Ext.define('amdaPlotComp.PlotElementPanel', { extend: 'Ext.form.Panel', requires: [ 'amdaPlotComp.PlotPageForm', 'amdaPlotComp.PlotPanelForm', 'amdaPlotComp.PlotBaseAxisForm', 'amdaPlotComp.PlotTimeAxisForm', 'amdaPlotComp.PlotEpochAxisForm', 'amdaPlotComp.PlotColorAxisForm', 'amdaPlotComp.PlotParamForm', 'amdaPlotComp.PlotLayoutForm' ], elementFormsManager : new Ext.AbstractManager(), crtTree : null, constructor: function(config) { this.init(config); this.callParent(arguments); }, setElement: function(type, object, tree) { this.removeAll(false); this.crtTree = tree; var elementForm = this.getElementForm(type); this.add(elementForm); elementForm.crtTree = tree; if (elementForm.setObject) elementForm.setObject(object); }, resetElement: function() { this.setElement('',null,null); }, getElementForm: function(type) { var formId = type; if (type == '') formId = 'none'; formId += '-element-form'; if (!this.elementFormsManager.get(formId)) { //Create element form switch (type) { case 'page' : this.elementFormsManager.register(new amdaPlotComp.PlotPageForm({id : formId})); break; case 'panel' : this.elementFormsManager.register(new amdaPlotComp.PlotPanelForm({id : formId})); break; case 'time-axis' : this.elementFormsManager.register(new amdaPlotComp.PlotTimeAxisForm({id : formId})); break; case 'epoch-axis' : this.elementFormsManager.register(new amdaPlotComp.PlotEpochAxisForm({id : formId})); break; case 'color-axis' : this.elementFormsManager.register(new amdaPlotComp.PlotColorAxisForm({id : formId})); break; case 'x-axis' : case 'y-left-axis' : case 'y-right-axis' : this.elementFormsManager.register(new amdaPlotComp.PlotBaseAxisForm({id : formId})); break; 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; default : this.elementFormsManager.register(new Ext.form.Label({id : formId, text: 'No available options for this element'})); } } return this.elementFormsManager.get(formId); }, init : function(config) { var me = this; var myConf = { title : 'Selected element options', bodyStyle: { background : '#dfe8f6' }, autoScroll: true, defaults: { border: false } }; Ext.apply (this , Ext.apply (arguments, myConf)); } });