123456 |
- // Licensed Materials - Property of IBM
- // IBM Cognos Products: hal
- // (C) Copyright IBM Corp. 2003, 2017.
- // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- function C_ButtonBar(_hB31, _hHG1, _hLN1){this._hI91=G_HAL.M_oLibraries["hal"]["enableAccessibility"];this._hC31=_hB31;this._hC31._hIG1=this;this._hJG1=_hHG1;this._hXN1=_hLN1?_hLN1:null;this._hFZ1=this._hJG1.getAttribute( "guiDirection" )||G_HAL.M_oLibraries["hal"]["defaultGuiDirection"];this._hPM=this._hJG1.getAttribute("textDirection")||this._hFZ1;this._h3X=this._hJG1.getAttribute("skinImageUrl");if(this._h3X){this._h3X="url(" + this._h3X + ")";}this._hS4=( this._hJG1.getAttribute( "orientation" ) != "vertical" );this._hJ91=( this._hJG1.getAttribute( "selectable" ) != "false" );this._hKG1=parseInt(this._hJG1.getAttribute("buttonGap"), 10)||0;this._h4X=parseInt(this._hJG1.getAttribute("buttonHeight"), 10);this._hD31=parseInt(this._hJG1.getAttribute("buttonWidth"), 10);this._hT4=this._hJG1.getAttribute( "buttonHorizontalAlign" )||( this._hS4?"center":"left" );this._hOI=this._hJG1.getAttribute("smallIconHeight");if(!this._hOI){this._hOI="16px";}this._hQM=this._hJG1.getAttribute("smallIconWidth");if(!this._hQM){this._hQM="16px";}this._h392=this._hJG1.getAttribute( "view" )||"report";this._hK91=window["G_ResManager"]?G_ResManager:null;this._hAU1=false;this._hC31.cellPadding=0;this._hC31.cellSpacing=0;this._hC31.className=this._hC31.className||(this._hS4?"clsButtonBarHorizontal":"clsButtonBarVertical");if(this._hFZ1){this._hC31.style.direction=this._hFZ1;}if(!isNaN(this._h4X)){this._hC31.style.height=this._h4X+"px";}this._hTF=G_HAL.M_oLibraries["hal"]["enableHighContrastMode"];this._hPI=( this._hJG1.getAttribute( "resolveIconPath" ) != "false" );if(this._hI91){this._hC31.setAttribute( "role", this._hER?"listbox":"radiogroup" );var _h492=this._hJG1.getAttribute("a11y_name");if(_h492){this._hC31.setAttribute("aria-label", _h492);}this._hUF=U_Accessibility.F_AddAriaHiddenSpan( this._hC31, "aria-describedby", G_ResManager.F_GetString( this._hER?"IDS_HAL_AC_INSTRUCTION_LIST_ITEM_CHECK":"IDS_HAL_AC_INSTRUCTION_LIST_ITEM_RADIO" ) );}this._hHC2();};C_ButtonBar.prototype._h5X=["clsUp", "clsOver", "clsDown", "clsDisabled", "clsUpAndSelected", "clsOverAndSelected", "clsDownAndSelected", "clsDisabledAndSelected"];if(G_HAL.M_oLibraries["hal"]["enableHighContrastMode"]){C_ButtonBar.prototype._h5X=C_ButtonBar.prototype._h5X.concat( "clsHighContrastSelected", "clsHighContrastHover", "clsHighContrastDisabled" );}C_ButtonBar.prototype.F_Detach=function(){if(this._hLG1){this._hLG1.F_Detach();}this._hGZ1=true;this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerover":"onmouseover"]=null;this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerout":"onmouseout"]=null;this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerdown":"onmousedown"]=null;this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerup":"onmouseup"]=null;this._hYN1();this._hC31._hIG1=null;};C_ButtonBar.prototype._hYN1=function(){var nl=this._hC31.getElementsByTagName("TD");var _hBZ1=nl.length;for(var i=0;i<_hBZ1;i++){var td=nl.item(i);if(td.nNode){td.nNode=null;}}U_DOM.F_DeleteTableRows(this._hC31);};C_ButtonBar.prototype.F_GetId=function(){return this._hC31.id;};C_ButtonBar.prototype.F_GetContainer=function(){return this._hC31;};C_ButtonBar.prototype.F_GetButtonBarNode=function(){return this._hJG1;};C_ButtonBar.prototype.F_GetSelectedButton=function(){return this._hJG1.selectSingleNode("buttonBarButton[@selected='true']");};C_ButtonBar.prototype.F_GetSelectedButtons=function(){return this._hJG1.selectNodes("buttonBarButton[@selected='true']");};C_ButtonBar.prototype.F_GetUnselectedButtons=function(){return this._hJG1.selectNodes( "buttonBarButton[not(@selected) or @selected='false']" );};C_ButtonBar.prototype.F_ClearSelections=function(){var _hMG1=this.F_GetSelectedButtons();var _hVF=_hMG1.length;for(var i=0;i<_hVF;i++){this._hL91(_hMG1.item(i), false);}this._h6X();return _hVF;};C_ButtonBar.prototype._hL91=function(_hHZ1,b){if(b){_hHZ1.setAttribute( "selected", "true" );}else{_hHZ1.removeAttribute("selected");}};C_ButtonBar.prototype._hE31=function(_hHZ1,_hF31){if(this._hJ91&&_hHZ1.getAttribute( "selectable" ) != "false" ){this._hL91(_hHZ1, true);}if(_hF31!=false){this._hWF(_hHZ1);}};C_ButtonBar.prototype.F_SelectByValue=function(_h552,_hM91,_hF31){var _hHZ1=C_ButtonBar._hG31(this._hJG1, "value", _h552, _hM91);this.F_SelectButton(_hHZ1, _hF31);};C_ButtonBar.prototype.F_SelectByIndex=function(_h652,_hF31){var _hHZ1=this._hJG1.selectSingleNode( "buttonBarButton[" + ( _h652 + 1 ) + "]" );this.F_SelectButton(_hHZ1, _hF31);};C_ButtonBar.F_FindButton=function(_hHG1,_hNG1,_h552,_hM91){if(_hM91){return _hHG1.selectSingleNode( "buttonBarButton[translate(@" + _hNG1 + ", 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = " + _h552.toLowerCase().F_ToXPathString() + "]" );}return _hHG1.selectSingleNode( "buttonBarButton[@" + _hNG1 + " = " + _h552.F_ToXPathString() + "]" );};C_ButtonBar.prototype.F_FindButton=function(_hNG1,_h552,_hM91){return C_ButtonBar.F_FindButton(this._hJG1, _hNG1, _h552, _hM91);};C_ButtonBar.prototype.F_SelectButton=function(_hHZ1,_hF31){this.F_ClearSelections();if(_hHZ1){this._hE31(_hHZ1, _hF31);if(this._hGZ1){return;}this._h6X();}};C_ButtonBar.prototype._hW2=function(el){var _hBZ1=this._h5X.length;for(var i=0;i<_hBZ1;i++){el.classList.remove(this._h5X[i]);}};C_ButtonBar.prototype._h6X=function(){var d=document;var nl=this.F_GetSelectedButtons();var _hBZ1=nl.length;for(var i=0;i<_hBZ1;i++){var _hHZ1=nl.item(i);var td=d.getElementById(_hHZ1.getAttribute("htmlId"));this._hW2(td);td.classList.add("clsUpAndSelected");if(this._hTF){td.classList.add("clsHighContrastSelected");}}var nl=this.F_GetUnselectedButtons();var _hBZ1=nl.length;for(var i=0;i<_hBZ1;i++){var _hHZ1=nl.item(i);var td=d.getElementById(_hHZ1.getAttribute("htmlId"));this._hW2(td);td.classList.add("clsUp");}if(this._hI91){var _hZN1=this._hJG1.selectNodes("buttonBarButton");for(var i=0;i<_hZN1.length;i++){var _hHZ1=_hZN1.item(i);var el=d.getElementById(_hHZ1.getAttribute("htmlId"));var _h0O1=( _hHZ1.getAttribute( "selected" )=="true" );el.setAttribute( this._hER?"aria-selected":"aria-checked", _h0O1?"true":"false" );el.setAttribute( "tabindex", _h0O1?"0":"-1" );}if(this.F_GetSelectedButtons().length==0){this._hED().setAttribute( "tabindex", "0" );}}};C_ButtonBar.prototype._hHC2=function(){this._hYN1();var nl=this._hJG1.selectNodes("*");var _hBZ1=nl.length;for(var i=0;i<_hBZ1;i++){var n=nl.item(i);switch(n.nodeName){case "buttonBarButton":this._hOG1(n, i==0, i==(_hBZ1-1));break;case "buttonBarSeparator":this._h7X(n);break;}}this.F_SetEnabled(true);};C_ButtonBar.prototype._hOG1=function(_hHZ1,_hBU1,_hIZ1){var _hN91=this._hC31.rows.length;var tr=(!this._hS4||(_hN91==0))?this._hC31.insertRow(_hN91):this._hC31.rows.item(0);tr.className=(this._hKG1||(!this._hS4&&_hBU1&&_hIZ1))?"clsButtonBarGap":"clsButtonBarNoGap";var d=document;var td=tr.appendChild(d.createElement("TD"));td.bIsButtonBarButton=true;if(this._hI91){td.setAttribute( "role", this._hER?"option":"radio" );td.setAttribute( "tabindex", "-1" );}_hHZ1.setAttribute("htmlId", td.uniqueID);td.nNode=_hHZ1;td.className="clsButtonBarButton clsUp";var _hCU1=td.appendChild(d.createElement("DIV"));_hCU1.style.textAlign=(G_BrowserInfo.M_bIsFirefox?"-moz-":"")+this._hT4;var _hDU1=_hCU1.appendChild(d.createElement("TABLE"));_hDU1.className="clsCenteredTable";_hDU1.cellPadding=0;_hDU1.cellSpacing=0;_hDU1.style.height="100%";_hDU1.style.fontSize="1em";U_Accessibility.F_SetRoleForLayoutTable(_hDU1);var _hJZ1=_hDU1.insertRow(0);var _h752=_hJZ1.appendChild(d.createElement("TD"));var _hKZ1=((this._h392=="icon" )?_hDU1.insertRow( _hDU1.rows.length ):_hJZ1 ).appendChild( d.createElement( "TD" ) );_hKZ1.style.textAlign=(G_BrowserInfo.M_bIsFirefox?"-moz-":"")+this._hT4;_h752.style.textAlign=(G_BrowserInfo.M_bIsFirefox?"-moz-":"")+this._hT4;if(this._h392=="smallIcon"){_hKZ1.style.display="none";}var _hPG1=_hHZ1.getAttribute("smallIcon");if(_hPG1){var _h592=_h752.appendChild(d.createElement("IMG"));_h592.style.height=this._hOI;_h592.style.width=this._hQM;_h592.src=this._hPI?G_HAL.F_GetImageURL(_hPG1):_hPG1;_h592.style.verticalAlign="middle";_h592.style.margin=( this._h392=="smallIcon" )?"0px":"0px 3px 0px 0px";}var _h1O1=_hKZ1.appendChild(d.createElement("SPAN"));_h1O1.className="clsButtonBarButtonLabel";_h1O1.style.verticalAlign="middle";td.style.whiteSpace="nowrap";_hCU1.style.whiteSpace="nowrap";_h752.style.whiteSpace="nowrap";_hKZ1.style.whiteSpace="nowrap";if(this._h3X){_hCU1.style.backgroundImage=this._h3X;}_hCU1.className=_hBU1?"clsInnerFirst":( _hIZ1?"clsInnerLast":"clsInner" );this._hQG1(_hHZ1, _h1O1);var _h2O1=_hHZ1.getAttribute("textDirection")||this._hPM;if(_h2O1){_h1O1.style.direction=_h2O1;_h1O1.style.unicodeBidi="embed";}if(this._hKG1&&!_hBU1){td.style[this._hS4?"paddingLeft":"paddingTop"] = this._hKG1 + "px";}if(!isNaN(this._h4X)){_hCU1.style.height=this._h4X+"px";}var _hH31=parseInt(_hHZ1.getAttribute("buttonWidth"), 10)||this._hD31;if(!isNaN(_hH31)){td.style["minWidth"] = Math.F_NonNeg( _hH31 ) + "px";}};C_ButtonBar.prototype._hQG1=function(_hHZ1,el){var _h052="";var _hEU1=_hHZ1.getAttribute("idsLabel");if(_hEU1){G_HAL.F_VerifyDependencies("G_ResManager");_h052=this._hK91.F_GetString(_hEU1);}else{_h052=_hHZ1.getAttribute("label");}if(_h052!=null){el.innerText=_h052;if(this._hI91){el.setAttribute("aria-label", _h052);}}};C_ButtonBar.prototype._h7X=function(_hHZ1){};C_ButtonBar.prototype.F_SetEnabled=function(_hFU1){if(_hFU1==this._hAU1){return;}this._hAU1=_hFU1;if(_hFU1){if(G_BrowserInfo.M_bIsTouchDevice&&G_HAL.M_oLibraries["hal"]["enableFastClick"]){this._hLG1=new C_FastClick(this._hC31, this._hI31.bind(this));}else{this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerover":"onmouseover"]=this._hO91.bind(this);this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerout":"onmouseout"]=this._hRG1.bind(this);this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerdown":"onmousedown"]=this._hP91.bind(this);this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerup":"onmouseup"]=this._h3O1.bind(this);if(this._hI91){this._hC31.onkeydown=this._h4O1.bind(this);}}}else{if(this._hLG1){this._hLG1.F_Detach();this._hLG1=null;}this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerover":"onmouseover"]=null;this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerout":"onmouseout"]=null;this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerdown":"onmousedown"]=null;this._hC31[G_BrowserInfo.M_bIsPointerEnabled?"onpointerup":"onmouseup"]=null;if(this._hI91){this._hC31.onkeydown=null;}}U_DOM.F_SetTextEnabled(this._hC31, _hFU1);this._h6X();};C_ButtonBar.prototype._hP8=function(_hLZ1){if(this._hC31.contains(_hLZ1)){for(;_hLZ1&&(_hLZ1!=this._hC31);_hLZ1=_hLZ1.parentNode){if(_hLZ1.bIsButtonBarButton){return _hLZ1;}}}return null;};C_ButtonBar.prototype._hO91=function(e){var td=this._hP8(e.target);if(td){if(td.contains(e.fromElement)){return;}var _hHZ1=td.nNode;var _h0O1=( _hHZ1.getAttribute( "selected" )=="true" );this._hW2(td);td.classList.add(_h0O1?"clsOverAndSelected":"clsOver");if(this._hTF){td.classList.add(_h0O1?"clsHighContrastSelected":"clsHighContrastHover");}}};C_ButtonBar.prototype._hRG1=function(e){var td=this._hP8(e.target);if(td){if(td.contains(e.relatedTarget)){return;}var _hHZ1=td.nNode;var _h0O1=( _hHZ1.getAttribute( "selected" )=="true" );this._hW2(td);td.classList.add(_h0O1?"clsUpAndSelected":"clsUp");if(this._hTF&&_h0O1){td.classList.add("clsHighContrastSelected");}}};C_ButtonBar.prototype._hI31=function(_h692){var td=this._hP8(_h692);if(td){this._hS6(td.nNode);}};C_ButtonBar.prototype._hP91=function(e){var td=this._hP8(e.target);if(td){var _hHZ1=td.nNode;if(G_HAL.M_oTestListener&&G_HAL.M_oTestListener.F_TestListener_ButtonBarOnMouseDown){G_HAL.M_oTestListener.F_TestListener_ButtonBarOnMouseDown(e, this, _hHZ1);}var _h0O1=( _hHZ1.getAttribute( "selected" )=="true" );this._hW2(td);td.classList.add(_h0O1?"clsDownAndSelected":"clsDown");if(this._hTF){td.classList.add(_h0O1?"clsHighContrastSelected":"clsHighContrastHover");}this._hS6(_hHZ1);}};C_ButtonBar.prototype._hS6=function(_hHZ1){this.F_SelectButton(_hHZ1);};C_ButtonBar.prototype._h3O1=function(e){var td=this._hP8(e.target);if(td){var _hHZ1=td.nNode;var _h0O1=( _hHZ1.getAttribute( "selected" )=="true" );this._hW2(td);td.classList.add(_h0O1?"clsOverAndSelected":"clsOver");if(this._hTF){td.classList.add(_h0O1?"clsHighContrastSelected":"clsHighContrastHover");}}};C_ButtonBar.prototype._hWF=function(_hHZ1){if(this._hXN1&&this._hXN1.F_ButtonBar_OnButtonClick){this._hXN1.F_ButtonBar_OnButtonClick(this, _hHZ1);}};C_ButtonBar.prototype._h4O1=function(e){var d=document;var _h692=e.target;switch(e.keyCode){case U_DOM.K_iKeyArrowUp:case U_DOM.K_iKeyArrowLeft:if(_h692.bIsButtonBarButton){var _h5O1=this._hXF(_h692.nNode);if(_h5O1){d.getElementById(_h5O1.getAttribute("htmlId")).focus();}}else{this._hED().focus();}U_DOM.F_CancelEvent(e);break;case U_DOM.K_iKeyArrowDown:case U_DOM.K_iKeyArrowRight:if(_h692.bIsButtonBarButton){var _h792=this._h8X(_h692.nNode);if(_h792){d.getElementById(_h792.getAttribute("htmlId")).focus();}}else{this._hED().focus();}U_DOM.F_CancelEvent(e);break;case U_DOM.K_iKeyPgUp:case U_DOM.K_iKeyHome:this._hED().focus();U_DOM.F_CancelEvent(e);break;case U_DOM.K_iKeyPgDn:case U_DOM.K_iKeyEnd:d.getElementById( this._hJG1.selectSingleNode( "buttonBarButton[last()]" ).getAttribute( "htmlId" ) ).focus();U_DOM.F_CancelEvent(e);break;case U_DOM.K_iKeySpace:case U_DOM.K_iKeyEnter:U_DOM.F_CancelEvent(e);U_Accessibility.F_SimulateMouseClick(_h692, U_DOM.K_iLeftMouseButton, e.ctrlKey, e.shiftKey, false);break;}};C_ButtonBar.prototype._hED=function(){return document.getElementById( this._hJG1.selectSingleNode( "buttonBarButton" ).getAttribute( "htmlId" ) );};C_ButtonBar.prototype._h8X=function(_hHZ1){return _hHZ1.selectSingleNode("following-sibling::buttonBarButton");};C_ButtonBar.prototype._hXF=function(_hHZ1){return _hHZ1.selectSingleNode("preceding-sibling::buttonBarButton[1]");};
|