zul.sel.Option=zk.$extends(zul.Widget,{_selected:!1,$define:{disabled:function(a){var b=this.$n();b&&(b.disabled=a?"disabled":"")},value:null},focus:function(a){var b=this.parent;b&&b.focus(a)},setVisible:function(a,b){this._visible!=a&&(this._visible=a,this.desktop&&this.parent.requestRerender_(b))},setSelected:function(a){if(this.__updating__)delete this.__updating__;else try{a=a||!1,this.__updating__=!0,this._selected!=a&&(this.parent&&this.parent.toggleItemSelection(this),this._setSelectedDirectly(a))}finally{delete this.__updating__}},
_setSelectedDirectly:function(a){var b=this.$n();b&&b.selected!=a&&(b.selected=a?"selected":"");this._selected=a},isSelected:function(){return this._selected},getLabel:function(){return this.firstChild?this.firstChild.getLabel():null},updateLabel_:function(){var a=this.$n();a&&jq(a).html(this.domLabel_())},getMaxlength:function(){return this.parent?this.parent.getMaxlength():0},bind_:function(){this.$supers("bind_",arguments);this.isSelected()&&(this.parent._selectedIndex=this._index)},getOptionIndex_:function(){var a=
this.parent,b=-1;if(a)for(w=a.firstChild;w&&(!w.$instanceof(zul.sel.Option)||(b++,w!=this));w=w.nextSibling);return b},domLabel_:function(){return zUtl.encodeXML(this.getLabel(),{maxlength:this.getMaxlength()})},domAttrs_:function(){var a=this.getValue();return this.$supers("domAttrs_",arguments)+(this.isDisabled()?' disabled="disabled"':"")+(this.isSelected()?' selected="selected"':"")+(a?' value="'+a+'"':"")},replaceWidget:function(a){this._syncItems(a);this.$supers("replaceWidget",arguments)},
_syncItems:function(a){if(this.parent&&this.isSelected()){var b=this.parent._selItems;b&&b.$remove(this)&&b.push(a)}}});
