AstroImagesModule.js 2.49 KB
/**
  * Project      :  AMDA-NG
  * Name         : AstroImagesModule.js
  * @plugin 	  amdaDesktop.AstroImagesModule.js
  * @extends 	  amdaDesktop.AmdaModule
  * @brief		 AstroImages controller
  * @author Benjamin
  * @version $Id: AstroImagesModule.js 1664 2013-07-03 11:37:37Z benjamin $
  ********************************************************************************
  *    FT Id     :   Date   : Name - Description
  *******************************************************************************
  *  :          
  */

Ext.define('amdaDesktop.AstroImagesModule', {
		
    extend: 'amdaDesktop.AmdaModule',
    
    requires : [
      'amdaUI.HstUI',
      'amdaUI.APISImagesUI'
    ],
    
	contentId : 'astroimagesUI',
    
	createWindow : function(startDate,stopDate){
	    var desktop = this.app.getDesktop();
	    var win = desktop.getWindow(this.id);
	    
	    if(!win){
	        win = desktop.createWindow({		  
	            id: this.id,
	            title:this.title, 
		        layout: 'fit',
		        width:650,
	            height:600,
		    minHeight: 600,  
	            modal: true,
	            iconCls: this.icon,
	            animCollapse:false,
	            constrainHeader:true,
	            bodyPadding : 5,
                stateful : true,
                stateId  : this.id,
                stateEvents: ['move','show','resize'],
	            items : [
	              {
	            	  xtype : 'tabpanel',
	            	  id    : 'astrotabs',
	            	  items : [
	            	           {
	            	        	   title: 'APIS Archive',
	            	        	   xtype: 'panelAPIS',
	            	        	   id   : 'apisPanel'
	            	           },
	            	           {
	            	        	   title: 'MAST Archive',
	            	        	   xtype: 'panelHst',
	            	        	   id   : 'hstPanel'
	            	           }
	            	          ]
	              }
	            ]
	        });
	    } 
	    
	    var hstPanel = win.queryById('hstPanel');
		var apisPanel = win.queryById('apisPanel');

		
		hstPanel.setInterval(startDate,stopDate);
		apisPanel.setInterval(startDate,stopDate);
	    
	    win.on({
        	show : 
        	{
        		fn : function(o)
        		{
			win.doLayout();
	    			var astrotabsUI = win.queryById('astrotabs');
	    	        astrotabsUI.setActiveTab(apisPanel);
	    	        hstPanel.forceRefresh();
	    			apisPanel.forceRefresh();
        		},
        		scope : this
        	}
        });
	    
	    win.show();
	    return win;
	}
});