/** * 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} ], 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'); this.set('iconCls', this.icons[rank]); } }, allMenuItems : function() { var menuItems = [ { fnId : 'root-collapseAll', text : 'Close All' }, { fnId : 'miss-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')) { if (this.getNodeKind() == amdaUI.ExplorerUI.ITEM_KIND_MISS ) return Ext.Array.push(this.allMenuItems(), { fnId : 'miss-addData', text : 'Add Run'}); else if (this.getNodeKind() == amdaUI.ExplorerUI.ITEM_KIND_DIRE ) 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': case 'miss-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 'miss-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(); } });