/*! * UI development toolkit for HTML5 (OpenUI5) * (c) Copyright 2009-2018 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ sap.ui.predefine('sap/ui/debug/ControlTree',['sap/ui/base/EventProvider','sap/ui/core/Element','sap/ui/core/UIArea','./Highlighter',"sap/ui/dom/getOwnerWindow","sap/base/Log","sap/ui/thirdparty/jquery"],function(E,a,U,H,g,L,q){"use strict"; var C=E.extend("sap.ui.debug.ControlTree",{constructor:function(c,w,p,r){E.apply(this,arguments);this.oWindow=w;this.oDocument=w.document;this.oCore=c;this.oSelectedNode=null;this.oParentDomRef=p;this.oSelectionHighlighter=new H("sap-ui-testsuite-SelectionHighlighter");this.oHoverHighlighter=new H("sap-ui-testsuite-HoverHighlighter",true,'#c8f',1);var t=this;q(p).bind("click",function(e){t.onclick(e);}).bind("mouseover",function(e){t.onmouseover(e);}).bind("mouseout",function(e){t.onmouseout(e);});this.enableInplaceControlSelection();this.oCore.attachUIUpdated(this.renderDelayed,this);this.sSelectedNodeId="";this.sResourcePath=r?sap.ui.require.toUrl("")+"/":(window.top.testfwk.sResourceRoot||"../");this.sTestResourcePath=this.sResourcePath+"../test-resources/";this.sSpaceUrl=this.sResourcePath+"sap/ui/debug/images/space.gif";this.sMinusUrl=this.sResourcePath+"sap/ui/debug/images/minus.gif";this.sPlusUrl=this.sResourcePath+"sap/ui/debug/images/plus.gif";this.sLinkUrl=this.sResourcePath+"sap/ui/debug/images/link.gif";}}); C.M_EVENTS={SELECT:"SELECT"}; C.prototype.exit=function(){q(document).unbind();q(this.oParentDomRef).unbind();}; C.prototype.renderDelayed=function(){if(this.oTimer){this.oWindow.jQuery.sap.clearDelayedCall(this.oTimer);}this.oTimer=this.oWindow.jQuery.sap.delayedCall(0,this,"render");}; C.prototype.render=function(){var d=this.oParentDomRef;var u=null,o=this.oCore.mUIAreas;d.innerHTML="";for(var i in o){var u=o[i],D=this.createTreeNodeDomRef(u.getId(),0,"UIArea",this.sTestResourcePath+"sap/ui/core/images/controls/sap.ui.core.UIArea.gif");d.appendChild(D);var r=u.getContent();for(var i=0,l=r.length;i-1?t.lastIndexOf(".")+1:0);d.innerHTML=" "+s+" - "+i+"";d.style.overflow="hidden";d.style.whiteSpace="nowrap";d.style.textOverflow="ellipsis";d.style.paddingLeft=(l*16)+"px";d.style.height="20px";d.style.cursor="default";d.setAttribute("sap-type",t);d.setAttribute("sap-id",i);d.setAttribute("sap-expanded","true");d.setAttribute("sap-level",""+l);d.title=t+" - "+i;return d;}; C.prototype.createLinkNode=function(p,i,l,t){var d=this.oParentDomRef.ownerDocument.createElement("DIV");d.setAttribute("id","sap-debug-controltreelink-"+i);var s=t?t.substring(t.lastIndexOf(".")>-1?t.lastIndexOf(".")+1:0):"";d.innerHTML=" "+(s?s+" - ":"")+i+"";d.style.overflow="hidden";d.style.whiteSpace="nowrap";d.style.textOverflow="ellipsis";d.style.paddingLeft=(l*16)+"px";d.style.height="20px";d.style.cursor="default";d.setAttribute("sap-type","Link");d.setAttribute("sap-id",i);d.setAttribute("sap-expanded","true");d.setAttribute("sap-level",""+l);d.title="Association to '"+i+"'";p.appendChild(d);return d;}; C.prototype.renderNode=function(d,c,l){if(!c){return;}var m=c.getMetadata();var I=this.sTestResourcePath+m.getLibraryName().replace(/\./g,"/")+"/images/controls/"+m.getName()+".gif";var D=this.createTreeNodeDomRef(c.getId(),l,m.getName(),I);d.appendChild(D);var r=false;if(c.mAggregations){for(var n in c.mAggregations){r=true;var A=c.mAggregations[n];if(A&&A.length){for(var i=0;il){var o=n.getElementsByTagName("IMG")[0];if(b){n.style.display="none";n.setAttribute("sap-expanded","false");if(o&&o.src!==this.sSpaceUrl){o.src=this.sPlusUrl;}}else{n.style.display="block";n.setAttribute("sap-expanded","true");if(o&&o.src!==this.sSpaceUrl){o.src=this.sMinusUrl;}}n=n.nextSibling;if(n){N=parseInt(n.getAttribute("sap-level"),10);}}}if(b){s.src=this.sPlusUrl;p.setAttribute("sap-expanded","false");}else{s.src=this.sMinusUrl;p.setAttribute("sap-expanded","true");}}else{if(s.tagName!="SPAN"){s=s.getElementsByTagName("SPAN")[0];}var p=s.parentNode,i=p.getAttribute("sap-id"),c=this.oCore.byId(i),d=p.getAttribute("sap-type")==="Link"?"sap-debug-controltree-"+i:p.id;this.oSelectionHighlighter.hide();if(c instanceof a){this.oSelectionHighlighter.highlight(c.getDomRef());this.oHoverHighlighter.hide();}this.deselectNode(this.sSelectedNodeId);this.selectNode(d);}}; C.prototype.onmouseover=function(e){var s=e.target;if(s.tagName=="SPAN"){this.oHoverHighlighter.highlight(this.getTargetDomRef(s.parentNode));}}; C.prototype.onmouseout=function(e){var s=e.target;if(s.tagName=="SPAN"){if(this.getTargetDomRef(s.parentNode)){this.oHoverHighlighter.hide();}}}; C.prototype.selectNode=function(i){if(!i){return;}var d=(g(this.oParentDomRef)||window).document.getElementById(i);if(!d){L.warning("Control with Id '"+i.substring(22)+"' not found in tree");return;}var c=d.getAttribute("sap-id");var s=d.getElementsByTagName("SPAN")[0];s.style.backgroundColor="#000066";s.style.color="#FFFFFF";this.sSelectedNodeId=i;this.fireEvent(C.M_EVENTS.SELECT,{id:i,controlId:c});}; C.prototype.deselectNode=function(i){if(!i){return;}var d=(g(this.oParentDomRef)||window).document.getElementById(i);var s=d.getElementsByTagName("SPAN")[0];s.style.backgroundColor="transparent";s.style.color="#000000";this.sSelectedNodeId=i;}; C.prototype.getTargetDomRef=function(t){var T=t.getAttribute("sap-type"),i=t.getAttribute("sap-id"),s=T==="UIArea"?this.oCore.getUIArea(i):this.oCore.byId(i);while(s instanceof a){var d=s.getDomRef();if(d){return d;}s=s.getParent();}if(s instanceof U){return s.getRootNode();}}; C.prototype.enableInplaceControlSelection=function(){var t=this;q(document).bind("mouseover",function(e){t.selectControlInTree(e);});}; C.prototype.selectControlInTree=function(e){if(e){if(e.ctrlKey&&e.shiftKey&&!e.altKey){var c=e.srcElement||e.target;while(c&&(!c.id||!this.oCore.getControl(c.id))){c=c.parentNode;}if(c&&c.id&&this.oCore.getControl(c.id)){this.oHoverHighlighter.highlight(c);}else{this.oHoverHighlighter.hide();}}else{this.oHoverHighlighter.hide();}}}; return C;}); sap.ui.predefine('sap/ui/debug/DebugEnv',['sap/ui/base/Interface','./ControlTree','./LogViewer','./PropertyList',"sap/base/Log","sap/ui/thirdparty/jquery"],function(I,C,L,P,a,q){"use strict";var D=function(){}; D.prototype.startPlugin=function(c,o){this.oCore=c;this.oWindow=window;try{this.bRunsEmbedded=typeof window.top.testfwk=="undefined";a.info("Starting DebugEnv plugin ("+(this.bRunsEmbedded?"embedded":"testsuite")+")");if(!this.bRunsEmbedded||c.getConfiguration().getInspect()){this.init(o);}if(!this.bRunsEmbedded||c.getConfiguration().getTrace()){this.initLogger(a,o);}}catch(e){a.warning("DebugEnv plugin can not be started outside the Testsuite.");}}; D.prototype.stopPlugin=function(){a.info("Stopping DebugEnv plugin.");this.oCore=null;}; D.prototype.init=function(o){this.oControlTreeWindow=this.bRunsEmbedded?this.oWindow:(top.frames["sap-ui-ControlTreeWindow"]||top);this.oPropertyListWindow=this.bRunsEmbedded?this.oWindow:(top.frames["sap-ui-PropertyListWindow"]||top);var r=sap.ui.getCore().getConfiguration().getRTL();var c=this.oControlTreeWindow.document.getElementById("sap-ui-ControlTreeRoot"),p=this.oPropertyListWindow.document.getElementById("sap-ui-PropertyWindowRoot");if(!c){c=this.oControlTreeWindow.document.createElement("DIV");c.setAttribute("id","sap-ui-ControlTreeRoot");c.setAttribute("tabindex",-1);c.style.position="absolute";c.style.fontFamily="Arial";c.style.fontSize="8pt";c.style.backgroundColor="white";c.style.color="black";c.style.border="1px solid gray";c.style.overflow="auto";c.style.zIndex="999999";c.style.top="1px";if(r){c.style.left="1px";}else{c.style.right="1px";}c.style.height="49%";c.style.width="200px";this.oControlTreeWindow.document.body.appendChild(c);}else{c.innerHTML="";}this.oControlTreeRoot=c;if(!p){p=this.oPropertyListWindow.document.createElement("DIV");p.setAttribute("id","sap-ui-PropertyWindowRoot");p.setAttribute("tabindex",-1);p.style.position="absolute";p.style.fontFamily="Arial";p.style.fontSize="8pt";p.style.backgroundColor="white";p.style.color="black";p.style.border="1px solid gray";p.style.overflow="auto";p.style.zIndex="99999";p.style.width="196px";p.style.height="49%";if(r){p.style.left="1px";}else{p.style.right="1px";}p.style.bottom="1px";this.oPropertyListWindow.document.body.appendChild(p);}else{p.innerHTML="";}this.oPropertyWindowRoot=p;this.oControlTree=new C(this.oCore,this.oWindow,c,this.bRunsEmbedded);this.oPropertyList=new P(this.oCore,this.oWindow,p);this.oControlTree.attachEvent(C.M_EVENTS.SELECT,this.oPropertyList.update,this.oPropertyList);if(!o){this.oControlTree.renderDelayed();}q(window).unload(q.proxy(function(e){this.oControlTree.exit();this.oPropertyList.exit();},this));}; D.prototype.initLogger=function(l,o){this.oLogger=l;if(!this.bRunsEmbedded){this.oTraceWindow=top.frames["sap-ui-TraceWindow"];this.oTraceViewer=this.oTraceWindow.oLogViewer=new L(this.oTraceWindow,'sap-ui-TraceWindowRoot');this.oTraceViewer.sLogEntryClassPrefix="lvl";this.oTraceViewer.lock();}else{this.oTraceWindow=this.oWindow;this.oTraceViewer=new L(this.oTraceWindow,'sap-ui-TraceWindowRoot');}this.oLogger.addLogListener(this.oTraceViewer);this.oCore.attachUIUpdated(this.enableLogViewer,this);if(!o){var t=this;this.oTimer=setTimeout(function(){t.enableLogViewer();},0);}}; D.prototype.enableLogViewer=function(){if(this.oTimer){clearTimeout(this.oTimer);this.oTimer=undefined;}this.oCore.detachUIUpdated(this.enableLogViewer,this);if(this.oTraceViewer){this.oTraceViewer.unlock();}}; D.prototype.isRunningEmbedded=function(){return this.bRunsEmbedded;}; D.prototype.isControlTreeShown=function(){return q(this.oControlTreeRoot).css("visibility")==="visible"||q(this.oControlTreeRoot).css("visibility")==="inherit";}; D.prototype.showControlTree=function(){if(!this.oControlTreeRoot){this.init(false);}q(this.oControlTreeRoot).css("visibility","visible");}; D.prototype.hideControlTree=function(){q(this.oControlTreeRoot).css("visibility","hidden");}; D.prototype.isTraceWindowShown=function(){var l=this.oTraceWindow&&this.oTraceWindow.document.getElementById('sap-ui-TraceWindowRoot');return l&&(q(l).css("visibility")==="visible"||q(l).css("visibility")==="inherit");}; D.prototype.showTraceWindow=function(){if(!this.oTraceWindow){this.initLogger(a,false);}var l=this.oTraceWindow&&this.oTraceWindow.document.getElementById('sap-ui-TraceWindowRoot');if(l){q(l).css("visibility","visible");}}; D.prototype.hideTraceWindow=function(){var l=this.oTraceWindow&&this.oTraceWindow.document.getElementById('sap-ui-TraceWindowRoot');if(l){q(l).css("visibility","hidden");}}; D.prototype.isPropertyListShown=function(){return q(this.oPropertyWindowRoot).css("visibility")==="visible"||q(this.oPropertyWindowRoot).css("visibility")==="inherit";}; D.prototype.showPropertyList=function(){if(!this.oPropertyWindowRoot){this.init(false);}q(this.oPropertyWindowRoot).css("visibility","visible");}; D.prototype.hidePropertyList=function(){q(this.oPropertyWindowRoot).css("visibility","hidden");}; (function(){var t=new D();sap.ui.getCore().registerPlugin(t);var i=new I(t,["isRunningEmbedded","isControlTreeShown","showControlTree","hideControlTree","isTraceWindowShown","showTraceWindow","hideTraceWindow","isPropertyListShown","showPropertyList","hidePropertyList"]); D.getInstance=function(){return i;}; }());return D;},true); sap.ui.predefine('sap/ui/debug/Highlighter',["sap/ui/thirdparty/jquery","sap/base/util/uid","sap/ui/dom/jquery/rect"],function(q,u){"use strict";var H=function(i,f,c,b){this.sId=i||u();this.bFilled=(f==true);this.sColor=c||'blue';if(isNaN(b)){this.iBorderWidth=2;}else if(b<=0){this.iBorderWidth=0;}else{this.iBorderWidth=b;}}; H.prototype.highlight=function(d){if(!d||!d.parentNode){return;}var h=(this.sId?window.document.getElementById(this.sId):null);if(!h){h=d.ownerDocument.createElement("DIV");h.setAttribute("id",this.sId);h.style.position="absolute";h.style.border=this.iBorderWidth+"px solid "+this.sColor;h.style.display="none";h.style.margin="0px";h.style.padding="0px";if(this.bFilled){h.innerHTML="
 
";}d.ownerDocument.body.appendChild(h);}var r=q(d).rect();h.style.top=(r.top-this.iBorderWidth)+"px";h.style.left=(r.left-this.iBorderWidth)+"px";h.style.width=(r.width)+"px";h.style.height=(r.height)+"px";h.style.display="block";}; H.prototype.hide=function(){var h=(this.sId?window.document.getElementById(this.sId):null);if(!h){return;}h.style.display="none";}; return H;},true); sap.ui.predefine('sap/ui/debug/LogViewer',function(){"use strict";var L=function(w,r){this.oWindow=w;this.oDomNode=w.document.getElementById(r);if(!this.oDomNode){var d=this.oWindow.document.createElement("DIV");d.setAttribute("id",r);d.style.overflow="auto";d.style.tabIndex="-1";d.style.position="absolute";d.style.bottom="0px";d.style.left="0px";d.style.right="202px";d.style.height="200px";d.style.border="1px solid gray";d.style.fontFamily="Arial monospaced for SAP,monospace";d.style.fontSize="11px";d.style.zIndex="999999";this.oWindow.document.body.appendChild(d);this.oDomNode=d;}this.iLogLevel=3;this.sLogEntryClassPrefix=undefined;this.clear();this.setFilter(L.NO_FILTER);}; L.NO_FILTER=function(l){return true;}; L.prototype.clear=function(){this.oDomNode.innerHTML="";}; L.xmlEscape=function(t){t=t.replace(/\&/g,"&");t=t.replace(/\Type : "+m.getName()+"
");h.push("Id : "+C.getId()+"
");h.push("");if(!this.bEmbedded){h.push("");}h.push("
 
");while(m instanceof ElementMetadata){var P=m.getProperties();var H=false;if(!jQuery.isEmptyObject(P)){if(!H&&m!==C.getMetadata()){h.push("");H=true;}this.printProperties(h,C,P);}var P=this.getAggregationsAsProperties(m);if(!jQuery.isEmptyObject(P)){if(!H&&m!==C.getMetadata()){h.push("");H=true;}this.printProperties(h,C,P);}m=m.getParent();}h.push("
BaseType: ");h.push(m.getName());h.push("
BaseType: ");h.push(m.getName());h.push("
");this.oParentDomRef.innerHTML=h.join("");this.mHelpDocs={};}; PropertyList.prototype.getAggregationsAsProperties=function(m){function i(t){if(!t){return false;}if(t.indexOf("[]")>0){t=t.substring(t.indexOf("[]"));}if(t==="boolean"||t==="string"||t==="int"||t==="float"){return true;}if(t==="void"){return false;}return false;}var r={};for(var a in m.getAggregations()){var A=m.getAggregations()[a];if(A.altTypes&&A.altTypes[0]&&i(A.altTypes[0])){r[a]={name:a,type:A.altTypes[0],_oParent:A._oParent};}}return r;}; PropertyList.prototype.printProperties=function(h,c,p,a){for(var i in p){var N=i,t=p[i].type,m=c["get"+N];if(!m){N=capitalize(N,0);}var v=c["get"+N]();h.push("");this.mProperties[N]=t;h.push("",N,'');h.push("");var T="";if(t=="string"||t=="int"||t=="float"||t.endsWith("[]")){var C='';if(v===null){C='color:#a5a5a5;';v='(null)';}else if(v instanceof Element){C='color:#a5a5a5;';if(Array.isArray(v)){v=v.join(", ");}else{v=v.toString();}T=' title="This aggregation currently references an Element. You can set a '+t+' value instead"';}h.push("");}else if(t=="boolean"){h.push("");}else if(t!="void"){var e=ObjectPath.get(t||"");if(!e||e instanceof DataType){h.push("");}else{h.push("");}}else{h.push(" ");}h.push("");}}; PropertyList.prototype.onkeydown=function(e){if(e.keyCode==13){this.applyChanges("sap-debug-propertylist-apply");}}; PropertyList.prototype.onclick=function(e){var s=e.target;if(s.id=="sap-debug-propertylist-apply"){this.applyChanges("sap-debug-propertylist-apply");}}; PropertyList.prototype.onfocus=function(e){var s=e.target;if(s.tagName==="INPUT"&&s.getAttribute("sap-name")){if(s.style.color==='#a5a5a5'){s.style.color='';s.value='';}}}; PropertyList.prototype.applyChanges=function(sId){var oSource=this.oParentDomRef.ownerDocument.getElementById(sId),sControlId=oSource.getAttribute("sap-id"),oControl=this.oCore.byId(sControlId),aInput=oSource.parentNode.getElementsByTagName("INPUT"),aSelect=oSource.parentNode.getElementsByTagName("SELECT"),oMethod;for(var i=0;iQuickhelp for "+this.sCurrentHelpId+" is being retrieved...";this.sCurrentHelpDoc=this.sCurrentHelpId;this.sCurrentHelpDocPart=undefined;if(this.sCurrentHelpId.indexOf('#')>=0){this.sCurrentHelpDoc=this.sCurrentHelpId.substring(0,this.sCurrentHelpId.indexOf('#'));this.sCurrentHelpDocPart=this.sCurrentHelpId.substring(this.sCurrentHelpId.indexOf('#')+1);}var u=this.oWindow.jQuery.sap.getModulePath(this.sCurrentHelpDoc,".control");var a=this;jQuery.ajax({url:u,dataType:'xml',error:function(x,b){a.receiveQuickHelp(undefined);},success:function(d){a.receiveQuickHelp(d);}});this.oQuickHelpTimer=setTimeout(function(){a.hideQuickHelp();},2000);}}}; PropertyList.prototype.receiveQuickHelp=function(d){if(d){var c=d.getElementsByTagName("control")[0];if(c){var g=function(x,N){var r=[];var C=x.firstChild;while(C){if(N===C.nodeName){r.push(C);}C=C.nextSibling;}return r;};var n=g(c,"name");var N='';if(n[0]){N=n[0].text||n[0].textContent;}var D=g(c,"documentation");if(D[0]){if(N&&D[0]){var a=[];a.push("
",N.replace('/','.'),"
");a.push("
",D[0].text||D[0].textContent,"
");this.mHelpDocs[this.sCurrentHelpDoc]=a.join("");}}var p=g(c,"properties");if(p[0]){p=g(p[0],"property");}for(var i=0,l=p.length;i",N,"");a.push("
Type: ",t,"
");a.push("
",D[0].text||D[0].textContent,"
");a.push("
Default Value: ",s,"
");this.mHelpDocs[this.sCurrentHelpDoc+"#"+N]=a.join("");}}var p=g(c,"aggregations");if(p[0]){p=g(p[0],"aggregation");}for(var i=0,l=p.length;i",N,"");a.push("
Type: ",t,"
");a.push("
",D[0].text||D[0].textContent,"
");a.push("
Default Value: ",s,"
");this.mHelpDocs[this.sCurrentHelpDoc+"#"+N]=a.join("");}}}if(this.mHelpDocs[this.sCurrentHelpId]){this.updateQuickHelp(this.mHelpDocs[this.sCurrentHelpId],2000);}else{this.updateQuickHelp(undefined,0);}}else{this.updateQuickHelp(undefined,0);}}; PropertyList.prototype.updateQuickHelp=function(n,t){if(this.oQuickHelpTimer){clearTimeout(this.oQuickHelpTimer);this.oQuickHelpTimer=undefined;}var T=this.oParentDomRef.ownerDocument.getElementById("sap-ui-quickhelp");if(T){if(!n){T.innerHTML="No quick help...";T.style.display='none';}else{T.innerHTML=n;var a=this;this.oQuickHelpTimer=setTimeout(function(){a.hideQuickHelp();},t);}}}; PropertyList.prototype.hideQuickHelp=function(){var t=this.oParentDomRef.ownerDocument.getElementById("sap-ui-quickhelp");if(t){t.style.display='none';}this.bMovedOverTooltip=false;}; PropertyList.prototype._calcHelpId=function(m,n){var h=m.getName();if(n){h=h+"#"+n;}return h;}; PropertyList.prototype._isChildOfQuickHelp=function(d){while(d){if(d.id==="sap-ui-quickhelp"){return true;}d=d.parentNode;}return false;}; PropertyList.prototype.onmouseover=function(e){var s=e.target;if(this._isChildOfQuickHelp(s)){if(this.oQuickHelpTimer){clearTimeout(this.oQuickHelpTimer);this.oQuickHelpTimer=undefined;}this.bMovedOverTooltip=true;var t=this.oParentDomRef.ownerDocument.getElementById("sap-ui-quickhelp");if(t){t.style.opacity='';t.style.filter='';}}else if(s.getAttribute("data-sap-ui-quickhelp")){this.showQuickHelp(s);}}; PropertyList.prototype.onmouseout=function(e){var s=e.target;if(this._isChildOfQuickHelp(s)){if(this.oQuickHelpTimer){clearTimeout(this.oQuickHelpTimer);this.oQuickHelpTimer=undefined;}this.bMovedOverTooltip=false;var t=this;this.oQuickHelpTimer=setTimeout(function(){t.hideQuickHelp();},50);}else if(s.getAttribute("data-sap-ui-quickhelp")){if(this.oQuickHelpTimer){clearTimeout(this.oQuickHelpTimer);this.oQuickHelpTimer=undefined;}if(!this.bMovedOverTooltip){var t=this;this.oQuickHelpTimer=setTimeout(function(){t.hideQuickHelp();},800);}}}; return PropertyList;}); sap.ui.requireSync("sap/ui/debug/DebugEnv"); //# sourceMappingURL=sap-ui-debug.js.map