1 /** 2 * @author Gillis Haasnoot <gillis.haasnoot@gmail.com> 3 * @package Banana.Controls 4 * @summary Checkbox control 5 */ 6 7 goog.provide('Banana.Controls.DataControls.CheckBox'); 8 9 goog.require('Banana.Controls.DataControls.InputControl'); 10 11 /** @namespace Banana.Controls.CheckBox */ 12 namespace('Banana.Controls').CheckBox = Banana.Controls.InputControl.extend( 13 /** @lends Banana.Controls.CheckBox.prototype */ 14 { 15 /** 16 * Creates a Checkbox control 17 * @constructs 18 * @extends Banana.Controls.InputControl 19 */ 20 init : function() 21 { 22 this._super(); 23 this.setAttribute('type','checkbox'); 24 this.addCssClass('BCheckbox'); 25 this.setData(false); 26 27 this.bind('change',this.getProxy(this.onChange)); 28 }, 29 30 /** 31 * Used to apply the data to the dom 32 * @ingore 33 */ 34 setDomData : function(data) 35 { 36 if (this.isRendered) 37 { 38 Banana.Util.DomHelper.setCheckBoxData(data, this); 39 } 40 }, 41 42 /** 43 * @ignore 44 */ 45 getDomData : function() 46 { 47 if (this.isRendered) 48 { 49 return Banana.Util.DomHelper.getCheckBoxData(this); 50 } 51 } 52 });