diff --git a/js/app/controllers/StatisticsModule.js b/js/app/controllers/StatisticsModule.js
index c6f55d5..3cc380e 100644
--- a/js/app/controllers/StatisticsModule.js
+++ b/js/app/controllers/StatisticsModule.js
@@ -39,7 +39,19 @@ Ext.define('amdaDesktop.StatisticsModule', {
this.setLinkedNode(amdaModel.StatisticsNode);
}
this.callParent(arguments);
- },
-
+ },
+
+ saveState: function() {
+ var uiContent = this.getUiContent();
+ var form = uiContent.down('form').getForm();
+ var values = form.getValues();
+ // Ext.state.Manager.set(this.id + '_form', values);
+ Ext.state.Manager.set('timeinterval', {'startDate' : values.startDate,'stopDate' : values.stopDate });
+ },
+
+ getState : function() {
+ // return Ext.state.Manager.get(this.id + '_form');
+ return Ext.state.Manager.get('timeinterval');
+ }
});
diff --git a/js/app/views/StatisticsUI.js b/js/app/views/StatisticsUI.js
index 4360295..64171e4 100644
--- a/js/app/views/StatisticsUI.js
+++ b/js/app/views/StatisticsUI.js
@@ -12,26 +12,77 @@ Ext.define('amdaUI.StatisticsUI', {
alias: 'widget.panelStatistics',
requires : [
-// 'amdaModel.Function'
- 'amdaUI.TimeSelectorUI'
+ // 'amdaModel.Function'
+ 'amdaUI.TimeSelectorUI',
+ 'amdaUI.ParamArgumentsPlug',
+ 'amdaModel.DownloadParam'
],
statics : {
-// functionStore : null
+ // functionStore : null
},
constructor: function(config) {
- this.init(config);
+ this.init(config);
this.callParent(arguments);
// if (this.object) this.loadObject();
+ //
+ var paramArgsPlug = this.getPlugin('statistics-param-arguments-plugin');
+ if (paramArgsPlug)
+ paramArgsPlug.onApply = this.onApplyParameterArgs;
},
+
+ onApplyParameterArgs : function(parentUI, paramObject) {
+ parentUI.paramGrid.getView().refresh();
+ },
- addParam : function(ParamName,isLeaf)
- {
- var r = Ext.create('amdaModel.AmdaObject', { name: ParamName });
- this.paramGrid.getStore().add(r);
- this.paramGrid.getSelectionModel().select(this.paramGrid.getStore().getCount()-1);
- },
+ addParam : function(paramId, isLeaf, needArgs, components)
+ {
+ // adding the parameter to the paramGrid
+ var paramObj = {
+ paramid: paramId,
+ type: 0,
+ 'dim1-is-range': false,
+ 'dim1-min-range': 0.,
+ 'dim1-max-range': 0.,
+ 'dim1-index': '*',
+ 'dim2-is-range': false,
+ 'dim2-min-range': 0.,
+ 'dim2-max-range': 0.,
+ 'dim2-index': '*',
+ template_args: {}
+ };
+
+// if (components) {
+// if (components['index1']) {
+// paramObj['dim1-index'] = components['index1'];
+// ++paramObj['type'];
+// }
+//
+// if (components['index2']) {
+// paramObj['dim2-index'] = components['index2'];
+// ++paramObj['type'];
+// }
+// }
+
+ var r = Ext.create('amdaModel.DownloadParam', paramObj);
+
+ this.paramGrid.getStore().add(r);
+ this.paramGrid.getSelectionModel().select(this.paramGrid.getStore().getCount()-1);
+ // var pos = this.paramGrid.store.getCount();
+ // this.paramGrid.store.insert(pos,r);
+ this.paramGrid.getView().refresh();
+
+ if (needArgs)
+ this.editParameterArgs(r);
+ },
+
+ editParameterArgs: function(record) {
+ var paramArgsPlug = this.getPlugin('statistics-param-arguments-plugin');
+
+ if (paramArgsPlug)
+ paramArgsPlug.show('statistics-param-arguments-plugin', record);
+ },
addTT : function(TTname,TTid)
{
@@ -51,48 +102,50 @@ Ext.define('amdaUI.StatisticsUI', {
updateObject : function(){
// get the basic form of the left
- var basicForm = this.formPanel.items.items[0].getForm();
- var updateStatus = true;
-
- var formValues = basicForm.getValues();
- // this.object.set('name',formValues.name);
- // this.object.set('description',formValues.description);
+ var basicForm = this.formPanel.items.items[0].getForm();
+ var updateStatus = true;
+
+ var formValues = basicForm.getValues();
+// this.object.set('name',formValues.name);
+// this.object.set('description',formValues.description);
- var recs = this.paramGrid.getStore().getNewRecords();
- var paramArr = new Array();
-
- Ext.Array.each(recs, function(rec, index,allItems)
- {
- var obj = new Object();
- obj.param = rec.get('name');
- obj.function = rec.get('function');
- if (obj.function == null) {
- myDesktopApp.warningMsg('Please select function : `click to select`');
- updateStatus = false;
- return;
- }
- paramArr.push(obj);
- });
+ var recs = this.paramGrid.getStore().getNewRecords();
+ var paramArr = new Array();
+
+ Ext.Array.each(recs, function(rec, index,allItems)
+ {
+ var obj = new Object();
+ obj.param = rec.get('name');
+ obj.function = rec.get('function');
+ if (obj.function == null)
+ {
+ myDesktopApp.warningMsg('Please select function : `click to select`');
+ updateStatus = false;
+ return;
+ }
+ paramArr.push(obj);
+ });
- this.object.set('parameter', paramArr);
+ this.object.set('parameter', paramArr);
- var timeSource = this.timeSelector.getActiveTimeSource();
+ var timeSource = this.timeSelector.getActiveTimeSource();
- if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable'
- && this.timeSelector.TTGrid.getStore().count() == 0) {
- myDesktopApp.warningMsg('You\'ve chosen Time Selection `by TimeTable` but no timeTable was added!'
- +'
You must add one or choose Time Selection `by Interval`');
- return false;
- }
+ if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable'
+ && this.timeSelector.TTGrid.getStore().count() == 0)
+ {
+ myDesktopApp.warningMsg('You\'ve chosen Time Selection `by TimeTable` but no timeTable was added!'
+ +'
You must add one or choose Time Selection `by Interval`');
+ return false;
+ }
- basicForm.updateRecord(this.object);
+ basicForm.updateRecord(this.object);
- this.object.set('timesrc', timeSource);
- // set valid intervals into TimeTable object
- if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0])
- this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items);
+ this.object.set('timesrc', timeSource);
+ // set valid intervals into TimeTable object
+ if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0])
+ this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items);
- return updateStatus;
+ return updateStatus;
},
/**
@@ -121,74 +174,80 @@ Ext.define('amdaUI.StatisticsUI', {
// ]
// });
- this.fieldName = new Ext.form.field.Text({
- fieldLabel: 'Catalog Name',
- allowBlank : false,
- stripCharsRe: /(^\s+|\s+$)/g,
- emptyText: 'Please no spaces!',
- name: 'name',
-// anchor: '100%',
- validateOnChange: false,
- validateOnBlur: false,
- validFlag: false,
- validator : function() {
- return this.validFlag;
- }
- });
-
- var ttStore = Ext.create('Ext.data.Store',
- {
- fields: [ 'name', 'hidden_id']
- });
+ this.fieldName = new Ext.form.field.Text({
+ fieldLabel: 'Catalog Name',
+ allowBlank : false,
+ stripCharsRe: /(^\s+|\s+$)/g,
+ emptyText: 'Please no spaces!',
+ name: 'name',
+ // anchor: '100%',
+ validateOnChange: false,
+ validateOnBlur: false,
+ validFlag: false,
+ validator : function() {
+ return this.validFlag;
+ }
+ });
- this.timeSelector = new amdaUI.TimeSelectorUI({id: 'statisticsTimeSelector', height : 160});
+ var ttStore = Ext.create('Ext.data.Store',
+ {
+ fields: [ 'name', 'hidden_id']
+ });
+
+ this.timeSelector = new amdaUI.TimeSelectorUI({id: 'statisticsTimeSelector', height : 160});
- var store = Ext.create('Ext.data.Store',
- {
- fields: ['name', 'function']
- });
+ var store = Ext.create('Ext.data.Store',
+ {
+ fields: ['name', 'function']
+ });
- this.paramGrid = Ext.create('Ext.grid.Panel', {
+ this.paramGrid = Ext.create('Ext.grid.Panel', {
title: 'Select Parameter & Apply Function',
selType : 'rowmodel',
// flex: 2,
height :250,
store : store,
columns: [
- { xtype: 'rownumberer' },
- { header: 'parameter', dataIndex: 'name', menuDisabled : true, sortable : false },
- { header: 'function', dataIndex: 'function', menuDisabled : true, sortable : false,
- editor: {
- xtype: 'combo', queryMode : 'local',
-// emptyText : 'please click to select function',
- store: [ 'min', 'max', 'mean' ],
- triggerAction: 'all',
-// lazyInit: false,
- listeners: {
- focus: function(obj) {
- obj.expand();
+ { xtype: 'rownumberer' },
+ {
+ header: "Parameter Name",
+ dataIndex: 'name',
+ flex:1,
+ sortable: false,
+ menuDisabled : true ,
+ renderer: function (val, meta, rec) {
+ return rec.getParamFullName();
+ }
+ },
+ // { header: 'parameter', dataIndex: 'name', menuDisabled : true, sortable : false },
+ { header: 'function', dataIndex: 'function', menuDisabled : true, sortable : false,
+ editor: {
+ xtype: 'combo', queryMode : 'local',
+ // emptyText : 'please click to select function',
+ store: [ 'min', 'max', 'mean' ],
+ triggerAction: 'all',
+ // lazyInit: false,
+ listeners: {
+ focus: function(obj) {
+ obj.expand();
+ }
+ }
+ },
+ renderer: function(v)
+ {
+ if(v != null && v.length > 0 )
+ return v;
+ else
+ return 'click to select';
+ }
+ },
+ { menuDisabled : true, width: 30, renderer: function(){
+ return '