AdfRichUIPeer.createPeerClass(AdfDhtmlEditableValuePeer,"AdfDhtmlSelectManyPeer");AdfDhtmlSelectManyPeer.InitSubclass=function(){AdfAgent.AGENT.isTouchFirstDevice()||AdfRichUIPeer.addComponentEventHandlers(this,AdfUIInputEvent.MOUSE_IN_EVENT_TYPE);this._SELECT_ALL_ID="saId";this._ITEM_VALUE_EXPANDO="_adfIV"};AdfDhtmlSelectManyPeer.prototype.HandleComponentMouseOver=function(a){this.ShowNoteWindowMouseOver(a)};
AdfDhtmlSelectManyPeer.prototype.GetComponentLabel=function(a,b){var d=AdfDomUtils.getChildElementByAttributeValue(b,"for",AdfRichUIPeer.createSubId(a.getClientId(),AdfDhtmlEditableValuePeer._CONTENT_ID),"LABEL");null==d&&(d=b.getElementsByTagName("LABEL"),d=d.length?d[0]:null);if(null!=d){for(var e=AdfDhtmlEditableValuePeer.getContentNode(a,b),f=d.parentNode;f&&f!=b;){if(f==e)return null;f=f.parentNode}return AdfAgent.AGENT.getTextContent(d)}return null};
AdfDhtmlSelectManyPeer.prototype.getConvertedValue=function(a,b){var d=b;if(void 0!=a.getConverter){var e=a.getConverter();if(null!=e&&(d=[],null!=b))for(var f=0;f<b.length;f++)if(d[f]=e.getAsObject(b[f],a.getProperty("label")),void 0===d[f])return}return d};
AdfDhtmlSelectManyPeer.prototype.getConvertedObject=function(a,b){if(null!=b){var d=b;null==a&&(a=this.getComponent());var e=a.getConverter();if(null!=e)for(var d=[],f=0;f<b.length;f++)if(d[f]=e.getAsString(b[f],a.getProperty("label")),void 0===d[f])return;return d}return null};AdfDhtmlSelectManyPeer.prototype.IsCheckbox=function(a){return null!=a?"INPUT"==AdfAgent.AGENT.getNodeName(a)&&"checkbox"==a.type:!1};
AdfDhtmlSelectManyPeer.prototype.GetCheckboxByEventTarget=function(a,b){var d=AdfAgent.AGENT;if(a&&"INPUT"!=d.getNodeName(a)){var e=a.getElementsByTagName("input");if(1<e.length)return null;if((e=e[0])&&this.IsCheckbox(e)){if(!e.disabled){var f=d.getComputedStyle(e),g=d.getPlatform()==AdfAgent.IE_PLATFORM,h=d.getPlatform()==AdfAgent.GECKO_PLATFORM,k=b.getNativeEvent();if("LABEL"!=d.getNodeName(a)||g&&"none"==f.display||h&&k.ctrlKey)"none"!=f.display&&e.focus(),e.checked=!e.checked}return e}}return a};
AdfDhtmlSelectManyPeer.prototype.GetNullDefault=function(){return AdfCollections.EMPTY_ARRAY};AdfDhtmlSelectManyPeer.prototype.GetSubmittedValue=function(a,b){AdfAssert.assertDomElement(b);if(a.getReadOnly()){var d=AdfDhtmlEditableValuePeer.getContentNode(a,b).getAttribute(AdfDhtmlSelectManyPeer._ITEM_VALUE_EXPANDO);return d?(d=d.replace(/'/g,'"'),JSON.parse(d)):d}var d=this.GetCheckboxes(a,b),e=[];if(d)for(var f=0;f<d.length;f++){var g=d[f];g.checked&&e.push(g.value)}return e};
AdfDhtmlSelectManyPeer.prototype.GetCheckboxes=function(a,b,d){AdfAssert.assertDomElement(b);b=AdfDomUtils.getFormElement(b);a=a.getClientId();if(a=b.elements[a]){if(a.length)return a;b=[];b.push(a);return b}return null};
AdfDhtmlSelectManyPeer.prototype.GetComponentSelectItems=function(a,b){AdfAssert.assertDomElement(b);var d=[],e=this.GetCheckboxes(a,b);if(e)for(i=0;i<e.length;i++){d[i]=new AdfSelectItem;d[i].setValue(e[i].value);var f=AdfDhtmlEditableValuePeer.GetLabelElement(e[i]).textContent;f&&d[i].setLabel(f);d[i].setDisabled(e[i].disabled)}return d};AdfDhtmlSelectManyPeer.prototype.GetSelectAllCheckbox=function(a){a=AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlSelectManyPeer._SELECT_ALL_ID);return AdfAgent.AGENT.getElementById(a)};
AdfDhtmlSelectManyPeer.prototype.GetPreviousItem=function(a,b,d,e,f){AdfAssert.assertDomElement(b);if(b=this.GetCheckboxes(a,b,f))if(f=null,e||(f=this.GetSelectAllCheckbox(a)),e||d!=f){for(a=0;a<b.length;a++){e=b[a];if(e==d)break;e.disabled||(f=e)}f&&(d=f)}return d};AdfDhtmlSelectManyPeer.prototype.GetNextItem=function(a,b,d,e){AdfAssert.assertDomElement(b);if(a=this.GetCheckboxes(a,b,e)){b=null;for(e=a.length-1;0<=e;e--){var f=a[e];if(f==d)break;f.disabled||(b=f)}b&&(d=b)}return d};
AdfDhtmlSelectManyPeer.prototype.SelectRange=function(a,b,d,e,f){if(b=this.GetCheckboxes(a,b,f)){f=this.GetSelectAllCheckbox(a);a=!1;var g;d==f?(a=!0,g=e):e==f&&(a=!0,g=d);for(f=0;f<b.length;f++){var h=b[f];a||(h==d?(a=!0,g=e):h==e&&(a=!0,g=d));if(a&&(h.disabled||(h.checked=!0,this.UpdateSelectedStyle(h)),h==g))break}}};
AdfDhtmlSelectManyPeer.prototype.UpdateAll=function(a,b,d,e){var f=this.GetCheckboxes(a,b);if(f){for(var g=0;g<f.length;g++){var h=f[g];h.disabled||(h.checked=d)}e&&(b=this.GetSubmittedValue(a,b),this.Validate(a,b))}};
AdfDhtmlSelectManyPeer.prototype.UpdateSelectedStyle=function(a){var b=a.parentNode.parentNode;a&&(a.checked?AdfDomUtils.containsCSSClassName(b,AdfDhtmlSelectManyPeer.SELECTED_STYLE)||(AdfDomUtils.addCSSClassName(b,AdfDhtmlSelectManyPeer.SELECTED_STYLE),"option"==b.getAttribute("role")&&b.setAttribute("aria-selected","true")):AdfDomUtils.containsCSSClassName(b,AdfDhtmlSelectManyPeer.SELECTED_STYLE)&&(AdfDomUtils.removeCSSClassName(b,AdfDhtmlSelectManyPeer.SELECTED_STYLE),b.getAttribute("aria-selected")&&
b.removeAttribute("aria-selected")))};AdfDhtmlSelectManyPeer.prototype.GetSelectItemsParentDomElement=function(a){return AdfDhtmlEditableValuePeer.getContentNode(a)};AdfDhtmlSelectManyPeer.GetElementByAttributeValue=function(a,b,d){AdfAssert.assertObject(a);AdfAssert.assertNonEmptyString(b);AdfAssert.assertString(d);for(var e=a.length,f=0;f<e;f++){var g=a[f];if(g.getAttribute(b)==d)return g}return null};AdfDhtmlSelectManyPeer.HIGHLIGHTED_STYLE="p_AFHighlighted";
AdfDhtmlSelectManyPeer.SELECTED_STYLE="p_AFSelected";