public function end()
 {
     $this->addInitMethodSource("\r\n\t\tsetTimeout(function(){\t\t\t\r\n\t\t\tExt.get('loading').remove();\r\n\t        Ext.get('loading-mask').fadeOut({remove:true});\r\n\t        \r\n\t        afApp.loadFirst(true);\r\n\t    }, 250);\r\n\t\t");
     parent::end();
 }
 public function end()
 {
     /**
      * default west panel items
      */
     if ($this->attributes['viewport']['west_panel'] != false && !isset($this->attributes['viewport']['west_panel']['items'])) {
         $this->addItem('west', array('title' => 'Navigation', 'autoScroll' => 'true', 'border' => 'false', 'iconCls' => 'nav', 'html' => 'test'));
         $this->addItem('west', array('title' => 'Settings', 'autoScroll' => 'true', 'border' => 'false', 'iconCls' => 'settings', 'html' => 'test2'));
     }
     if (isset($this->attributes['viewport']['north_panel']) && !isset($this->afExtjs->private['north_panel'])) {
         $this->addPanel('north', $this->attributes['viewport']['north_panel']);
     }
     if (isset($this->attributes['viewport']['west_panel']) && $this->attributes['viewport']['west_panel'] != false && !isset($this->afExtjs->private['west_panel'])) {
         $this->addPanel('west', $this->attributes['viewport']['west_panel']);
     }
     if (isset($this->attributes['viewport']['south_panel']) && !isset($this->afExtjs->private['south_panel'])) {
         $this->addPanel('south', $this->attributes['viewport']['south_panel']);
     }
     if (isset($this->attributes['viewport']['east_panel']) && !isset($this->afExtjs->private['east_panel'])) {
         $this->addPanel('east', $this->attributes['viewport']['east_panel']);
     }
     $viewportItems = array();
     if (isset($this->afExtjs->private['north_panel'])) {
         $viewportItems[] = $this->afExtjs->asVar('north_panel');
         $this->afExtjs->public['getNorth'] = "return north_panel;";
     } else {
         $this->afExtjs->public['getNorth'] = "return false;";
     }
     $this->afExtjs->public['getNorth'] = $this->afExtjs->asMethod($this->afExtjs->public['getNorth']);
     if (isset($this->afExtjs->private['west_panel'])) {
         $viewportItems[] = $this->afExtjs->asVar('west_panel');
     }
     /**
      * if users sends a url directly in browser, then the request is not ajax, so create an empty center_panel in which to load the contents of the given url
      */
     if (!$this->showFullCenter()) {
         $attributesPanelContainer['style'] = 'padding-right:5px;';
         $attributesPanelContainer['border'] = false;
         $attributesPanelContainer['bodyBorder'] = false;
         $attributesPanelContainer['layout'] = 'fit';
         $attributesPanelContainer['id'] = 'center_panel';
         $this->addPanel('center', $attributesPanelContainer);
     }
     if (isset($this->afExtjs->private['center_panel'])) {
         $viewportItems[] = $this->afExtjs->asVar('center_panel');
     }
     if (isset($this->afExtjs->private['south_panel'])) {
         $viewportItems[] = $this->afExtjs->asVar('south_panel');
     }
     if (isset($this->afExtjs->private['east_panel'])) {
         $viewportItems[] = $this->afExtjs->asVar('east_panel');
     }
     $this->afExtjs->private['viewport'] = $this->afExtjs->Viewport(array('id' => 'viewport', 'layout' => $this->layout, 'items' => $viewportItems));
     @($this->afExtjs->public['init'] .= "\r\n\t\tviewport.doLayout();");
     @($this->afExtjs->public['init'] .= "\r\n\t\tsetTimeout(function(){\t\t\t\r\n\t\t\tExt.get('loading').remove();\r\n\t        Ext.get('loading-mask').fadeOut({remove:true});\r\n\t        \t        \r\n\t    " . (!$this->showFullCenter() ? "afApp.loadFirst();" : "") . "        \r\n\t    }, 250);\r\n\t    ");
     $this->afExtjs->public['getViewport'] = "return viewport;";
     $this->afExtjs->public['getViewport'] = $this->afExtjs->asMethod($this->afExtjs->public['getViewport']);
     $this->afExtjs->public['getToolbar'] = "return toolbar;";
     $this->afExtjs->public['getToolbar'] = $this->afExtjs->asMethod($this->afExtjs->public['getToolbar']);
     parent::end();
 }