zul.wgt.Radio=zk.$extends(zul.wgt.Checkbox,{_attachExternal:null,getRadiogroup:function(a){if(!a&&this._group)return this._group;for(a=a||this.parent;a;a=a.parent)if(a.$instanceof(zul.wgt.Radiogroup))return a;return null},setRadiogroup:function(a){var b=this._group;b!==a&&(b&&this._attachExternal&&b._rmExtern(this),(this._group=a)&&this.desktop&&(a._addExtern(this),this._attachExternal=!0),this._fixName())},bind_:function(){this.$supers(zul.wgt.Radio,"bind_",arguments);this._group&&this.desktop&&
!this._attachExternal&&(this._group._addExtern(this),this._attachExternal=!0)},unbind_:function(){this.$supers(zul.wgt.Radio,"unbind_",arguments);this._group&&this._attachExternal&&(this._group._rmExtern(this),this._attachExternal=!1)},setChecked:_zkf=function(a){if(a!=this._checked){this._checked=a;var b=this.$n("real");if(b&&(b.checked=a||!1,a?jq(b).attr("checked","checked"):jq(b).removeAttr("checked"),this.clearStateClassName_(),jq(this.$n()).addClass(this.getClassNameByState_()),b.checked||jq(b).removeAttr("checked"),
b=this.getRadiogroup())){if(a){a=b.getItems();for(var c=a.length;c--;)if(a[c]!=this){var d=a[c].$n("real");d&&(d.checked=!1,jq(d).removeAttr("checked"));a[c].clearStateClassName_();jq(a[c].$n()).addClass(this.$s(this.getMoldPrefix_()+"off"));a[c]._checked=!1}}b._fixSelectedIndex()}}return this},setSelected:_zkf,isSelected:function(){return this.isChecked()},getName:function(){var a=this.getRadiogroup();return null!=a?a.getName():this.uuid},_fixName:function(){var a=this.$n("real");a&&(a.name=this.getName())},
beforeParentChanged_:function(a){var b=this.getRadiogroup(),c=a?this.getRadiogroup(a):null;b==c&&a||(b&&b.$instanceof(zul.wgt.Radiogroup)&&(b._fixOnRemove(this),this._attachExternal&&(b._rmExtern(this),this._attachExternal=!1)),c&&c.$instanceof(zul.wgt.Radiogroup)&&(this._attachExternal||c!=this._group||(c._addExtern(this),this._attachExternal=!0),c._fixOnAdd(this)));this.$supers("beforeParentChanged_",arguments)},fireOnCheck_:function(a){var b=this.getRadiogroup();this.fire("onCheck",a,{toServer:b&&
b.isListen("onCheck")})}});
