iReport.views.ReportCard = Ext.extend(Ext.TabPanel, {
    scroll: false,
    cardSwitchAnimation: false,
    
    initComponent: function(){
      
      this.dockedItems = [{
        xtype: 'toolbar',
        title: this.record.data.title,
        items: [{
          ui: 'back',
          text: 'iReport',
          scope: this,
          handler: function(){
            this.ownerCt.setActiveItem(this.prevCard, {
              type: 'slide',
              reverse: true,
              scope: this,
              after: function(){
                this.destroy();
              }
            });
          }
        }]
      }];
      
      this.tabBar = {
        dock: 'top',
        ui: "light",
        layout: {
          pack: 'center'
        }
      }
      
      this.items = [
        {
          title: 'Summary',
          xtype: "summarypanel",
          reportId: this.record.data.reportId
        },
        {
          title: "The Wheel",
          xtype: "wheelpanel",
          matrix: "context",
          reportId: this.record.data.reportId
        },
        {
          title: "Pathways",
          xtype: "genematrixpanel",
          matrix: "pathways",
          reportId: this.record.data.reportId
        },
        {
          title: 'Processes',
          matrix: "processes",
          xtype: "genematrixpanel",
          reportId: this.record.data.reportId
        },
        {
          title: "Diseases",
          xtype: "genematrixpanel",
          matrix: "diseases",
          listTitle: "Diseases",
          reportId: this.record.data.reportId
        },
        {
          title: "Interactions",
          xtype: "genematrixpanel",
          matrix: "interactions",
          listTitle: "Genes",
          reportId: this.record.data.reportId
        },
        {
          title: 'Gene Table',
          xtype: "genetablepanel",
          matrix: "geneTable",
          scroll: "verticle",
          reportId: this.record.data.reportId
        }
      ]
      
      this.listeners = {
        activate: { fn: function(){
          //alert("here")
          
          
          
          
          initGenes(updateGeneList, genes, function(){
            initBioProcesses(updateProcessFunc, bioProcesses, function(){
              initDiseaseList(diseases, function(){
                initInteractionList(interactions,function(){
                  initPathways(updatePathwaysList, pathways, function(){

                    genes.calcMemberCount("bioProcesses");
                    genes.calcMemberCount("interactions");
                    genes.calcMemberCount("diseases");
                    genes.calcMemberCount("pathways");

                    genes.populateInteractions();            
                    genes.getNeighborCount();
                    genes.calcMembershipCounts();

                    // Required to get ActiveList populated (diseases)
                    diseases.buildGeneLists();

                    contextMgr    = new ContextManager();
                    selectionMgr   = new SelectionManager();

                    topicArrays["genes"] 		= genes;
                    topicArrays["bioProcesses"] = bioProcesses;
                    topicArrays["diseases"]  = diseases;        
                    topicArrays["interactions"] = interactions;


                    details = new DetailPanel("detailsDiv");
                    evidencePanel = new EvidencePanel("evidencePanelDiv");

                    // this is the object that we will keep
                    // the geneMatrix insances in.
                    // -brock
                    Charts = {}



                  });          
                });
              });
            });
          });
          
          
          
          
          
          
          
          
          
          
          
          
        }, scope: this }
      };
        
      iReport.views.ReportCard.superclass.initComponent.call(this);
    }
});

Ext.reg('reportcard', iReport.views.ReportCard);
