diff --git a/js/app/models/InteractiveNode.js b/js/app/models/InteractiveNode.js
index ff3f0fe..33084e7 100644
--- a/js/app/models/InteractiveNode.js
+++ b/js/app/models/InteractiveNode.js
@@ -200,22 +200,11 @@ Ext.define('amdaModel.InteractiveNode', {
if (res.info) {
this.set('info',res.info);
- }
-
- if (this.get('nodeType') == 'myDataParam') {
- if (res.isSpectra) {
- this.set('iconCls', 'icon-spectra');
- }
- else {
- if (res.size > 1) this.set('iconCls', 'icon-unknowntype');
- }
}
- // update my data on possibble mask change
- if (res.updateMyData) {
- this.updateMyData();
- this.updateMask(res.mask);
- }
+ // myDataParam special update
+ this.specialUpdate(res, false);
+
// reload object into the view of corresponding Module
var me = this;
myDesktopApp.getLoadedModule(this.get('moduleId'), true, function (module) {
@@ -282,30 +271,10 @@ Ext.define('amdaModel.InteractiveNode', {
if (res.info){
// set the tooltip
this.set('info',res.info);
- //set globalStart & global Stop to be used for time selection
- if (this.get('nodeType') == 'myDataParam')
- {
- var startStop = res.info.split("
");
- var globalStart = startStop[1].substr(0,19);
- var globalStop = startStop[1].substr(20);
-
- this.set('globalStart', globalStart);
- this.set('globalStop', globalStop);
-
- if (res.mask)
- this.set('linkedMask', res.mask);
- if (res.size)
- this.set('size', res.size);
-
- if (res.isSpectra) {
- this.set('iconCls', 'icon-spectra');
- }
- else {
- if (res.size > 1)
- this.set('iconCls', 'icon-unknowntype');
- }
- }
- }
+ }
+ //set globalStart & global Stop to be used for time selection
+ this.specialUpdate(res, true);
+
//TODO do we need this commission ???
// fix the modifications for object
this.get('object').commit();
@@ -333,14 +302,6 @@ Ext.define('amdaModel.InteractiveNode', {
opt.callback.call(scope,'create');
}
}, this);
-
- // myDataParamNode - update MyData subtree
- //TODO put this in mydataparamnode
- if (res.updateMyData) {
- this.updateMyData();
- this.updateMask(res.mask);
- }
-
}
// error code from server; but e.status==true
else {
@@ -359,6 +320,7 @@ Ext.define('amdaModel.InteractiveNode', {
},this);
},
+ specialUpdate : function() {},
/**
* Generic part of Context Menu
*
diff --git a/js/app/models/MyDataParamNode.js b/js/app/models/MyDataParamNode.js
index f2a4ce1..e9a05a1 100644
--- a/js/app/models/MyDataParamNode.js
+++ b/js/app/models/MyDataParamNode.js
@@ -27,225 +27,262 @@ Ext.define('amdaModel.MyDataParamNode', {
objectName : 'Parameter'
},
- constructor : function(config)
- {
- this.callParent(arguments);
- this.set('moduleId',myDesktopApp.dynamicModules.my_data.id);
- this.set('objectDataModel','amdaModel.FileParamObject');
- if (this.get('isParameter')) {
- if (this.get('size') == 1) this.set('iconCls', 'icon-scalar');
- else this.set('iconCls', 'icon-unknowntype');
- }
- //TODO this.set('iconCls', 'icon-vector');
- if (this.get('isSpectra')) this.set('iconCls', 'icon-spectra');
- },
-
- localMenuItems : function()
- {
- var menuItems =
- [{
- fnId : 'root-upload',
- text : 'Upload File',
- hidden : true
- }, {
- fnId : 'dire-upload',
- text : 'Upload File',
- hidden : true
- }, {
- fnId : 'leaf-upload',
- text : 'Upload File',
- hidden : true
- },{
- fnId : 'leaf-plotParam',
- text : 'Plot Parameter',
- hidden : true
- }, {
- fnId : 'leaf-downParam',
- text : 'Download Parameter',
- hidden : true
- }, {
- fnId : 'para-plotParam',
- text : 'Plot Parameter',
- hidden : true
- }, {
- fnId : 'para-downParam',
- text : 'Download Parameter',
- hidden : true
- }];
- return menuItems;
- },
-
- getAllContextMenuItems: function()
- {
- var menuItems = this.allMenuItems('Parameter');
- var locMenuItems = this.localMenuItems();
+ constructor : function(config)
+ {
+ this.callParent(arguments);
+ this.set('moduleId',myDesktopApp.dynamicModules.my_data.id);
+ this.set('objectDataModel','amdaModel.FileParamObject');
+ if (this.get('isParameter')) {
+ if (this.get('size') == 1)
+ this.set('iconCls', 'icon-scalar');
+ else if(this.get('size') == 3)
+ this.set('iconCls', 'icon-vector');
+ else
+ this.set('iconCls', 'icon-unknowntype');
+ }
- return Ext.Array.merge(menuItems,locMenuItems);
- },
+ if (this.get('isSpectra')) this.set('iconCls', 'icon-spectra');
+ },
+
+ localMenuItems : function()
+ {
+ var menuItems =
+ [{
+ fnId : 'root-upload',
+ text : 'Upload File',
+ hidden : true
+ }, {
+ fnId : 'dire-upload',
+ text : 'Upload File',
+ hidden : true
+ }, {
+ fnId : 'leaf-upload',
+ text : 'Upload File',
+ hidden : true
+ },{
+ fnId : 'leaf-plotParam',
+ text : 'Plot Parameter',
+ hidden : true
+ }, {
+ fnId : 'leaf-downParam',
+ text : 'Download Parameter',
+ hidden : true
+ }, {
+ fnId : 'para-plotParam',
+ text : 'Plot Parameter',
+ hidden : true
+ }, {
+ fnId : 'para-downParam',
+ text : 'Download Parameter',
+ hidden : true
+ }];
+ return menuItems;
+ },
- onMenuItemClick : function(menu,item,event)
- {
- var fnId = Ext.util.Format.substr(item.fnId, 5, item.fnId.length);
+ getAllContextMenuItems: function()
+ {
+ var menuItems = this.allMenuItems('Parameter');
+ var locMenuItems = this.localMenuItems();
- switch (fnId) {
+ return Ext.Array.merge(menuItems,locMenuItems);
+ },
- case 'deleteNode':
- this.deleteNode();
- break;
+ onMenuItemClick : function(menu,item,event)
+ {
+ var fnId = Ext.util.Format.substr(item.fnId, 5, item.fnId.length);
- case 'createDir':
- this.createDir();
- break;
+ switch (fnId)
+ {
+ case 'deleteNode':
+ this.deleteNode();
+ break;
- case 'createLeaf':
- this.createLeaf(this);
- break;
+ case 'createDir':
+ this.createDir();
+ break;
- case 'renameNode':
- this.renameNode();
- break;
+ case 'createLeaf':
+ this.createLeaf(this);
+ break;
- case 'editLeaf':
- this.editLeaf();
- break;
+ case 'renameNode':
+ this.renameNode();
+ break;
- case 'upload':
- this.uploadFile();
- break;
-
- case 'plotParam':
- this.createPlot(this);
- break;
-
- case 'downParam':
- this.createDownload(this);
- break;
-
- default:
- break;
- } // switch end
+ case 'editLeaf':
+ this.editLeaf();
+ break;
- },
+ case 'upload':
+ this.uploadFile();
+ break;
+
+ case 'plotParam':
+ this.createPlot(this);
+ break;
+
+ case 'downParam':
+ this.createDownload(this);
+ break;
+
+ default:
+ break;
+ } // switch end
+ },
- uploadFile: function() {
- myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.upload.id, true, function (module) {
- module.createWindow();
- });
- },
+ uploadFile: function() {
+ myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.upload.id, true, function (module) {
+ module.createWindow();
+ });
+ },
- editLeaf: function() {
- // load the rootNode and recursively all its child nodes
- // to know all names of DerivedParameters
- var me = this;
- amdaModel.InteractiveNode.preloadNodes(this.getRootNode(),
- function()
- {
- if (me.get('object'))
- {
- if (me.get('fileObject'))
- // launch edition of parameter into parameter module
- me.editInModule();
- else
- AmdaAction.getObject(me.get('object').get('file'), amdaModel.MyDataNode.nodeType, me.getFileObjectCallback, me);
- }
- else
- {
- // call the ext method to get the details of parameter
- // the edition of real parameter is done into callback method getObjectCallback
- AmdaAction.getObject(me.get('id'), me.get('nodeType'), me.getObjectCallback, me);
- }
- });
- },
+ editLeaf: function()
+ {
+ // load the rootNode and recursively all its child nodes
+ // to know all names of DerivedParameters
+ var me = this;
+ amdaModel.InteractiveNode.preloadNodes(this.getRootNode(),
+ function()
+ {
+ if (me.get('object'))
+ {
+ if (me.get('fileObject'))
+ // launch edition of parameter into parameter module
+ me.editInModule();
+ else
+ AmdaAction.getObject(me.get('object').get('file'), amdaModel.MyDataNode.nodeType, me.getFileObjectCallback, me);
+ }
+ else
+ {
+ // call the ext method to get the details of parameter
+ // the edition of real parameter is done into callback method getObjectCallback
+ AmdaAction.getObject(me.get('id'), me.get('nodeType'), me.getObjectCallback, me);
+ }
+ });
+ },
- // special case file object should be also loaded
- getObjectCallback : function(result,remoteEvent){//result, e) {
- var t = remoteEvent.getTransaction();
- if (result) {
- if (result.id) {
- var paramObj = Ext.create(this.get('objectDataModel'), result);
- // set parameter into node
- this.set('object',paramObj);
-
- paramObj.set('tableDef', result['tableDef']);
-
- if (paramObj.get('mask')) var file = paramObj.get('mask');
- else var file = paramObj.get('file');
-
- AmdaAction.getObject(file, amdaModel.MyDataNode.nodeType,
- this.getFileObjectCallback, this);
- }
- else {
- myDesktopApp.errorMsg(result.error);
- }
- }
- else {
- // EXCEPTION : parameter not found !?
- myDesktopApp.errorMsg(t.action + "." + t.method + " : No parameter '"
- +this.get('name')+"' found!");
- //TODO: adding an error log
- }
- },
+ // special case file object should be also loaded
+ getObjectCallback : function(result,remoteEvent){//result, e) {
+ var t = remoteEvent.getTransaction();
+ if (result) {
+ if (result.id) {
+ var paramObj = Ext.create(this.get('objectDataModel'), result);
+ // set parameter into node
+ this.set('object',paramObj);
+
+ paramObj.set('tableDef', result['tableDef']);
+
+ if (paramObj.get('mask')) var file = paramObj.get('mask');
+ else var file = paramObj.get('file');
+
+ AmdaAction.getObject(file, amdaModel.MyDataNode.nodeType,
+ this.getFileObjectCallback, this);
+ }
+ else {
+ myDesktopApp.errorMsg(result.error);
+ }
+ }
+ else {
+ // EXCEPTION : parameter not found !?
+ myDesktopApp.errorMsg(t.action + "." + t.method + " : No parameter '"
+ +this.get('name')+"' found!");
+ //TODO: adding an error log
+ }
+ },
- getFileObjectCallback : function(result,remoteEvent){//result, e) {
- var t = remoteEvent.getTransaction();
- if (result) {
- if (result.success) {
- var paramObj = Ext.create('amdaModel.FileObject', result);
- this.set('fileObject', paramObj);
- // Edition of parameter into parameter Module
- this.editInModule();
- }
- else {
- myDesktopApp.errorMsg(result.error);
- }
- }
- else {
- // EXCEPTION : parameter not found !?
- myDesktopApp.errorMsg(t.action + "." + t.method + " : No parameter '"
- +this.get('name')+"' found!");
- }
- },
+ getFileObjectCallback : function(result,remoteEvent){//result, e) {
+ var t = remoteEvent.getTransaction();
+ if (result) {
+ if (result.success) {
+ var paramObj = Ext.create('amdaModel.FileObject', result);
+ this.set('fileObject', paramObj);
+ // Edition of parameter into parameter Module
+ this.editInModule();
+ }
+ else {
+ myDesktopApp.errorMsg(result.error);
+ }
+ }
+ else {
+ // EXCEPTION : parameter not found !?
+ myDesktopApp.errorMsg(t.action + "." + t.method + " : No parameter '"
+ +this.get('name')+"' found!");
+ }
+ },
- /*
- * Mask was possibly changed update this info
- */
- updateMask : function(mask)
- {
- var myParamRootNode = this.getRootNode();
- if (myParamRootNode.isExpanded) {
- Ext.Array.each(myParamRootNode.childNodes, function(node) {
- if (node.get('linkedMask') && node.get('linkedMask').indexOf(mask) != -1 ) {
- node.set('linkedMask',mask);
- if (node.get('info')) {
- var info = node.get('info').split("
");
- node.set('info',info[0] + "
" + info[1] + "
Mask: " + mask);
- }
- }
-
- });
- }
-
- },
+ /*
+ * Mask was possibly changed update this info
+ */
+ updateMask : function(mask)
+ {
+ var myParamRootNode = this.getRootNode();
+ if (myParamRootNode.isExpanded) {
+ Ext.Array.each(myParamRootNode.childNodes, function(node) {
+ if (node.get('linkedMask') && node.get('linkedMask').indexOf(mask) != -1 ) {
+ node.set('linkedMask',mask);
+ if (node.get('info')) {
+ var info = node.get('info').split("
");
+ node.set('info',info[0] + "
" + info[1] + "
Mask: " + mask);
+ }
+ }
+
+ });
+ }
+ },
- updateMyData : function(){
- // reload myFiles Tree in explorer
- var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
- if (explorerTree) {
- var explorerTreeStore = explorerTree.getStore();
- var explorerRoot = explorerTreeStore.getRootNode().findChild('text','My Files');
-
- var explorerPath = '/root/myData-treeRootNode/';
-
- explorerTreeStore.reload({node : explorerRoot,
- params : { nodeType: 'myData'},
- callback : function(){
- explorerTree.selectPath(explorerPath);
- }
- });
- }
- },
+ updateMyData : function(){
+ // reload myFiles Tree in explorer
+ var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
+ if (explorerTree) {
+ var explorerTreeStore = explorerTree.getStore();
+ var explorerRoot = explorerTreeStore.getRootNode().findChild('text','My Files');
+
+ var explorerPath = '/root/myData-treeRootNode/';
+
+ explorerTreeStore.reload({node : explorerRoot,
+ params : { nodeType: 'myData'},
+ callback : function(){
+ explorerTree.selectPath(explorerPath);
+ }
+ });
+ }
+ },
- isParameter : function(){
- return this.get('isParameter');
- }
+ isParameter : function(){
+ return this.get('isParameter');
+ },
+
+ specialUpdate : function(res, timeUpdate)
+ {
+ if (timeUpdate && res.info)
+ {
+ var startStop = res.info.split("
");
+ var globalStart = startStop[1].substr(0,19);
+ var globalStop = startStop[1].substr(20);
+
+ this.set('globalStart', globalStart);
+ this.set('globalStop', globalStop);
+
+ if (res.mask)
+ this.set('linkedMask', res.mask);
+ if (res.size)
+ this.set('size', res.size);
+ }
+
+ if (res.isSpectra) {
+ this.set('iconCls', 'icon-spectra');
+ }
+ else if (res.size == 3) {
+ this.set('iconCls', 'icon-vector');
+ }
+ else if (res.size > 1) {
+ this.set('iconCls', 'icon-unknowntype');
+ }
+
+ // update my data on possible mask change
+ if (res.updateMyData) {
+ this.updateMyData();
+ this.updateMask(res.mask);
+ }
+ }
});
--
libgit2 0.21.2