/** * Project : AMDA-NG4 * Name : RemoteSumuParamNode.js * @class amdaModel.RemotSimuParamNode * @extends amdaModel.LocalParamNode * @brief * @author elena * @version $Id: RemoteSimuParamNode.js 2620 2014-11-05 09:00:34Z elena $ */ Ext.define('amdaModel.RemoteSimuParamNode', { extend: 'amdaModel.LocalParamNode', statics:{ nodeType: 'remoteSimuParam' }, requires: 'amdaUI.InteropImpexUI', fields: [ {name: 'isRemoteDataSet', type:'boolean', persist: false, defaultValue: true}, {name: 'isSimulation', type:'boolean', defaultValue: true}, {name: 'isAddable', type:'boolean', defaultValue: false}, {name: 'isDeletable', type:'boolean', defaultValue: false}, {name: 'rank', type: 'integer', persist: false, defaultValue: null} ], constructor : function(config) { this.callParent(arguments); if (this.get('isParameter')) this.set('needsArgs',this.get('needsArgs')); if (this.get('leaf') && this.get('isSpectra')) this.set('iconCls', 'icon-spectra'); if (this.get('disable')) { this.set('cls', 'icon-disabled'); this.set('allowDrag', false); } if (this.get('rank')) { var rank = this.get('rank'); if (rank == 1) this.set('iconCls', 'icon-mercury'); if (rank == 2) this.set('iconCls', 'icon-venus'); if (rank == 5) this.set('iconCls', 'icon-earth'); if (rank == 6) this.set('iconCls', 'icon-earth'); if (rank == 7) this.set('iconCls', 'icon-mars'); if (rank == 8) this.set('iconCls', 'icon-jupiter'); if (rank == 9) this.set('iconCls', 'icon-saturn'); if (rank == 93) this.set('iconCls', 'icon-comet'); if (rank == 3) this.set('iconCls', 'icon-sw'); if (rank == 4) this.set('iconCls', 'icon-sw'); if (rank >= 99) this.set('iconCls', 'icon-solarsystem'); } }, allMenuItems : function() { var menuItems = [ { fnId : 'root-collapseAll', text : 'Close All' }, { fnId : 'dire-collapseAll', text : 'Close All' }, { fnId : 'leaf-createAlias', text : 'Create/Edit Alias' }, { fnId : 'leaf-createDerivedParam', text : 'Create Derived Parameter' }, { 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() { if (this.get('isAddable')) return Ext.Array.push(this.allMenuItems(), { fnId : 'dire-addData', text : 'Add Run'}); else if (this.get('isDeletable')) return Ext.Array.push(this.allMenuItems(), { fnId : 'dire-deleteNode', text : 'Delete Run'}); return this.allMenuItems(); }, onMenuItemClick : function(menu, item, event) { if (item) { switch (item.fnId) { case 'root-collapseAll': case 'dire-collapseAll': if(this && !this.isLeaf()) { this.collapse(true); } break; case 'leaf-createDerivedParam': this.createLeaf(this); break; case 'leaf-createAlias': this.createAlias(this); break; case 'dire-deleteNode' : this.deleteData(); break; case 'dire-addData': case 'root-addData': this.addData(); break; case 'leaf-plotParam': case 'para-plotParam': this.createPlot(this); break; case 'leaf-downParam': case 'para-downParam': this.createDownload(this); break; default: break; } } }, deleteData : function() { var parent = this.parentNode; AmdaAction.deleteFromTree({nodeType: this.get('nodeType'), id : this.get('id')}, function(res,e){ //TODO if () not error ?? this.remove(); this.destroy(); },this); }, addData : function() { if (this.get('disable')) return; var win = myDesktopApp.desktop.getWindow('impex-win'); if(!win) { var win = myDesktopApp.desktop.createWindow( { border: false, id : 'impex-win', title : 'Find the most relevant run(s)', width : 600, height : 600, layout : 'border', //autoScroll: true, overflowY: 'scroll', maximizable : false, items : [{ xtype : 'interop_impex', region : 'center', margins : { top: 0, right: 5, bottom: 5, left: 5 } }], listeners: { scope : this, show : function( ) { win.items.getAt(0).setLinkedNode(this); } } }); } else { } win.show(); } });