AdfRichUIPeer.createPeerClass(AdfRichUIPeer,"AdfDhtmlDocumentPeer",!1);
AdfDhtmlDocumentPeer.InitSubclass=function(){AdfRichUIPeer.addComponentEventHandlers(this,AdfComponentEvent.BLUR_EVENT_TYPE,AdfComponentEvent.FOCUS_EVENT_TYPE,AdfDialogEvent.EVENT_TYPE,AdfUIInputEvent.CLICK_EVENT_TYPE,AdfUIInputEvent.KEY_UP_EVENT_TYPE,AdfComponentEvent.CONTEXT_MENU_EVENT_TYPE,AdfRedirectEvent.REDIRECT_EVENT_TYPE);AdfRichUIPeer.addComponentPropertyChanges(this,AdfRichDocument.SHORT_DESC,AdfRichDocument.TITLE);this._ICON_CONTAINER_ID="iconC";this._MESSAGE_DIALOG_ID="msgDlg";this._MESSAGE_DIALOG_CONTAINER_ID=
"msgCtr";this._GLOBAL_LIVE_CONTAINER_ID="liveCtr";this._SKIP_LINK_ID="skip";this._INACTIVE_STYLECLASS="p_AFInactive";this._ALERT_CONFIRM_DIALOG_CONTAINER_ID="afr::UtilPopupCtnr";this._ALERT_CONFIRM_POPUP_ID_EXPANDO="data-afr-pid";this._ALERT_CONFIRM_DIALOG_ID_EXPANDO="data-afr-did";this._DIALOG_CONTENT_SUBID="contentContainer";this._DIALOG_CANCEL_ID_SUBID="cancel"};
AdfDhtmlDocumentPeer.prototype.Init=function(a){AdfPage.PAGE.setDocumentClientId(a.getClientId());AdfDhtmlDocumentPeer.superclass.Init.call(this,a)};AdfDhtmlDocumentPeer.prototype.ComponentShortDescChanged=function(a,b,d,e){AdfAssert.assertStringOrNull(d);document.body.title=d;return!0};AdfDhtmlDocumentPeer.prototype.ComponentTitleChanged=function(a,b,d,e){AdfAssert.assertStringOrNull(d);document.title=d;return!0};
AdfDhtmlDocumentPeer.prototype.isMessagesDialogShowable=function(){var a=AdfPage.PAGE,b=a.getAllMessages(),d=this.getComponent().getClientId(),b=b[d],d=this._getSlaveComponent(),e=!1;null!=d&&(e=d.getGlobalOnly());return AdfMessageUtils.isPageLevelBoxNeeded(a,b,e)};
AdfDhtmlDocumentPeer.prototype.getMessageDialogId=function(){var a=this.getComponent().getClientId();return"old"==AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|dialog-tr-button-type")?AdfRichUIPeer.CreateSubId(a,AdfDhtmlDocumentPeer._MESSAGE_DIALOG_ID):a+"_"+AdfDhtmlDocumentPeer._MESSAGE_DIALOG_ID};AdfDhtmlDocumentPeer.prototype.isMessagesInline=function(){var a=this.getMessageDialogId(),a=AdfAgent.AGENT.getElementById(a),b=this._getMessageDialogContainerId();return a&&a.parentNode.id==b};
AdfDhtmlDocumentPeer.prototype.setMessagesDialogShown=function(a){a?this.messageShow():this._hideMessagePopup()};AdfDhtmlDocumentPeer.prototype.HandleComponentFocus=function(a){if(a.getEventPhase()==AdfBaseEvent.AT_TARGET_PHASE){var b=this._getSkipLinkElement(this.getComponent());a.getNativeEventTarget()==b&&(b.style.top="0px")}};
AdfDhtmlDocumentPeer.prototype.HandleComponentBlur=function(a){if(a.getEventPhase()==AdfBaseEvent.AT_TARGET_PHASE){var b=this._getSkipLinkElement(this.getComponent());a.getNativeEventTarget()==b&&(b.style.top="")}};AdfDhtmlDocumentPeer.prototype.HandleComponentClick=function(a){if(a.getEventPhase()==AdfBaseEvent.AT_TARGET_PHASE){var b=this._getSkipLinkElement(this.getComponent());a.getNativeEventTarget()==b&&(this._skipToContent(),a.cancel())}};
AdfDhtmlDocumentPeer.prototype.HandleComponentContextMenu=function(a){AdfDhtmlDocumentPeer.__ACTION_LINK_BROWSER_CONTEXT_SUPPRESSION_OFF||AdfDomUtils.suppressActionLinkBrowserContextMenu(a)};
AdfDhtmlDocumentPeer.prototype.HandleComponentKeyUp=function(a){if(!a.isCanceled()&&AdfPage.PAGE.getDefaultMessageHandlerComponentId()==this.getComponent().getClientId()){var b=a.getKeyCode();a.ctrlKey&&a.altKey?79==b&&(this.setMessagesDialogShown(!1),a.cancel()):a.ctrlKey&&a.shiftKey&&87==b&&(this.setMessagesDialogShown(!0),a.cancel())}if(!a.isCanceled()){var d=a.getNativeEvent(),b=a.getKeyCode();d.ctrlKey&&d.altKey&&87==b&&AdfDhtmlDialogManager.getInstance().focusNextModelessDialog(a.getNativeEventTarget())}};
AdfDhtmlDocumentPeer.prototype.HandleComponentDialog=function(a){var b=a.getSource().getClientId(),d=this.getComponent().getClientId(),e=this.getMessageDialogId();if(b==e&&(b=a.getOutcome(),a.cancel(),this.hidePopup(this.getComponent()),b==AdfDialogEvent.OUTCOME_OK&&(a=AdfPage.PAGE,b=this._getSlaveComponent(),e=!1,null!=b&&(e=b.getGlobalOnly()),!e))){var f;a=a.getAllMessages();for(var g in a)if(g!=d&&(b=a[g],null!=b&&null!=b.compId)){f=g;break}null!=f&&AdfMessageUtils.messageGroupFocus(f)}};
AdfDhtmlDocumentPeer.prototype.HandleComponentRedirect=function(a){var b=a.getURL();AdfPage.PAGE.doRedirect(b,a.getNavigationSuppressed())};AdfDhtmlDocumentPeer.prototype.PopupClosed=function(a,b){AdfDhtmlDocumentPeer.superclass.PopupClosed.call(this,a,b);AdfDomUtils.removeCSSClassName(b,AdfRichUIPeer.HOVER_TARGET_STYLECLASS);AdfDomUtils.removeCSSClassName(b,AdfDhtmlDocumentPeer._INACTIVE_STYLECLASS);var d=this._getMessageDialogContainerId();(d=AdfAgent.AGENT.getElementById(d))&&d.appendChild(b)};
AdfDhtmlDocumentPeer.prototype.InitDomElement=function(a,b){var d=AdfPage.PAGE;AdfDhtmlDocumentPeer.superclass.InitDomElement.call(this,a,b);var e=new AdfComponentEvent(a,"load");d.isPageOnloadCalled()?e.queue():(e=e.createCallback(e.queue),d.setOnLoadCallback(e));a.getInitialFocusId()&&(this._activateFocusCallback=this.createCallback(this._activateFocus),this._focusTimerId=window.setTimeout(this._activateFocusCallback,50));this._globalMessageCount=0;this._initSkipLink(a);this._setDocumentTitle(a);
this._setUncommittedDataWarning(a)};AdfDhtmlDocumentPeer.prototype.ReplaceDomElement=function(a,b){var d=this.getComponent().getClientId(),d=AdfRichUIPeer.CreateSubId(d,AdfDhtmlDocumentPeer._ICON_CONTAINER_ID);if(a.id==d)for(var d=AdfAgent.AGENT,e=a.firstChild;e;){var f=e.nextSibling;if(1==e.nodeType){var g=e.id;g&&!d.getElementById(g)&&(b.appendChild(e),d.elementsAdded(e))}e=f}else AdfDhtmlDocumentPeer.superclass.ReplaceDomElement.call(this,a,b)};
AdfDhtmlDocumentPeer.prototype.MessageShow=function(a,b){this._messageUpdate(a,b,!0)};AdfDhtmlDocumentPeer.prototype.MessageNotify=function(a,b){this._messageUpdate(a,b,!1)};
AdfDhtmlDocumentPeer.prototype._messageUpdate=function(a,b,d){var e=AdfPage.PAGE,f=this._getSlaveComponent(),g=!1;null!=f&&(g=f.getGlobalOnly());var h=this.getComponent(),k=h.getClientId(),l=e.getAllMessages(),m=l[k];b=0;null!=m&&(b=m.length);if(!d&&!AdfMessageUtils.hasMessages(e,b,g))AdfMessageUtils.HideMessagesDialog();else if(d&&!AdfMessageUtils.isPageLevelBoxNeeded(e,m,g))for(k in AdfMessageUtils.HideMessagesDialog(),l)h=l[k],null!=h&&null!=h.compId&&AdfMessageUtils.messageGroupFocus(k);else if(d||
this.isPopupVisible(h)||this._globalMessageCount<b){var n=AdfAgent.AGENT,q=null,r=null,t=null;d=null;null!=f&&(q=f.getMessage(),r=f.getText(),t=f.getShortDesc(),d=f.getStyleClass());var f=this.getMessageDialogId(),u=e.findComponent(f),v=this.getDomElement(),e=0;null!=a&&(e=a);if(g)e=m.maxType;else for(var w in l)a=l[w].maxType,a>e&&(e=a);if(n.getExpandoProperty(v,AdfRichUIPeer.__TYPE_ATTR)!=e){n.setExpandoProperty(v,AdfRichUIPeer.__TYPE_ATTR,e);var y;null!=d&&(y=AdfMessageUtils.getIconWithPrefix(e,
"."+d+" ",!0),null==y&&AdfLogger.LOGGER.warning("Icon not found with style class "+d+".  Make sure that skin contains class prefixed the message styleCalss: ."+d));y||(y=AdfMessageUtils.getIcon(e,!0));u.setTitleIconSource(y.src);r?u.setTitle(r):u.setTitle(AdfMessageUtils.getString(e))}l=AdfRichUIPeer.CreateSubId(f,"_cnt");if(l=n.getElementById(l))k=AdfMessageUtils.getCombinedMessagesDom(k,q,g),null!=t&&(k.title=t),l.hasChildNodes()?l.replaceChild(k,l.firstChild):l.appendChild(k);this.isMessagesInline()&&
(k=n.getElementById(f),this.UpdateMessageType(k,e),null!=d&&l&&AdfAgent.AGENT.getAttribute(l,"data-afr-msg-apply-class")&&AdfDomUtils.addCSSClassName(k,d),d={},d[AdfDhtmlPopupHints.TOP_POSITION]=.25,this.showPopup(h,k,d))}this._globalMessageCount=b};AdfDhtmlDocumentPeer.prototype._getSlaveComponent=function(){var a=AdfPage.PAGE,b=a.getMessageHandlerSlaveComponentId();return null!=b?a.findComponent(b):null};AdfDhtmlDocumentPeer.prototype._hideMessagePopup=function(){var a=this.getComponent();this.hidePopup(a)};
AdfDhtmlDocumentPeer.prototype._activateFocus=function(){var a=this.getComponent().getInitialFocusId();if(a){var b=AdfPage.PAGE.findComponentByAbsoluteId(a);b?b.focus():AdfLogger.LOGGER.warning("Invalid component id referenced by document initialFocusId: "+a+". You may need to set clientComponent to true for the desired focus component.")}window.clearTimeout(this._focusTimerId);this._focusTimerId=this._activateFocusCallback=null};
AdfDhtmlDocumentPeer.prototype._getSkipLinkElement=function(a){AdfAssert.assert(a);a=a.getClientId();a=AdfRichUIPeer.CreateSubId(a,AdfDhtmlDocumentPeer._SKIP_LINK_ID);return AdfAgent.AGENT.getElementById(a)};AdfDhtmlDocumentPeer._getSkipLinkTargetId=function(a){return a.getProperty("_afrSkpLnk")};
AdfDhtmlDocumentPeer.prototype._initSkipLink=function(a){var b=!1,d=AdfDhtmlDocumentPeer._getSkipLinkTargetId(a);d?null==AdfAgent.AGENT.getElementById(d)&&(b=!0,AdfLogger.LOGGER.warning("Unable to locate skip link target: "+d+".  Make sure that af:skipLinkTarget is contained within a parent that generates content (and an id).")):b=!0;b&&(a=this._getSkipLinkElement(a))&&(a.style.display="none")};
AdfDhtmlDocumentPeer.prototype._skipToContent=function(){var a=AdfDhtmlDocumentPeer._getSkipLinkTargetId(this.getComponent()),a=AdfAgent.AGENT.getElementById(a);AdfAssert.assertDomElement(a);a=AdfDomUtils.getNextElementMatch(a,null,!1,AdfDhtmlDocumentPeer._isPotentiallyFocusable);AdfAssert.assertDomElement(a);a&&(AdfFocusUtils.isFocusable(a)||(a.tabIndex=-1),AdfFocusUtils.focusElement(a))};
AdfDhtmlDocumentPeer._isPotentiallyFocusable=function(a){if(AdfFocusUtils.isFocusable(a))return!0;var b=!1;switch(a.nodeName.toLowerCase()){case "div":case "span":case "h1":case "h2":case "h3":case "h4":case "h5":case "h6":b=!0}return b?AdfFocusUtils.isConnectedAndVisible(a):!1};AdfDhtmlDocumentPeer.prototype._setDocumentTitle=function(a){(a=a.getTitle())&&this.getDomDocument().title!=a&&(a=this.createCallback(this._delayedSetDocumentTitle),setTimeout(a,0))};
AdfDhtmlDocumentPeer.prototype._delayedSetDocumentTitle=function(){var a=this.getDomDocument(),b=this.getComponent();b&&(a.title=b.getTitle())};AdfDhtmlDocumentPeer.prototype._setUncommittedDataWarning=function(a){a=(a=a.getUncommittedDataWarning())&&"on"==a.toLowerCase();AdfPage.PAGE.__initUncommittedDataWarningForDocument(a)};
AdfDhtmlDocumentPeer.prototype.__showAlertConfirm=function(a,b,d,e,f){AdfAssert.assertString(b,"confirm title");AdfAssert.assertString(d,"confirm message");AdfAssert.assertFunction(e,"confirm callback");f&&AdfAssert.assertNumber(f,"confirm timeout");var g=AdfPage.PAGE,h=AdfAgent.AGENT.getElementById(AdfDhtmlDocumentPeer._ALERT_CONFIRM_DIALOG_CONTAINER_ID);AdfAssert.assertDomElement(h,"DIV");var k=h.getAttribute(AdfDhtmlDocumentPeer._ALERT_CONFIRM_DIALOG_ID_EXPANDO);AdfAssert.assertString(k,"alert/confirm dialog id");
var l=g.findComponent(k);AdfAssert.assertPrototype(l,AdfRichDialog);h=l.getParent();AdfAssert.assertPrototype(h,AdfRichPopup);if(h.isPopupVisible())return!1;l.setTitle(b);AdfDhtmlDocumentPeer._setAlertConfirmMessage(k,d);AdfDhtmlDialogPeer.__setButtonVisible(k,AdfDhtmlDocumentPeer._DIALOG_CANCEL_ID_SUBID,!a);l.addEventListener(AdfDialogEvent.EVENT_TYPE,AdfDhtmlDocumentPeer._alertConfirmCallback);a={callback:e,dialogId:k};f&&(a.timerId=g.scheduleTimer(this,AdfDhtmlDocumentPeer._alertConfirmTimeoutCallback,
k,f));g.setPageProperty(k,a);f={};f[AdfDhtmlPopupHints.ZORDER_SCOPE]=AdfDhtmlPopupHints.ZORDER_SCOPE_BODY;h.show(f);return!0};AdfDhtmlDocumentPeer.prototype._getMessageDialogContainerId=function(){var a=this.getComponent().getClientId();return AdfRichUIPeer.CreateSubId(a,AdfDhtmlDocumentPeer._MESSAGE_DIALOG_CONTAINER_ID)};AdfDhtmlDocumentPeer._alertConfirmTimeoutCallback=function(a){a=AdfPage.PAGE.findComponent(a);var b=a.getPeer();b.bind(a);b.fireCancel()};
AdfDhtmlDocumentPeer._alertConfirmCallback=function(a){a.cancel();var b=a.getSource(),d=b.getClientId(),e=b.getParent();AdfAssert.assertPrototype(e,AdfRichPopup);e.cancel();var e=AdfPage.PAGE,f=e.getPageProperty(d);AdfAssert.assertObject(f,"alert/confirm state token invalid");e.setPageProperty(d,null);f.timerId&&e.cancelTimer(f.timerId);e=f.callback;try{e(a)}catch(g){AdfLogger.LOGGER.logErrorAsWarning(g,"exception caught calling alert/confirm dialog event callback")}b.setTitle("");AdfDhtmlDocumentPeer._setAlertConfirmMessage(d,
"");b.removeEventListener(AdfDialogEvent.EVENT_TYPE,AdfDhtmlDocumentPeer._alertConfirmCallback)};AdfDhtmlDocumentPeer._setAlertConfirmMessage=function(a,b){var d=AdfAgent.AGENT,e=AdfRichUIPeer.createSubId(a,AdfDhtmlDocumentPeer._DIALOG_CONTENT_SUBID),e=d.getElementById(e);AdfAssert.assertDomElement(e,"TD");d.setTextContent(e,b)};