(function(){u8.Base.FormRadioGroup=function(t){$.extend(this,u8.Base.FormRadioGroup.defaults,t);this.bind(t);this._form=u8.Base.Widgets.Form.getForm(this);$assert(this._form,"A FormRadioGroup must be created inside a form.");if(!this.id){this.id=u8.Base.Dom.uniqueId()+"FormRadioGroup"}this._radioButtons=[];this._create()};u8.Base.FormRadioGroup.makeClass({name:"FormRadioGroup",events:["ValueChange"]});u8.Base.FormRadioGroup.defaults={};$.extend(u8.Base.FormRadioGroup.prototype,{getValue:function(){var t=this._radioButtons&&this._radioButtons[0];return t?t.getGroupValue():null},setValue:function(t){var i=this._radioButtons&&this._radioButtons[0];if(i){i.setGroupValue(t)}this.raise("ValueChange",{value:t})},setDisabled:function(t){var i=this._radioButtons;for(var e=0;e<i.length;e++){i[e].setDisabled(t)}},setChecked:function(t){var i=this._radioButtons;for(var e=0;e<i.length;e++){i[e].setChecked(t)}},dispose:function(){if(this._isDisposed){return}this.unbind();if(this.radioValues){this.radioValues.unbind("PropertyChange");this.radioValues=null}if(this._form){this._form.unbind("WidgetCreate",this.id);this._form=null}this._isDisposed=true},attr:function(t){if(t.groupName){this.groupName=t.groupName;this._form.$(this._form.element).attr("data-group",this.groupName)}},_create:function(){this._form.bind("WidgetCreate",this._onFormWidgetCreate.bind(this),this.id);this._form.$(this._form.element).attr("data-group",this.groupName)},_onFormWidgetCreate:function(t,i){if(i.widget.groupName==this.groupName&&u8.tools.isInstanceOfClass(i.widget,"RadioButton")){i.widget.bind("CheckedChange",this._onRadioButtonCheckedChange.bind(this));this._radioButtons.push(i.widget)}},_onRadioButtonCheckedChange:function(t){if(t.groupName==this.groupName){if(!this._radioButtons.contains(t)){this._radioButtons.push(t)}if(t.getChecked()){this.raise("ValueChange",{value:t.getGroupValue()})}}}})})();