AdfRichUIPeer.createPeerClass(AdfDhtmlSelectManyPeer,"AdfDhtmlSelectManyChoicePeer");
AdfDhtmlSelectManyChoicePeer.InitSubclass=function(){AdfRichUIPeer.addComponentPropertyGetters(this,AdfUIEditableValue.SUBMITTED_VALUE,AdfUISelectMany.SELECT_ITEMS,AdfRichSelectManyChoice.LABEL);AdfRichUIPeer.addComponentPropertyChanges(this,AdfRichSelectManyChoice.LABEL);AdfRichUIPeer.addComponentEventHandlers(this,AdfUIInputEvent.CLICK_EVENT_TYPE,AdfUIInputEvent.MOUSE_DOWN_EVENT_TYPE,AdfUIInputEvent.MOUSE_UP_EVENT_TYPE,AdfUIInputEvent.KEY_DOWN_EVENT_TYPE,AdfUIInputEvent.KEY_PRESS_EVENT_TYPE);AdfAgent.AGENT.getPlatform()==
AdfAgent.IE_PLATFORM&&AdfRichUIPeer.addComponentEventHandlers(this,AdfUIInputEvent.FOCUS_EVENT_TYPE,AdfUIInputEvent.BLUR_EVENT_TYPE);this._DROPDOWN_ID="drop";this._POPUP_ID="pop";this._POPUP_WRAPPER_ID="popWrap";this._SPACER_ID="sp";this._LAZY_ID="lazy";this._POPUP_PANEL_ID="_afrSelectManyPopupPanel";this._ITEM_VALUE_EXPANDO="_afrItemValue";this._ITEM_DISABLE_EXPANDO="_afrDisable";this._SELECTED_ID_EXPANDO="_afrSelectedItemId";this._TRUE_VALUE_ATTR="_adfTrueVal";this._HIGHLIGHTED_STYLE="p_AFHighlighted";
this._SELECTED_STYLE_CLASS="p_AFSelected";this._DISABLED="disabled";this._FETCHING_POPUP_WRAPPER_ID="fetchWrap";this._FETCHING_POPUP_ID="fetchPop";this._FETCHING_SPACER_ID="fetchSp";this._FETCHING_POPUP_PANEL_ID="_afrSelectManyFetchingPopupPanel";this._LAZY_STATE_CONTENT_LOADED="contentLoaded";this._LAZY_STATE_NO_CONTENT="noContent";this._LAZY_STATE_FETCHING="fetching"};AdfDhtmlSelectManyChoicePeer.prototype.needsFocusTargetStyleClass=function(){return!0};
AdfDhtmlSelectManyChoicePeer.prototype.HandleComponentMouseDown=function(a){var b=a.getSource(),d=this.getDomElement();a=a.getNativeEventTarget();var d=AdfDhtmlEditableValuePeer.getContentNode(b,d),e=a==this._getDropDownImgElement(b),f=this._getDropDownImgElement(b);d.disabled||!e&&a!=d||(f.parentNode.parentNode.setAttribute("aria-expanded","true"),this.isPopupVisible(b,AdfDhtmlSelectManyChoicePeer._FETCHING_POPUP_PANEL_ID)?this.hidePopup(b,AdfDhtmlSelectManyChoicePeer._FETCHING_POPUP_PANEL_ID):this.isPopupVisible(b,
AdfDhtmlSelectManyChoicePeer._POPUP_PANEL_ID)?(this.hidePopup(b,AdfDhtmlSelectManyChoicePeer._POPUP_PANEL_ID),f.parentNode.parentNode.setAttribute("aria-expanded","false"),this.HideNoteWindow(b)):(a=this._getLazyState(),a==AdfDhtmlSelectManyChoicePeer._LAZY_STATE_NO_CONTENT?(this._setLazyState(AdfDhtmlSelectManyChoicePeer._LAZY_STATE_FETCHING),(new AdfContentFetchEvent(b,AdfContentFetchEvent.FETCH_EVENT_TYPE)).queue(),this._showFetchingDataPopup(b)):a!=AdfDhtmlSelectManyChoicePeer._LAZY_STATE_FETCHING&&
this._showPopupPanel(b)))};AdfDhtmlSelectManyChoicePeer.prototype.HandleComponentMouseUp=function(a){var b=a.getSource(),d=this.getDomElement();a=a.getNativeEventTarget();d=AdfDhtmlEditableValuePeer.getContentNode(b,d);a=a==this._getDropDownImgElement(b);!d.disabled&&a&&(this.isPopupVisible(b,AdfDhtmlSelectManyChoicePeer._POPUP_PANEL_ID)||a&&d.focus())};
AdfDhtmlSelectManyChoicePeer.prototype.HandleComponentFocus=function(a){AdfDhtmlSelectManyChoicePeer.superclass.HandleComponentFocus.call(this,a);a=a.getSource();var b=this.getDomElement();a=AdfDhtmlEditableValuePeer.getContentNode(a,b);AdfDomUtils.addCSSClassName(a,AdfDhtmlSelectManyChoicePeer._SELECTED_STYLE_CLASS)};
AdfDhtmlSelectManyChoicePeer.prototype.HandleComponentBlur=function(a){a=a.getSource();var b=this.getDomElement();a=AdfDhtmlEditableValuePeer.getContentNode(a,b);AdfDomUtils.removeCSSClassName(a,AdfDhtmlSelectManyChoicePeer._SELECTED_STYLE_CLASS)};
AdfDhtmlSelectManyChoicePeer.prototype.HandleComponentClick=function(a){AdfDhtmlSelectManyChoicePeer.superclass.HandleComponentClick.call(this,a);var b=this.getComponent(),d=this.getDomElement(),e=AdfDhtmlEditableValuePeer.getContentNode(b,d);if(!e.disabled){var f=a.getNativeEventTarget();if("INPUT"!=AdfAgent.AGENT.getNodeName(f))if((f=AdfDomUtils.getFirstChildElement(f))&&(f=AdfDomUtils.getFirstChildElement(f)),f&&"INPUT"==AdfAgent.AGENT.getNodeName(f)&&"checkbox"==f.type)f.disabled||(f.focus(),
f.click());else return;if("checkbox"==f.type){var g=f.getAttribute("id"),h=this._getCurrentItem(b,d);f!=h&&(this._highlightNewItem(f,h),g||a.getNativeEvent().shiftKey&&this.SelectRange(b,d,f,h));g&&(d=this.getDomElement(),this.UpdateAll(b,d,f.checked));a=this.GetSubmittedValue(b,f);this.SetDisplayValue(b,e,a)}}};AdfDhtmlSelectManyChoicePeer.prototype.HandleComponentKeyPress=function(a){this.StopArrowKeyBubbling(a)};
AdfDhtmlSelectManyChoicePeer.prototype.HandleComponentKeyDown=function(a){this.StopArrowKeyBubbling(a);var b=a.getNativeEventTarget();if("INPUT"==b.tagName){var d=a.getNativeEvent(),e=AdfAgent.AGENT.getKeyCode(d),f=a.getSource();if(e==AdfKeyStroke.ESC_KEY)this.isPopupVisible(f,AdfDhtmlSelectManyChoicePeer._POPUP_PANEL_ID)?this.hidePopup(f,AdfDhtmlSelectManyChoicePeer._POPUP_PANEL_ID):this.isPopupVisible(f,AdfDhtmlSelectManyChoicePeer._FETCHING_POPUP_PANEL_ID)&&this.hidePopup(f,AdfDhtmlSelectManyChoicePeer._FETCHING_POPUP_PANEL_ID);
else if("text"==b.type)(e==AdfKeyStroke.ARROWDOWN_KEY||e==AdfKeyStroke.ARROWDOWN_KEY&&d.altKey)&&this.HandleComponentMouseDown(a);else if("checkbox"==b.type)switch(b=this.getDomElement(),e){case AdfKeyStroke.ENTER_KEY:if(a=this._getCurrentItem(f,b))d=this.GetSubmittedValue(f,a),this.SetDisplayValue(f,AdfDhtmlEditableValuePeer.getContentNode(f,b),d);this.hidePopup(f,AdfDhtmlSelectManyChoicePeer._FETCHING_POPUP_PANEL_ID);this.hidePopup(f,AdfDhtmlSelectManyChoicePeer._POPUP_PANEL_ID);break;case AdfKeyStroke.TAB_KEY:this.hidePopup(f,
AdfDhtmlSelectManyChoicePeer._FETCHING_POPUP_PANEL_ID);this.hidePopup(f,AdfDhtmlSelectManyChoicePeer._POPUP_PANEL_ID);this.HideNoteWindow(f);f=AdfDhtmlEditableValuePeer.getContentNode(f,b);d.shiftKey?AdfFocusUtils.focusPreviousTabStop(f):AdfFocusUtils.focusNextTabStop(f);a.cancel();break;case AdfKeyStroke.A_KEY:d.ctrlKey&&(this.UpdateAll(f,b,!0),d=this.GetSubmittedValue(f,b),this.SetDisplayValue(f,AdfDhtmlEditableValuePeer.getContentNode(f,b),d),a.cancel());break;case AdfKeyStroke.ARROWUP_KEY:case AdfKeyStroke.ARROWDOWN_KEY:var g=
this._getCurrentItem(f,b);(e=e==AdfKeyStroke.ARROWUP_KEY?this.GetPreviousItem(f,b,g,d.shiftKey):this.GetNextItem(f,b,g))&&e!=g&&(this._highlightNewItem(e,g),d.shiftKey&&(g.checked=!0,e.checked=!0,d=this.GetSubmittedValue(f,e),this.SetDisplayValue(f,AdfDhtmlEditableValuePeer.getContentNode(f,b),d)),e.focus());a.cancel();break;case AdfKeyStroke.HOME_KEY:case AdfKeyStroke.END_KEY:d.shiftKey&&(a=this._getCurrentItem(f,b),e=e==AdfKeyStroke.HOME_KEY?this.GetNextItem(f,b,null):this.GetPreviousItem(f,b,null,
!0),this.SelectRange(f,b,a,e),d=this.GetSubmittedValue(f,e),this.SetDisplayValue(f,AdfDhtmlEditableValuePeer.getContentNode(f,b),d),this._highlightNewItem(e,a),e.focus())}}};
AdfDhtmlSelectManyChoicePeer.prototype.ReplaceDomElement=function(a,b){AdfDhtmlSelectManyChoicePeer.superclass.ReplaceDomElement.call(this,a,b);if(this._getLazyState()==AdfDhtmlSelectManyChoicePeer._LAZY_STATE_FETCHING){var d=this.getComponent(),e=AdfDhtmlEditableValuePeer.getContentNode(d,a);if(e=this.GetCheckboxes(d,e)){for(var f=0;f<e.length;f++)this.UpdateSelectedStyle(e[f]);e=this.GetSelectAllCheckbox(d);null!=e&&this.UpdateSelectedStyle(e)}this._setLazyState(AdfDhtmlSelectManyChoicePeer._LAZY_STATE_CONTENT_LOADED);
this.hidePopup(d,AdfDhtmlSelectManyChoicePeer._FETCHING_POPUP_PANEL_ID);this._showPopupPanel(d)}};AdfDhtmlSelectManyChoicePeer.prototype.GetSelectItemsParentDomElement=function(a){a=AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlSelectManyChoicePeer._POPUP_ID);return AdfAgent.AGENT.getElementById(a)};
AdfDhtmlSelectManyChoicePeer.prototype.SetDisplayValue=function(a,b,d){AdfAssert.assertDomElement(b);AdfAssert.assertArray(d);this._needsDisplayUpdate=!1;var e=this.GetCheckboxes(a,b);if(e){for(var f=!0,g=null,h=0,k=0;k<e.length;k++){var l=e[k],m=AdfCollections.indexOf(d,l.value);l.checked=0<=m;this.UpdateSelectedStyle(l);l.checked?(l=l.getAttribute(AdfDhtmlSelectManyChoicePeer._TRUE_VALUE_ATTR),h++,g=null==g?l:g+("; "+l)):l.disabled||(f=!1)}d=this.GetSelectAllCheckbox(a);null!=d&&(d.checked!=f&&
(d.checked=f),this.UpdateSelectedStyle(d));f&&1<h&&(g=AdfPage.PAGE.getLookAndFeel().getTranslatedString("af_selectManyChoice.LABEL_TIP_SELECT_ALL"));a=AdfDhtmlEditableValuePeer.getContentNode(a,b);null===g&&(g="");a.value=g;a.title=g}};
AdfDhtmlSelectManyChoicePeer.prototype.GetSubmittedValue=function(a,b){if(this._getLazyState()!=AdfDhtmlSelectManyChoicePeer._LAZY_STATE_CONTENT_LOADED){AdfAssert.assertDomElement(b);var d=AdfPage.PAGE.getLookAndFeel().getTranslatedString("af_selectManyChoice.LABEL_TIP_SELECT_ALL");if(AdfDhtmlEditableValuePeer.getContentNode(a,b).value==d)return null}return AdfDhtmlSelectManyChoicePeer.superclass.GetSubmittedValue(a,b)};
AdfDhtmlSelectManyChoicePeer.prototype.PopupClosed=function(a,b,d){d==AdfDhtmlSelectManyChoicePeer._POPUP_PANEL_ID?(d=AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlSelectManyChoicePeer._POPUP_WRAPPER_ID),d=AdfAgent.AGENT.getElementById(d),d.appendChild(b),b=this.getDomElement(),b=this.GetSubmittedValue(a,b),this.Validate(a,b),this.setAriaExpanded(a,!1)):d==AdfDhtmlSelectManyChoicePeer._FETCHING_POPUP_PANEL_ID&&(d=AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlSelectManyChoicePeer._FETCHING_POPUP_WRAPPER_ID),
d=AdfAgent.AGENT.getElementById(d),d.appendChild(b))};AdfDhtmlSelectManyChoicePeer.prototype.GetNoteWindowAlignmentNode=function(a,b){var d=AdfDhtmlEditableValuePeer.getContentNode(a,b);return AdfPage.PAGE.getLocaleContext().isRightToLeft()&&AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM?d:d.parentNode};AdfDhtmlSelectManyChoicePeer.prototype.GetInlineEditor=function(a){return AdfDhtmlSimpleLabelEditor.getInlineEditor()};
AdfDhtmlSelectManyChoicePeer.prototype.InitDomElement=function(a,b){AdfDhtmlSelectManyChoicePeer.superclass.InitDomElement.call(this,a,b);var d=AdfDhtmlEditableValuePeer.getContentNode(a,b);if(d=this.GetCheckboxes(a,d)){for(var e=0;e<d.length;e++)this.UpdateSelectedStyle(d[e]);d=this.GetSelectAllCheckbox(a);null!=d&&this.UpdateSelectedStyle(d)}};
AdfDhtmlSelectManyChoicePeer.prototype._showPopupPanel=function(a){AdfObject.ensureClassInitialization(AdfRichPopup);var b=a.getClientId(),d=this.getDomElement();this._setSpacerWidth(a,b,d,AdfDhtmlSelectManyChoicePeer._SPACER_ID);var e=this._getCurrentItem(a,d),f=this.GetSelectAllCheckbox(a);e!=f&&e&&AdfDomUtils.containsCSSClassName(e.parentNode.parentNode,AdfDhtmlSelectManyChoicePeer._HIGHLIGHTED_STYLE)&&AdfDomUtils.removeCSSClassName(e.parentNode.parentNode,AdfDhtmlSelectManyChoicePeer._HIGHLIGHTED_STYLE);
(e=f?f:this._getCurrentItem(a,d))&&!AdfDomUtils.containsCSSClassName(e.parentNode.parentNode,AdfDhtmlSelectManyChoicePeer._HIGHLIGHTED_STYLE)&&AdfDomUtils.addCSSClassName(e.parentNode.parentNode,AdfDhtmlSelectManyChoicePeer._HIGHLIGHTED_STYLE);b=AdfRichUIPeer.CreateSubId(b,AdfDhtmlSelectManyChoicePeer._POPUP_ID);b=AdfAgent.AGENT.getElementById(b);b.parentNode.removeChild(b);this.setAriaExpanded(a,!0);this.showPopup(a,b,this._getPopupHints(a,!0),AdfDhtmlSelectManyChoicePeer._POPUP_PANEL_ID)};
AdfDhtmlSelectManyChoicePeer.prototype.setAriaExpanded=function(a,b){var d=AdfDhtmlEditableValuePeer.getContentNode(a);AdfAgent.AGENT.setAttribute(d,"aria-expanded",b)};
AdfDhtmlSelectManyChoicePeer.prototype._showFetchingDataPopup=function(a){AdfObject.ensureClassInitialization(AdfRichPopup);var b=a.getClientId(),d=this.getDomElement();this._setSpacerWidth(a,b,d,AdfDhtmlSelectManyChoicePeer._FETCHING_SPACER_ID);b=AdfRichUIPeer.CreateSubId(b,AdfDhtmlSelectManyChoicePeer._FETCHING_POPUP_ID);b=AdfAgent.AGENT.getElementById(b);b.parentNode.removeChild(b);this.showPopup(a,b,this._getPopupHints(a,!1),AdfDhtmlSelectManyChoicePeer._FETCHING_POPUP_PANEL_ID)};
AdfDhtmlSelectManyChoicePeer.prototype._setSpacerWidth=function(a,b,d,e){b=AdfRichUIPeer.CreateSubId(b,e);b=AdfAgent.AGENT.getElementById(b);a=AdfDhtmlEditableValuePeer.getContentNode(a,d);b.style.width=a.parentNode.offsetWidth-7+"px"};
AdfDhtmlSelectManyChoicePeer.prototype._getPopupHints=function(a,b){var d={};d[AdfDhtmlPopupHints.TYPE]=AdfDhtmlPopupHints.TYPE_MENU;d[AdfRichPopup.HINT_ALIGN]=AdfRichPopup.ALIGN_AFTER_START;d[AdfRichPopup.HINT_ALIGN_ID]=AdfDhtmlEditableValuePeer.GetContentNodeId(a);d[AdfDhtmlPopupHints.AUTODISMISS]=AdfDhtmlPopupHints.AUTODISMISS_MENU;d[AdfDhtmlPopupHints.FOCUS]=b;return d};
AdfDhtmlSelectManyChoicePeer.prototype._getDropDownImgElement=function(a){a=AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlSelectManyChoicePeer._DROPDOWN_ID);return AdfAgent.AGENT.getElementById(a)};
AdfDhtmlSelectManyChoicePeer.prototype._getCurrentItem=function(a,b){var d=this.GetSelectAllCheckbox(a),e=this.GetCheckboxes(a,b),f=null;if(e)for(var g=0;g<e.length;g++)if(cb=e[g],f||cb.disabled||(f=cb),AdfDomUtils.containsCSSClassName(cb.parentNode.parentNode,AdfDhtmlSelectManyChoicePeer._HIGHLIGHTED_STYLE)){d=cb;break}null==d&&(d=f);return d};
AdfDhtmlSelectManyChoicePeer.prototype._highlightNewItem=function(a,b){b&&AdfDomUtils.containsCSSClassName(b.parentNode.parentNode,AdfDhtmlSelectManyChoicePeer._HIGHLIGHTED_STYLE)&&(AdfDomUtils.removeCSSClassName(b.parentNode.parentNode,AdfDhtmlSelectManyChoicePeer._HIGHLIGHTED_STYLE),b.parentNode.parentNode.removeAttribute("aria-selected"));a&&!AdfDomUtils.containsCSSClassName(a.parentNode.parentNode,AdfDhtmlSelectManyChoicePeer._HIGHLIGHTED_STYLE)&&(AdfDomUtils.addCSSClassName(a.parentNode.parentNode,
AdfDhtmlSelectManyChoicePeer._HIGHLIGHTED_STYLE),a.parentNode.parentNode.setAttribute("aria-selected","true"))};AdfDhtmlSelectManyChoicePeer.prototype._getLazyState=function(){var a=this.getComponent();if(null==a._lazyState){var b=AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlSelectManyChoicePeer._LAZY_ID),b=AdfAgent.AGENT.getElementById(b);a._lazyState=null!=b?AdfDhtmlSelectManyChoicePeer._LAZY_STATE_NO_CONTENT:AdfDhtmlSelectManyChoicePeer._LAZY_STATE_CONTENT_LOADED}return a._lazyState};
AdfDhtmlSelectManyChoicePeer.prototype._setLazyState=function(a){this.getComponent()._lazyState=a};