~testplan-team/testplan/source-collection

« back to all changes in this revision

Viewing changes to htmlunit-2.4/src/test/resources/DWR/2.0.5/gi/JSX/js/jsx3/gui/Heavyweight.js

  • Committer: edA-qa mort-ora-y
  • Date: 2010-04-07 10:54:57 UTC
  • Revision ID: eda-qa@disemia.com-20100407105457-g46bvbsrjqtjujab
updating hmltunit src

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2001-2007, TIBCO Software Inc.
3
 
 * Use, modification, and distribution subject to terms of license.
4
 
 */
5
 
jsx3.Class.defineClass("jsx3.gui.Heavyweight",null,null,function(r,q){var O=jsx3.util.Logger.getLogger(r.jsxclass.getName());r.JC={};r.Yp=1;r.DEFAULTZINDEX=32000;q.init=function(f,n){this.ge=f!=null?f:r.getKey();this.sk=n;if(r.JC[this.ge]!=null)r.JC[this.ge].destroy();r.JC[this.ge]=this;};r.getKey=function(){return "jsx_heavyweight_"+r.Yp++;};q.getBody=function(){if(this.sk){var u=this.sk.getDocument();if(u)return u.getElementsByTagName("body")[0];else O.warn("getBody() document of owner of "+this+" is null");}else{O.warn("getBody() owner of "+this+" is null");}return null;};r.GO=function(n){return r.JC[n];};q.show=function(j){var t=this.getId();var L=this.getHTML();if(jsx3.util.strEmpty(L))return;var B=this.getWidth();var J=B==null?"width:100px;":"width:"+B+"px;";var pb=this.getHeight();var R=pb==null?"":"height:"+pb+"px;";var xc="<span id=\""+t+"\" class=\"jsx30block\" style=\"position:absolute;overflow:;"+J+R+"left:0px;top:0px;z-index:"+this.getZIndex()+";visibility:hidden;\">"+L+"</span>";var v=this.getDomParent();jsx3.html.insertAdjacentHTML(v,"beforeEnd",xc);this.applyRatio();this.applyRules("Y");this.applyRules("X");if(j!=false)this.setVisibility(jsx3.gui.Block.VISIBILITYVISIBLE);if(this.sk)this.sk.subscribe(jsx3.gui.Interactive.DESTROY,this,"kv");};q.applyRatio=function(a){var Pb=this.getRendered();if(Pb&&Pb.style){var x=null,xc=null;if(a||!Pb.childNodes[0]){x=Pb.offsetHeight;xc=Pb.offsetWidth;}else{x=Pb.childNodes[0].offsetHeight;xc=Pb.childNodes[0].offsetWidth;}var L=this.getRatio();if(L){xc=parseInt(L*(xc+x));Pb.style.width=xc+"px";Pb.childNodes[0].style.width=xc;if(a!=true){x=Pb.childNodes[0].offsetHeight;Pb.style.height=x+"px";}else{Pb.childNodes[0].style.height=x+"px";}}else{if(a!=true){Pb.style.width=xc+"px";Pb.style.height=x+"px";}}}};q.applyRules=function(o){var S=this.getRendered();var mb=this.getDomParent();if(S==null||mb==null)return;if(o=="X"){var Ob="clientWidth";var gb="left";var ab="width";var tc=S.childNodes[0].offsetWidth;var bb=this.getWidth();}else{var Ob="clientHeight";var gb="top";var ab="height";var tc=S.childNodes[0].offsetHeight;var bb=this.getHeight();}var K=this.getPositionRules()[o].length;var Qb=mb[Ob];var nc=0;for(var F=0;F<K;F++){var Lc=this.getPositionRule(F,o);var Pb=this.getPoint(S,Lc.POINT);if(Lc.PIXEL==null){nc=Qb-tc;}else{nc=Lc.PIXEL+Lc.OFFSET-Pb[o];}if(nc<0||nc+tc>Qb){Lc.VIEWSIZE=nc<0?tc+nc:Qb-nc;Lc.VIEWORIGIN=nc;}else{S.style[gb]=nc+"px";return;}}var M=-1;var t=-1;for(var F=0;F<K;F++){var Lc=this.getPositionRule(F,o);if(M<Lc.VIEWSIZE){M=Lc.VIEWSIZE;t=F;}}var Lc=this.getPositionRule(Math.max(0,t),o);if(Lc!=null){S.style[gb]=Lc.VIEWORIGIN+"px";if(bb==null){S.childNodes[0].style[ab]=Math.max(0,Lc.VIEWSIZE-10)+"px";if(this.getOverflow()==jsx3.gui.Block.OVERFLOWSCROLL)S.childNodes[0].style.overflow="auto";S.style[ab]=Math.max(0,Lc.VIEWSIZE-10)+"px";if(Lc.VIEWORIGIN<0)S.style[gb]="10px";}}};q.hide=function(){var ac=this.getRendered();if(ac!=null)ac.parentNode.removeChild(ac);if(this.sk)this.sk.unsubscribe(jsx3.gui.Interactive.DESTROY,this);};q.kv=function(l){O.trace("onOwnerDestroyed "+l.target.getName());var oc=l.context.objPARENT;var zc=oc.getDocument().getElementById(this.getId());if(zc!=null)zc.parentNode.removeChild(zc);this.sk.unsubscribe(jsx3.gui.Interactive.DESTROY,this);this.sk=null;delete r.JC[this.getId()];this.ge=null;};q.destroy=function(){if(!r.JC[this.ge])return;this.hide();this.sk=null;delete r.JC[this.ge];this.ge=null;};q.getRendered=function(c){var Bc=this.getId();if(Bc==null)return null;var R=null;if(c instanceof jsx3.gui.Event){if(c.exists()&&c.srcElement())R=c.srcElement().ownerDocument;}else{if(c!=null){R=c.getElementById?c:c.ownerDocument;}}if(!R&&this.sk)R=this.sk.getDocument();if(R)return R.getElementById(Bc);else{if(this.sk!=null&&this.sk.getServer()!=null)O.warn("Document of owner of "+this+" is null.");}return null;};q.containsHtmlElement=function(n){var gb=this.getRendered(n);if(gb){while(n!=null){if(gb==n)return true;n=n.parentNode;}}return false;};q.getId=function(){return this.ge;};q._setId=function(a){this.ge=a;};q.getHTML=function(){return this.html;};q.setHTML=function(s,d){this.html=s;if(d){var xb=this.getRendered();if(xb!=null)xb.innerHTML=s;}return this;};q.getDomParent=function(){return this.vu==null?this.getBody():this.vu;};q.setDomParent=function(c){this.vu=c;return this;};q.getRatio=function(){return this.MF;};q.setRatio=function(j){this.MF=j;return this;};q.getOverflow=function(){return this.ix==null?jsx3.gui.Block.OVERFLOWSCROLL:this.ix;};q.setOverflow=function(j){this.ix=j;return this;};q.setVisibility=function(j){var xb=this.getRendered();if(xb)xb.style.visibility=j;return this;};q.getZIndex=function(){return this.tz!=null?this.tz:r.DEFAULTZINDEX;};q.setZIndex=function(e){this.tz=e;return this;};q.getWidth=function(){return this.Ul==null?null:this.Ul;};q.setWidth=function(g){this.Ul=g;return this;};q.getHeight=function(){return this.Ir==null?null:this.Ir;};q.setHeight=function(l){this.Ir=l;return this;};q.addXRule=function(o,n,s,h){var Cc=o instanceof jsx3.gui.Event?o.clientX():this.getPoint(o,n).X;this.addRule(Cc,s,h,"X");return this;};q.addYRule=function(a,i,e,c){var Fc=a instanceof jsx3.gui.Event?a.clientY():this.getPoint(a,i).Y;this.addRule(Fc,e,c,"Y");return this;};q.addRule=function(b,e,c,l){var tc=this.getPositionRules();var sc=tc[l];sc[sc.length]={PIXEL:b,OFFSET:c,POINT:e};return this;};q.getPositionRule=function(f,l){return this.getPositionRules()[l][f];};q.getPositionRules=function(){if(typeof(this.hD)!="object"){this.hD={};this.hD.X=[];this.hD.Y=[];}return this.hD;};q.getPoint=function(n,d){if(typeof(n)=="number")return {X:n,Y:n};var S=null;if(n instanceof jsx3.gui.Block)S=n.getAbsolutePosition(this.getDomParent());else S=jsx3.html.getRelativePosition(this.getDomParent(),n);switch(d){case "N":return {X:S.L+Math.floor(S.W/2),Y:S.T};case "S":return {X:S.L+Math.floor(S.W/2),Y:S.T+S.H};case "E":return {X:S.L+S.W,Y:S.T+Math.floor(S.H/2)};case "W":return {X:S.L,Y:S.T+Math.floor(S.H/2)};case "NE":return {X:S.L+S.W,Y:S.T};case "SE":return {X:S.L+S.W,Y:S.T+S.H};case "SW":return {X:S.L,Y:S.T+S.H};case "NW":return {X:S.L,Y:S.T};case "O":return {X:S.L+Math.floor(S.W/2),Y:S.T+Math.floor(S.H/2)};}};q.toString=function(){var Fb=this.sk?this.sk.getId():null;return "jsx3.gui.Heavyweight "+this.getId()+"/"+Fb;};r.getVersion=function(){return "3.00.00";};});jsx3.Heavyweight=jsx3.gui.Heavyweight;