1 // ========================================================================== 2 // Project: The M-Project - Mobile HTML5 Application Framework 3 // Copyright: (c) 2010 M-Way Solutions GmbH. All rights reserved. 4 // (c) 2011 panacoda GmbH. All rights reserved. 5 // Creator: Dominik 6 // Date: 01.12.2010 7 // License: Dual licensed under the MIT or GPL Version 2 licenses. 8 // http://github.com/mwaylabs/The-M-Project/blob/master/MIT-LICENSE 9 // http://github.com/mwaylabs/The-M-Project/blob/master/GPL-LICENSE 10 // ========================================================================== 11 12 /** 13 * @class 14 * 15 * A container view renders a simple div container that can be used to display 16 * any html valid content, e.g. by third party frameworks. 17 * 18 * @extends M.View 19 */ 20 M.ContainerView = M.View.extend( 21 /** @scope M.ContainerView.prototype */ { 22 23 /** 24 * The type of this object. 25 * 26 * @type String 27 */ 28 type: 'M.ContainerView', 29 30 /** 31 * Renders a simple div container and applies css classes if specified. 32 * 33 * @private 34 * @returns {String} The container view's html representation. 35 */ 36 render: function() { 37 this.html += '<div id="' + this.id + '"' + this.style() + '>'; 38 39 this.renderChildViews(); 40 41 this.html += '</div>'; 42 43 return this.html; 44 }, 45 46 /** 47 * Applies some style-attributes to the container view. 48 * 49 * @private 50 * @returns {String} The container's styling as html representation. 51 */ 52 style: function() { 53 var html = ''; 54 if(this.cssClass) { 55 html += ' class="' + this.cssClass + '"'; 56 } 57 return html; 58 } 59 60 });