Ext.ns('division');

division.mainPanel = Ext.extend(Ext.Panel,{
  layout:'table',
  layoutConfig:{columns:2},
  border:true,
  height:570,
  frame:false,
  initComponent:function() {
// hard coded config - cannot be changed from outside
    var config = {
      items:[{
        xtype:'divisionleftpanel',
        bodyStyle: 'padding:2px',
        height:565,
        width:280
      },{
        xtype:'divisioncenterpanel',
        bodyStyle: 'padding:2px',
        height:565,
        width:448
      }]
    };
    // apply config
    Ext.apply(this, Ext.apply(this.initialConfig, config));
    division.mainPanel.superclass.initComponent.apply(this, arguments);
    
  }
  ,onRender:function() {
    division.mainPanel.superclass.onRender.apply(this, arguments);
  } // eo function onRender
  ,initAfterFill:function() {
    this.leftPanel = this.items.itemAt(0);
    this.centerPanel = this.items.itemAt(1);
    this.counterGrid = this.leftPanel.items.itemAt(0);
  }
  ,readCounter:function(grid,rowIndex,e){
    var entriesMainpanel = new division.entriesMainPanel();
    this.centerPanel.add(entriesMainpanel);
    this.centerPanel.doLayout();
    this.centerPanel.layout.setActiveItem('divisionentriesmainpanel');
    var record = grid.getStore().getAt(rowIndex);
    var uid = record.get('uid');
    var type = record.get('type');
    entriesMainpanel.items.itemAt(0).init(type,uid);
    entriesMainpanel.items.itemAt(1).init(type,uid);
  }
});

Ext.reg('divisionmainpanel', division.mainPanel);
