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_CircularMenuPopupSet(_hDX, _hLN1, _hQZ1){this._hEX=_hDX;this._hXN1=_hLN1;this._hRZ1=_hQZ1||64;};C_CircularMenuPopupSet.prototype.F_Detach=function(){if(this._hDO1){return;}this._hDO1=true;if(this._hXN1&&this._hXN1.F_MenuPopupSet_OnAfterHide){this._hXN1.F_MenuPopupSet_OnAfterHide(this, this._hEX);this._hXN1=null;}if(this._hM31){if(this._hYG1){G_CaptureManager.F_StopCapture();}this._hM31.parentNode.removeChild(this._hM31);this._hM31=null;}this._hZG1=null;};C_CircularMenuPopupSet.prototype.F_ShowMenuPopup=function(_hR31,_hB92,_hJC2){var doc=document;var _hC52=doc.body;var _hR8=G_HAL.M_oLibraries["hal"]["enableAccessibility"];this._hM31=doc.createElement("DIV");this._hM31.style.position="absolute";this._hM31.style.zIndex=10000;_hC52.appendChild(this._hM31);var nl=this._hEX.selectNodes("*/menuItem");this._h0H1=nl.length;var _hCE2=[];var _hDE2=[];var _hGD=0;var _h1G=0;var _h1H1=[];var _hTI=(2.0*Math.PI)/ this._h0H1;for(var _hJU1=0.0;_hJU1<(2*Math.PI);_hJU1+= _hTI){_hCE2.push(Math.round(this._hRZ1*Math.cos(_hJU1)));_hDE2.push(Math.round(this._hRZ1*Math.sin(_hJU1)));}for(var i=0;i<this._h0H1;i++){var _hEO1=nl.item(i);var _hV91=this._hM31.appendChild(doc.createElement("DIV"));_hV91.setAttribute( "tabIndex", "-1" );_hV91.setAttribute( "menuItemId", _hEO1.getAttribute( "id" ) );_hV91.setAttribute( "id", _hEO1.getAttribute( "id" ) );_hV91.style.textAlign="center";var _hSZ1=_hV91.appendChild(doc.createElement("DIV"));var img=_hSZ1.appendChild(doc.createElement("IMG"));img.src=_hEO1.getAttribute("icon");var _hKU1=_hV91.appendChild(doc.createElement("DIV"));_hKU1.className="clsCircularMenuLabel";_hKU1.innerText=G_ResManager.F_GetString(_hEO1.getAttribute("idsLabel"));var _hS31=(0-(_hV91.offsetWidth / 2));var _hW91=(0-(_hV91.offsetHeight / 2));_hV91.style.left=_hS31+"px";_hV91.style.top=_hW91+"px";_hV91.className="clsCircularMenuItem";_hGD=Math.max(_hGD, _hV91.offsetHeight);_h1G=Math.max(_h1G, _hV91.offsetWidth);_h1H1.push(_hV91);}if((_hB92+this._hRZ1+(_h1G / 2))>_hC52.clientWidth){_hB92=Math.F_NonNeg(_hC52.clientWidth-this._hRZ1-(_h1G / 2));}else if(_hB92-(this._hRZ1+(_h1G / 2))<0){_hB92+= this._hRZ1+(_h1G / 2)-_hB92 ;}if((_hJC2+this._hRZ1+(_hGD / 2))>_hC52.clientHeight){_hJC2=Math.F_NonNeg(_hC52.clientHeight-this._hRZ1-(_hGD / 2));}else if(_hJC2-(this._hRZ1+(_hGD / 2))<0){_hJC2+= this._hRZ1+(_hGD / 2)-_hJC2;}this._hM31.style.left=_hB92+"px";this._hM31.style.top=_hJC2+"px";for(var i=0;i<this._h0H1;i++){var _hV91=_h1H1[i];var _hS31=(0-(_hV91.offsetWidth / 2));var _hW91=(0-(_hV91.offsetHeight / 2));var _hUG1="translate(" + ( ( _hCE2[i] - ( _hV91.offsetWidth / 2 ) ) - _hS31 ) + "px," + ( ( _hDE2[i] - ( _hV91.offsetHeight / 2 ) ) - _hW91 ) + "px)";_hV91.style[U_DOM.M_sPrefixedTransform]=_hUG1;}if(_hR8){this._hZG1=_h1H1;_h1H1[0].focus();this._hTA=0;}this._hYG1=true;G_CaptureManager.F_StartCapture({onmousedown:this._hP91.bind(this),onStopCapture:this.onStopCapture.bind(this),onkeydown:_hR8?this._hFX.bind(this):null});};C_CircularMenuPopupSet.prototype._hW=function(_hT31){_hT31=U_DOM.F_GetElementNotInShadowDom(_hT31);if(this._hM31.contains(_hT31)){for(var el=_hT31;el&&(el!=this._hM31);el=el.parentNode){if(el.getAttribute("menuItemId")){return el;}}}return null;};C_CircularMenuPopupSet.prototype.F_GetMenuItem=function(_hX91){return this._hEX.selectSingleNode( ".//menuItem[@id=" + _hX91.F_ToXPathString() + "]" );};C_CircularMenuPopupSet.prototype._hP91=function(e){var _hV91=this._hW(e.target);var _hX91=_hV91?_hV91.getAttribute( "menuItemId" ):"";if(_hX91){var _hFO1=this.F_GetMenuItem(_hX91);var _h2H1=_hFO1.getAttribute("onCommand");if(_h2H1){( new Function( "_hGO1", "_hX91", _h2H1 ) )( e.shiftKey, _hX91 );}if(this._hXN1&&this._hXN1.F_MenuPopupSet_OnMenuItemClick){this._hXN1.F_MenuPopupSet_OnMenuItemClick(this, _hX91);}}G_CaptureManager.F_StopCapture();};C_CircularMenuPopupSet.prototype.onStopCapture=function(){this._hYG1=false;this.F_Detach();};C_CircularMenuPopupSet.prototype._hFX=function(e){switch(e.keyCode){case U_DOM.K_iKeyEnter:U_DOM.F_CancelEvent(e);var _hV91=this._hW(e.target);if(_hV91){U_Accessibility.F_SimulateMouseClick(_hV91, U_DOM.K_iLeftMouseButton, e.ctrlKey, e.shiftKey);}break;case U_DOM.K_iKeyArrowDown:case U_DOM.K_iKeyArrowRight:U_DOM.F_CancelEvent(e);if(++this._hTA==this._h0H1){this._hTA=0;}this._hZG1[this._hTA].focus();break;case U_DOM.K_iKeyArrowUp:case U_DOM.K_iKeyArrowLeft:U_DOM.F_CancelEvent(e);if(--this._hTA<0){this._hTA=this._h0H1-1;}this._hZG1[this._hTA].focus();break;}};
|