1 /** 2 * @author Gillis Haasnoot <gillis.haasnoot@gmail.com> 3 * @package Banana.Controls 4 * @summary Radiobutton 5 */ 6 7 goog.provide('Banana.Controls.DataControls.RadioButton'); 8 9 goog.require('Banana.Controls.DataControls.InputControl'); 10 11 /** @namespace Banana.Controls.RadioButton */ 12 namespace('Banana.Controls').RadioButton = Banana.Controls.InputControl.extend( 13 /** @lends Banana.Controls.RadioButton.prototype */ 14 { 15 /** 16 * Creates a radiobutton. 17 * @constructs 18 * @extends Banana.Controls.InputControl 19 */ 20 init : function() 21 { 22 this._super(); 23 this.setAttribute('type','radio'); 24 this.addCssClass('BRadioButton'); 25 }, 26 27 /** 28 * sets name on a radiobutton, multi radio buttons with same names behave like grouped radiobuttons 29 * 30 * @param {String} name of the group 31 * @return {this} 32 */ 33 setName : function(name) 34 { 35 this.setAttribute('name',name); 36 return this; 37 }, 38 39 /** 40 * @override 41 * 42 * @param {String} data 43 */ 44 setDomData : function(data) 45 { 46 if (this.isRendered) 47 { 48 Banana.Util.DomHelper.setCheckBoxData(data, this); 49 } 50 return this; 51 }, 52 53 /** 54 * @override 55 * @return {String} 56 */ 57 getDomData : function() 58 { 59 if (this.isRendered) 60 { 61 return Banana.Util.DomHelper.getCheckBoxData(this); 62 } 63 } 64 });