AdfRichUIPeer.createPeerClass(AdfDhtmlSelectOneListbasePeer,"AdfDhtmlSelectOneChoicePeer");
AdfDhtmlSelectOneChoicePeer.InitSubclass=function(){AdfRichUIPeer.addComponentPropertyGetters(this,AdfUIEditableValue.SUBMITTED_VALUE,AdfUISelectOne.SELECT_ITEMS,AdfRichSelectOneChoice.LABEL);AdfRichUIPeer.addComponentPropertyChanges(this,AdfRichSelectOneChoice.LABEL,AdfRichSelectOneChoice.DISABLED);AdfRichUIPeer.addComponentEventHandlers(this,AdfUIInputEvent.CLICK_EVENT_TYPE,AdfUIInputEvent.MOUSE_DOWN_EVENT_TYPE,AdfUIInputEvent.KEY_DOWN_EVENT_TYPE,AdfUIInputEvent.KEY_PRESS_EVENT_TYPE);AdfAgent.AGENT.getCapabilities()[AdfAgent.CAP_TOUCH_SCREEN]==
AdfAgent.CAP_TOUCH_SCREEN_NONE&&AdfRichUIPeer.addComponentEventHandlers(this,AdfUIInputEvent.MOUSE_IN_EVENT_TYPE,AdfUIInputEvent.MOUSE_OUT_EVENT_TYPE);this._TEXT_ID="content";this._COMPACT="compact";this._DROPDOWN_ID="drop";this._POPUP_ID="pop";this._POPUP_WRAPPER_ID="popWrap";this._SPACER_ID="sp";this._POPUP_PANEL_ID="_afrSelectOnePopupPanel";this._HIGHLIGHTED_STYLE_CLASS="p_AFHighlighted";this._TEMP_OPTION_KEY="_adfTmpOpt"};AdfDhtmlSelectOneChoicePeer.prototype.needsFocusTargetStyleClass=function(){return!0};
AdfDhtmlSelectOneChoicePeer.prototype.LazyInitialize=function(a,b){AdfDhtmlSelectOneChoicePeer.superclass.LazyInitialize.call(this,a,b);var d=AdfDhtmlEditableValuePeer.getContentNode(a,b);if(d&&!this._isCompact(a)&&(AdfRichUIPeer.addEventHandlerToDomInstance(AdfDhtmlSelectOneChoicePeer,d,AdfDhtmlLookAndFeel.CHANGE_EVENT_TYPE),d=d.options)){var e=d.length;for(i=0;i<e;i++)if(null==d[i].title||""==d[i].title)d[i].title=d[i].text}};
AdfDhtmlSelectOneChoicePeer.prototype.HandleComponentFocus=function(a){AdfDhtmlSelectOneChoicePeer.superclass.HandleComponentFocus.call(this,a);a=AdfAgent.AGENT;if(a.getPlatform()==AdfAgent.IE_PLATFORM){var b=this.getComponent(),d=this.getDomElement();if(b=AdfDhtmlEditableValuePeer.getContentNode(b,d))"true"!=b.getAttribute("data-afr-init")?(b==AdfPage.PAGE.getActiveDomElement()&&((9==a.getVersion()||10==a.getVersion())&&b.blur(),AdfFocusUtils.focusElementDelayed(b,1)),b.setAttribute("data-afr-init",
!0)):b.removeAttribute("data-afr-init")}};
AdfDhtmlSelectOneChoicePeer.prototype.HandleComponentMouseDown=function(a){if(a.getEventPhase()==AdfBaseEvent.AT_TARGET_PHASE){var b=a.getSource();if(this._isCompact(b)&&!b.getDisabled()){a=a.getNativeEvent();a=AdfAgent.AGENT.getEventTarget(a);var d=AdfRichUIPeer.getDomElementForComponent(b);if(d==a||AdfDomUtils.isAncestor(d,a))this.isPopupVisible(b,AdfDhtmlSelectOneChoicePeer._POPUP_PANEL_ID)?this.hidePopup(b,AdfDhtmlSelectOneChoicePeer._POPUP_PANEL_ID):this._showPopupPanel(b),this._mouseDownCalled=
!0;AdfFocusUtils.focusElement(this._getFocusElement(b))}}};
AdfDhtmlSelectOneChoicePeer.prototype.HandleComponentClick=function(a){if(a.getEventPhase()==AdfBaseEvent.AT_TARGET_PHASE){AdfDhtmlSelectOneChoicePeer.superclass.HandleComponentClick.call(this,a);var b=a.getSource();if(this._isCompact(b)){var d=a.getNativeEventTarget();this.IsItemEnabled(d)?(a=d.getAttribute(AdfDhtmlSelectOneListbasePeer._ITEM_VALUE_EXPANDO),AdfDomUtils.removeCSSClassName(d,AdfDhtmlSelectOneChoicePeer._HIGHLIGHTED_STYLE_CLASS),d=this.getDomElement(),this.SetDisplayValue(b,d,a),this.Validate(b,
a),this._returnToDropDown(b)):!this._mouseDownCalled&&!this._closingPopup&&AdfAgent.IE_PLATFORM==AdfAgent.AGENT.getPlatform()&&this._showPopupPanel(b);this._closingPopup=this._mouseDownCalled=!1}}};
AdfDhtmlSelectOneChoicePeer.prototype.HandleComponentKeyUp=function(a){if(AdfBaseEvent.AT_TARGET_PHASE==a.getEventPhase()&&AdfAgent.IE_PLATFORM==AdfAgent.AGENT.getPlatform()&&AdfKeyStroke.ENTER_KEY==AdfAgent.AGENT.getKeyCode(a.getNativeEvent())){var b=a.getSource();a.cancel();AdfDhtmlEditableValuePeer.getContentNode(b).blur();AdfFocusUtils.focusElement(this._getFocusElement(b))}};AdfDhtmlSelectOneChoicePeer.prototype.HandleComponentKeyPress=function(a){this.StopArrowKeyBubbling(a)};
AdfDhtmlSelectOneChoicePeer.prototype.HandleComponentKeyDown=function(a){this.StopArrowKeyBubbling(a);if(a.getEventPhase()==AdfBaseEvent.AT_TARGET_PHASE){var b=a.getSource();if(this._isCompact(b)&&!b.getDisabled()){var d=a.getNativeEventTarget(),e=a.getNativeEvent(),f=AdfAgent.AGENT.getKeyCode(e),g=this.getDomElement(),h=this.GetSubmittedValue(b,g),k=this.FindItemElementWithValue(b,h);switch(f){case AdfKeyStroke.ESC_KEY:a.cancel();this._returnToDropDown(b);break;case AdfKeyStroke.ENTER_KEY:this.isPopupVisible(b,
AdfDhtmlSelectOneChoicePeer._POPUP_PANEL_ID)?(k=AdfDhtmlEditableValuePeer.getContentNode(b,g),d=k.getAttribute(AdfDhtmlSelectOneListbasePeer._ITEM_VALUE_EXPANDO),null!=d&&(k.removeAttribute(AdfDhtmlSelectOneListbasePeer._ITEM_VALUE_EXPANDO),h=this.GetSubmittedValue(b,g),h!=d&&this.Validate(b,h)),AdfAgent.IE_PLATFORM==AdfAgent.AGENT.getPlatform()&&(this._closingPopup=!0),this._returnToDropDown(b),AdfFocusUtils.focusElement(this._getFocusElement(b))):f==AdfKeyStroke.ENTER_KEY&&!this.isPopupVisible(b,
AdfDhtmlSelectOneChoicePeer._POPUP_PANEL_ID)&&this._showPopupPanel(b);break;case AdfKeyStroke.TAB_KEY:this.isPopupVisible(b,AdfDhtmlSelectOneChoicePeer._POPUP_PANEL_ID)&&this._returnToDropDown(b);break;case AdfKeyStroke.ARROWDOWN_KEY:if(e.altKey){this._showPopupPanel(b);break}case AdfKeyStroke.ARROWUP_KEY:if("A"==d.tagName&&!this.isPopupVisible(b,AdfDhtmlSelectOneChoicePeer._POPUP_PANEL_ID)){this._showPopupPanel(b);break}(e=f==AdfKeyStroke.ARROWUP_KEY?this.GetPreviousEnabledItem(k):this.GetNextEnabledItem(k))||
(e=this.GetFirstEnabledItem(b));d=this.isPopupVisible(b,AdfDhtmlSelectOneChoicePeer._POPUP_PANEL_ID);e!=k&&(e=""+e.getAttribute(AdfDhtmlSelectOneListbasePeer._ITEM_VALUE_EXPANDO),d?(k=AdfDhtmlEditableValuePeer.getContentNode(b,g),null==k.getAttribute(AdfDhtmlSelectOneListbasePeer._ITEM_VALUE_EXPANDO)&&k.setAttribute(AdfDhtmlSelectOneListbasePeer._ITEM_VALUE_EXPANDO,""+h),this.SetDisplayValue(b,g,e)):this.Validate(b,e));d&&a.cancel()}}AdfAgent.IE_PLATFORM==AdfAgent.AGENT.getPlatform()&&(8>=AdfAgent.AGENT.getVersion()&&
AdfKeyStroke.ENTER_KEY==AdfAgent.AGENT.getKeyCode(a.getNativeEvent()))&&(a.Event.returnValue=!1)}};AdfDhtmlSelectOneChoicePeer.prototype.HandleComponentMouseOver=function(a){a.getEventPhase()==AdfBaseEvent.AT_TARGET_PHASE&&(a.getSource(),a=a.getNativeEventTarget(),this.IsItemEnabled(a)&&(AdfDomUtils.containsCSSClassName(a,AdfDhtmlSelectOneChoicePeer._HIGHLIGHTED_STYLE_CLASS)||AdfDomUtils.addCSSClassName(a,AdfDhtmlSelectOneChoicePeer._HIGHLIGHTED_STYLE_CLASS)))};
AdfDhtmlSelectOneChoicePeer.prototype.HandleComponentMouseOut=function(a){a.getEventPhase()==AdfBaseEvent.AT_TARGET_PHASE&&(a.getSource(),a=a.getNativeEventTarget(),this.IsItemEnabled(a)&&AdfDomUtils.removeCSSClassName(a,AdfDhtmlSelectOneChoicePeer._HIGHLIGHTED_STYLE_CLASS))};AdfDhtmlSelectOneChoicePeer.prototype.HandleDomChange=function(a,b){var d=this.getDomElement();this.Validate(a,this.GetSubmittedValue(a,d))};
AdfDhtmlSelectOneChoicePeer.prototype.PopupClosed=function(a,b,d){if(d==AdfDhtmlSelectOneChoicePeer._POPUP_PANEL_ID){d=AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlSelectOneChoicePeer._POPUP_WRAPPER_ID);AdfAgent.AGENT.getElementById(d).appendChild(b);b=AdfRichUIPeer.getDomElementForComponent(a);d=AdfDhtmlEditableValuePeer.getContentNode(a,b);var e=d.getAttribute(AdfDhtmlSelectOneListbasePeer._ITEM_VALUE_EXPANDO);null!=e&&(d.removeAttribute(AdfDhtmlSelectOneListbasePeer._ITEM_VALUE_EXPANDO),this.SetDisplayValue(a,
b,e));AdfFocusUtils.focusElement(this._getFocusElement(a))}};AdfDhtmlSelectOneChoicePeer.prototype.VetoShowNoteWindow=function(a){return this._isCompact(a)&&this.isPopupVisible(a,AdfDhtmlSelectOneChoicePeer._POPUP_PANEL_ID)?!0:AdfDhtmlSelectOneChoicePeer.superclass.VetoShowNoteWindow.call(this)};AdfDhtmlSelectOneChoicePeer.prototype.GetNoteWindowAlignmentNode=function(a,b){return this._getFocusElement(a)};AdfDhtmlSelectOneChoicePeer.prototype.GetComponentMode=function(a){return a.getMode()};
AdfDhtmlSelectOneChoicePeer.prototype.SetDisplayValue=function(a,b,d){var e=AdfDhtmlEditableValuePeer.getContentNode(a,b);if(null!=e){var f=a.getReadOnly();AdfAssert.assertString(d);if(!f){f=this.FindItemElementWithValue(a,d);if(this._isCompact(a)){var g=this.GetSubmittedValue(a,b),g=this.FindItemElementWithValue(a,g);this.SelectItemElement(a,f,g);null==f&&this.AddEmptyOption(a,b)}else f&&(a=AdfAgent.AGENT.getAttribute(f,AdfDhtmlSelectOneChoicePeer._TEMP_OPTION_KEY),a||(b=AdfDomUtils.getFirstDescendentElement(e,
"OPTION"),(a=AdfAgent.AGENT.getAttribute(b,AdfDhtmlSelectOneChoicePeer._TEMP_OPTION_KEY))&&e.removeChild(b)),e.title=f.title);e.value=d}}};
AdfDhtmlSelectOneChoicePeer.prototype.AddEmptyOption=function(a,b){var d=a.getClientId(),d=AdfRichUIPeer.CreateSubId(d,AdfDhtmlSelectOneChoicePeer._POPUP_ID),d=AdfAgent.AGENT.getElementById(d).firstChild.insertRow(0),e=selectedItem.cloneNode(!0),f=a.getUnselectedLabel();null==f&&(f="");e.setAttribute(AdfDhtmlSelectOneListbasePeer._ITEM_VALUE_EXPANDO,"");e.firstChild.nodeValue=f;d.appendChild(e);AdfAgent.AGENT.elementsAdded(e)};
AdfDhtmlSelectOneChoicePeer.prototype.GetItemElements=function(a){if(this._isCompact(a))return AdfDhtmlSelectOneChoicePeer.superclass.GetItemElements.call(this,a);var b=this.getDomElement();a=AdfDhtmlEditableValuePeer.getContentNode(a,b);return null==a?null:a.options};AdfDhtmlSelectOneChoicePeer.prototype.GetComponentSelectItems=function(a,b){return this._isCompact(a)?AdfDhtmlSelectOneChoicePeer.superclass.GetComponentSelectItems.call(this,a,b):AdfDhtmlSelectOnePeer.GetSelectItemsFromOptions(a,b)};
AdfDhtmlSelectOneChoicePeer.prototype.FindItemElementWithValue=function(a,b){if(this._isCompact(a))return AdfDhtmlSelectOneChoicePeer.superclass.FindItemElementWithValue.call(this,a,b);var d=this.getDomElement(),d=AdfDhtmlEditableValuePeer.getContentNode(a,d);if(null==d)return null;for(var e=d.options,f=e.length,d=0;d<f;d++)if(e[d].value==b)return e[d];return null};AdfDhtmlSelectOneChoicePeer.prototype.GetInlineEditor=function(a){return AdfDhtmlSimpleLabelEditor.getInlineEditor()};
AdfDhtmlSelectOneChoicePeer.prototype.ComponentDisabledChanged=function(a,b,d,e){a=AdfDhtmlEditableValuePeer.getContentNode(a,b);!0==d?(AdfDomUtils.addCSSClassName(b,AdfRichUIPeer.DISABLED_STYLECLASS),a.setAttribute("disabled","true")):(AdfDomUtils.removeCSSClassName(b,AdfRichUIPeer.DISABLED_STYLECLASS),a.removeAttribute("disabled"))};
AdfDhtmlSelectOneChoicePeer.prototype._returnToDropDown=function(a){a.getClientId();var b=AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlSelectOneChoicePeer._POPUP_ID);AdfAgent.AGENT.getElementById(b);this.hidePopup(a,AdfDhtmlSelectOneChoicePeer._POPUP_PANEL_ID);AdfFocusUtils.focusElement(this._getFocusElement(a))};
AdfDhtmlSelectOneChoicePeer.prototype._showPopupPanel=function(a){AdfObject.ensureClassInitialization(AdfRichPopup);var b=a.getClientId(),d=AdfRichUIPeer.CreateSubId(b,AdfDhtmlSelectOneChoicePeer._SPACER_ID);AdfAgent.AGENT.getElementById(d);d=AdfRichUIPeer.CreateSubId(b,AdfDhtmlSelectOneChoicePeer._POPUP_ID);d=AdfAgent.AGENT.getElementById(d);d.parentNode.removeChild(d);var e={};e[AdfRichPopup.HINT_ALIGN]=AdfRichPopup.ALIGN_AFTER_START;this._isCompact(a)?(e[AdfDhtmlPopupHints.FOCUS]=!0,e[AdfRichPopup.HINT_ALIGN_ID]=
AdfRichUIPeer.CreateSubId(b,AdfDhtmlSelectOneChoicePeer._DROPDOWN_ID)):(e[AdfDhtmlPopupHints.FOCUS]=!1,e[AdfRichPopup.HINT_ALIGN_ID]=AdfRichUIPeer.CreateSubId(b,AdfDhtmlSelectOneChoicePeer._TEXT_ID));this.showPopup(a,d,e,AdfDhtmlSelectOneChoicePeer._POPUP_PANEL_ID)};AdfDhtmlSelectOneChoicePeer.prototype._isCompact=function(a){return this.GetComponentMode(a)==AdfDhtmlSelectOneChoicePeer._COMPACT};
AdfDhtmlSelectOneChoicePeer.prototype._getFocusElement=function(a){a=this._isCompact(a)?AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlSelectOneChoicePeer._DROPDOWN_ID):AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlSelectOneChoicePeer._TEXT_ID);return AdfAgent.AGENT.getElementById(a)};
AdfDhtmlSelectOneChoicePeer.prototype.GetItemElementsParent=function(a){var b=a.getClientId();return this._isCompact(a)?AdfAgent.AGENT.getElementById(AdfRichUIPeer.CreateSubId(b,AdfDhtmlSelectOneChoicePeer._POPUP_ID)):AdfAgent.AGENT.getElementById(AdfRichUIPeer.CreateSubId(b,AdfDhtmlSelectOneChoicePeer._TEXT_ID))};