1 /**
  2  * @author Gillis Haasnoot <gillis.haasnoot@gmail.com>
  3  * @package Banana
  4  * @summary Page 
  5  */
  6 
  7 goog.provide('Banana.PageTemplate');
  8 
  9 goog.require('Banana.Page');
 10 
 11 /** @namespace Banana.ContentPlaceholder */
 12 namespace('Banana').PageTemplate  = Banana.Page.extend(
 13 /** @lends Banana.PageTemplate.prototype */
 14 {	
 15 	/**
 16 	 * Creates a page template.
 17 	 * A page template is no different from a page. 
 18 	 * By default banana pages are loaded inside a page template.
 19 	 * You might create your own page template with navigation buttons on top and a center
 20 	 * where your pages are getting inserted and maybe a footer with some info. 
 21 	 * @constructs
 22 	 * @extends Banana.Page
 23 	 */
 24 	init : function()
 25 	{
 26 		this._super();
 27 		this.addCssClass("BPageTemplate")
 28 		this.content = new Banana.Controls.Panel();
 29 	},
 30 	
 31 	/**
 32 	 * @override
 33 	 */
 34 	createComponents : function()
 35 	{
 36 		this.addControl(this.content);
 37 	},
 38 	
 39 	/**
 40 	 * Initiates the render process
 41 	 * Automatically called by the application
 42 	 */
 43 	run : function()
 44 	{	
 45 		if (!this.isRendered)
 46 		{
 47 			this._super();
 48 		}
 49 		else
 50 		{
 51 			this.triggerEvent('renderComplete',this);
 52 		}
 53 	
 54 		this.pageControl.setApplication(this.getApplication());
 55 		this.pageControl.run(this.content);
 56 	},
 57 
 58 	/**
 59 	 * Automatically called by the application
 60 	 * @param {Banana.Page} page
 61 	 */
 62 	addPageControl : function(page)
 63 	{
 64 		page.setContentPlaceHolder(this);
 65 		this.pageControl = page;		
 66 	}
 67 });