Ext.ns('ES');

ES.SiteCharacteristicRightPanel = Ext.extend(Ext.Panel,{
  layout:'card',
  activeItem:'none',
  frame:false,
  height:810,
  deferredRender:true,
  title:'&nbsp',
  initComponent:function() {
// hard coded config - cannot be changed from outside
    var config = {
      items:[{
        id:'yeargrid',
        xtype:'ESsitecharacteristicyeargrid'
      },{
        id:'boolgrid',
        xtype:'ESsitecharacteristicboolgrid'
      },{
        id:'numbergrid',
        xtype:'ESsitecharacteristicnumbergrid'
      },{
        id:'solarheatinggrid',
        xtype:'ESsitecharacteristicsolarheatinggrid'
      }]
    };
    // apply config
    Ext.apply(this, Ext.apply(this.initialConfig, config));
    ES.SiteCharacteristicRightPanel.superclass.initComponent.apply(this, arguments);
    this.siteCharacteristicYearGrid = this.items.itemAt(0);
    this.siteCharacteristicBoolGrid = this.items.itemAt(1);
    this.siteCharacteristicNumberGrid = this.items.itemAt(2);
    this.siteCharacteristicSolarHeatingGrid = this.items.itemAt(3);
    this.doLayout();
  }
  ,onRender:function() {
    ES.SiteCharacteristicRightPanel.superclass.onRender.apply(this, arguments);
  } // eo function onRender
  ,init:function(type,tabletype,tabletypeid,tabletypeinfo,layout) {
    this.setTitle(type);
    this.layout.setActiveItem(layout);
    switch(layout) {
      case "yeargrid":
        this.siteCharacteristicYearGrid.init(type,tabletypeid,tabletypeinfo);
      break;
      case "boolgrid":
        this.siteCharacteristicBoolGrid.init(type,tabletypeid,tabletypeinfo);
      break;
      case "numbergrid":
        this.siteCharacteristicNumberGrid.init(type,tabletypeid,tabletypeinfo);
      break;
      case "solarheatinggrid":
        this.siteCharacteristicSolarHeatingGrid.init(type,tabletypeid,tabletypeinfo);
      break;
    }
  }
  ,demoModality: function() {
    this.siteCharacteristicYearGrid.demoModality();
    this.siteCharacteristicBoolGrid.demoModality();
    this.siteCharacteristicNumberGrid.demoModality();
    this.siteCharacteristicSolarHeatingGrid.demoModality();
   }
});

Ext.reg('ESsitecharacteristicrightpanel', ES.SiteCharacteristicRightPanel);
