<\/div>';}
function _mkDivIe(x,y,w,h)
{this.htm+='%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';}
function _mkDivPrt(x,y,w,h)
{this.htm+='
<\/div>';}
var _regex=/%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;function _htmRpc()
{return this.htm.replace(_regex,'
\n');}
function _htmPrtRpc()
{return this.htm.replace(_regex,'
\n');}
function _mkLin(x1,y1,x2,y2)
{if(x1>x2)
{var _x2=x2;var _y2=y2;x2=x1;y2=y1;x1=_x2;y1=_y2;}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1;if(dx>=dy)
{var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;while(dx>0)
{--dx;++x;if(p>0)
{this._mkDiv(ox,y,x-ox,1);y+=yIncr;p+=pru;ox=x;}
else p+=pr;}
this._mkDiv(ox,y,x2-ox+1,1);}
else
{var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;if(y2<=y1)
{while(dy>0)
{--dy;if(p>0)
{this._mkDiv(x++,y,1,oy-y+1);y+=yIncr;p+=pru;oy=y;}
else
{y+=yIncr;p+=pr;}}
this._mkDiv(x2,y2,1,oy-y2+1);}
else
{while(dy>0)
{--dy;y+=yIncr;if(p>0)
{this._mkDiv(x++,oy,1,y-oy);p+=pru;oy=y;}
else p+=pr;}
this._mkDiv(x2,oy,1,y2-oy+1);}}}
function _mkLin2D(x1,y1,x2,y2)
{if(x1>x2)
{var _x2=x2;var _y2=y2;x2=x1;y2=y1;x1=_x2;y1=_y2;}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1;var s=this.stroke;if(dx>=dy)
{if(dx>0&&s-3>0)
{var _s=(s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy)/dx;_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;}
else var _s=s;var ad=Math.ceil(s/2);var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;while(dx>0)
{--dx;++x;if(p>0)
{this._mkDiv(ox,y,x-ox+ad,_s);y+=yIncr;p+=pru;ox=x;}
else p+=pr;}
this._mkDiv(ox,y,x2-ox+ad+1,_s);}
else
{if(s-3>0)
{var _s=(s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy)/dy;_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1;}
else var _s=s;var ad=Math.round(s/2);var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;if(y2<=y1)
{++ad;while(dy>0)
{--dy;if(p>0)
{this._mkDiv(x++,y,_s,oy-y+ad);y+=yIncr;p+=pru;oy=y;}
else
{y+=yIncr;p+=pr;}}
this._mkDiv(x2,y2,_s,oy-y2+ad);}
else
{while(dy>0)
{--dy;y+=yIncr;if(p>0)
{this._mkDiv(x++,oy,_s,y-oy+ad);p+=pru;oy=y;}
else p+=pr;}
this._mkDiv(x2,oy,_s,y2-oy+ad+1);}}}
function _mkLinDott(x1,y1,x2,y2)
{if(x1>x2)
{var _x2=x2;var _y2=y2;x2=x1;y2=y1;x1=_x2;y1=_y2;}
var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1,drw=true;if(dx>=dy)
{var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx;while(dx>0)
{--dx;if(drw)this._mkDiv(x,y,1,1);drw=!drw;if(p>0)
{y+=yIncr;p+=pru;}
else p+=pr;++x;}}
else
{var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy;while(dy>0)
{--dy;if(drw)this._mkDiv(x,y,1,1);drw=!drw;y+=yIncr;if(p>0)
{++x;p+=pru;}
else p+=pr;}}
if(drw)this._mkDiv(x,y,1,1);}
function _mkOv(left,top,width,height)
{var a=(++width)>>1,b=(++height)>>1,wod=width&1,hod=height&1,cx=left+a,cy=top+b,x=0,y=b,ox=0,oy=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),w,h;while(y>0)
{if(st<0)
{st+=bb2*((x<<1)+3);tt+=bb4*(++x);}
else if(tt<0)
{st+=bb2*((x<<1)+3)-aa4*(y-1);tt+=bb4*(++x)-aa2*(((y--)<<1)-3);w=x-ox;h=oy-y;if((w&2)&&(h&2))
{this._mkOvQds(cx,cy,x-2,y+2,1,1,wod,hod);this._mkOvQds(cx,cy,x-1,y+1,1,1,wod,hod);}
else this._mkOvQds(cx,cy,x-1,oy,w,h,wod,hod);ox=x;oy=y;}
else
{tt-=aa2*((y<<1)-3);st-=aa4*(--y);}}
w=a-ox+1;h=(oy<<1)+hod;y=cy-oy;this._mkDiv(cx-a,y,w,h);this._mkDiv(cx+ox+wod-1,y,w,h);}
function _mkOv2D(left,top,width,height)
{var s=this.stroke;width+=s+1;height+=s+1;var a=width>>1,b=height>>1,wod=width&1,hod=height&1,cx=left+a,cy=top+b,x=0,y=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1);if(s-4<0&&(!(s-2)||width-51>0&&height-51>0))
{var ox=0,oy=b,w,h,pxw;while(y>0)
{if(st<0)
{st+=bb2*((x<<1)+3);tt+=bb4*(++x);}
else if(tt<0)
{st+=bb2*((x<<1)+3)-aa4*(y-1);tt+=bb4*(++x)-aa2*(((y--)<<1)-3);w=x-ox;h=oy-y;if(w-1)
{pxw=w+1+(s&1);h=s;}
else if(h-1)
{pxw=s;h+=1+(s&1);}
else pxw=h=s;this._mkOvQds(cx,cy,x-1,oy,pxw,h,wod,hod);ox=x;oy=y;}
else
{tt-=aa2*((y<<1)-3);st-=aa4*(--y);}}
this._mkDiv(cx-a,cy-oy,s,(oy<<1)+hod);this._mkDiv(cx+a+wod-s,cy-oy,s,(oy<<1)+hod);}
else
{var _a=(width-(s<<1))>>1,_b=(height-(s<<1))>>1,_x=0,_y=_b,_aa2=(_a*_a)<<1,_aa4=_aa2<<1,_bb2=(_b*_b)<<1,_bb4=_bb2<<1,_st=(_aa2>>1)*(1-(_b<<1))+_bb2,_tt=(_bb2>>1)-_aa2*((_b<<1)-1),pxl=new Array(),pxt=new Array(),_pxb=new Array();pxl[0]=0;pxt[0]=b;_pxb[0]=_b-1;while(y>0)
{if(st<0)
{pxl[pxl.length]=x;pxt[pxt.length]=y;st+=bb2*((x<<1)+3);tt+=bb4*(++x);}
else if(tt<0)
{pxl[pxl.length]=x;st+=bb2*((x<<1)+3)-aa4*(y-1);tt+=bb4*(++x)-aa2*(((y--)<<1)-3);pxt[pxt.length]=y;}
else
{tt-=aa2*((y<<1)-3);st-=aa4*(--y);}
if(_y>0)
{if(_st<0)
{_st+=_bb2*((_x<<1)+3);_tt+=_bb4*(++_x);_pxb[_pxb.length]=_y-1;}
else if(_tt<0)
{_st+=_bb2*((_x<<1)+3)-_aa4*(_y-1);_tt+=_bb4*(++_x)-_aa2*(((_y--)<<1)-3);_pxb[_pxb.length]=_y-1;}
else
{_tt-=_aa2*((_y<<1)-3);_st-=_aa4*(--_y);_pxb[_pxb.length-1]--;}}}
var ox=-wod,oy=b,_oy=_pxb[0],l=pxl.length,w,h;for(var i=0;i
>1,b=(++height)>>1,wod=width&1,hod=height&1,hodu=hod^1,cx=left+a,cy=top+b,x=0,y=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),drw=true;while(y>0)
{if(st<0)
{st+=bb2*((x<<1)+3);tt+=bb4*(++x);}
else if(tt<0)
{st+=bb2*((x<<1)+3)-aa4*(y-1);tt+=bb4*(++x)-aa2*(((y--)<<1)-3);}
else
{tt-=aa2*((y<<1)-3);st-=aa4*(--y);}
if(drw&&y>=hodu)this._mkOvQds(cx,cy,x,y,1,1,wod,hod);drw=!drw;}}
function _mkRect(x,y,w,h)
{var s=this.stroke;this._mkDiv(x,y,w,s);this._mkDiv(x+w,y,s,h);this._mkDiv(x,y+h,w+s,s);this._mkDiv(x,y+s,s,h-s);}
function _mkRectDott(x,y,w,h)
{this.drawLine(x,y,x+w,y);this.drawLine(x+w,y,x+w,y+h);this.drawLine(x,y+h,x+w,y+h);this.drawLine(x,y,x,y+h);}
function jsgFont()
{this.PLAIN='font-weight:normal;';this.BOLD='font-weight:bold;';this.ITALIC='font-style:italic;';this.ITALIC_BOLD=this.ITALIC+this.BOLD;this.BOLD_ITALIC=this.ITALIC_BOLD;}
var Font=new jsgFont();function jsgStroke()
{this.DOTTED=-1;}
var Stroke=new jsgStroke();function jsGraphics(cnv,wnd)
{this.setColor=function(x)
{this.color=x.toLowerCase();};this.setStroke=function(x)
{this.stroke=x;if(!(x+1))
{this.drawLine=_mkLinDott;this._mkOv=_mkOvDott;this.drawRect=_mkRectDott;}
else if(x-1>0)
{this.drawLine=_mkLin2D;this._mkOv=_mkOv2D;this.drawRect=_mkRect;}
else
{this.drawLine=_mkLin;this._mkOv=_mkOv;this.drawRect=_mkRect;}};this.setPrintable=function(arg)
{this.printable=arg;if(jg_fast)
{this._mkDiv=_mkDivIe;this._htmRpc=arg?_htmPrtRpc:_htmRpc;}
else this._mkDiv=arg?_mkDivPrt:_mkDiv;};this.setFont=function(fam,sz,sty)
{this.ftFam=fam;this.ftSz=sz;this.ftSty=sty||Font.PLAIN;};this.drawPolyline=this.drawPolyLine=function(x,y)
{for(var i=x.length-1;i;)
{--i;this.drawLine(x[i],y[i],x[i+1],y[i+1]);}};this.fillRect=function(x,y,w,h)
{this._mkDiv(x,y,w,h);};this.drawPolygon=function(x,y)
{this.drawPolyline(x,y);this.drawLine(x[x.length-1],y[x.length-1],x[0],y[0]);};this.drawEllipse=this.drawOval=function(x,y,w,h)
{this._mkOv(x,y,w,h);};this.fillEllipse=this.fillOval=function(left,top,w,h)
{var a=w>>1,b=h>>1,wod=w&1,hod=h&1,cx=left+a,cy=top+b,x=0,y=b,oy=b,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),xl,dw,dh;if(w)while(y>0)
{if(st<0)
{st+=bb2*((x<<1)+3);tt+=bb4*(++x);}
else if(tt<0)
{st+=bb2*((x<<1)+3)-aa4*(y-1);xl=cx-x;dw=(x<<1)+wod;tt+=bb4*(++x)-aa2*(((y--)<<1)-3);dh=oy-y;this._mkDiv(xl,cy-oy,dw,dh);this._mkDiv(xl,cy+y+hod,dw,dh);oy=y;}
else
{tt-=aa2*((y<<1)-3);st-=aa4*(--y);}}
this._mkDiv(cx-a,cy-oy,w,(oy<<1)+hod);};this.fillArc=function(iL,iT,iW,iH,fAngA,fAngZ)
{var a=iW>>1,b=iH>>1,iOdds=(iW&1)|((iH&1)<<16),cx=iL+a,cy=iT+b,x=0,y=b,ox=x,oy=y,aa2=(a*a)<<1,aa4=aa2<<1,bb2=(b*b)<<1,bb4=bb2<<1,st=(aa2>>1)*(1-(b<<1))+bb2,tt=(bb2>>1)-aa2*((b<<1)-1),xEndA,yEndA,xEndZ,yEndZ,iSects=(1<<(Math.floor((fAngA%=360.0)/180.0)<<3))|(2<<(Math.floor((fAngZ%=360.0)/180.0)<<3))|((fAngA>=fAngZ)<<16),aBndA=new Array(b+1),aBndZ=new Array(b+1);fAngA*=Math.PI/180.0;fAngZ*=Math.PI/180.0;xEndA=cx+Math.round(a*Math.cos(fAngA));yEndA=cy+Math.round(-b*Math.sin(fAngA));_mkLinVirt(aBndA,cx,cy,xEndA,yEndA);xEndZ=cx+Math.round(a*Math.cos(fAngZ));yEndZ=cy+Math.round(-b*Math.sin(fAngZ));_mkLinVirt(aBndZ,cx,cy,xEndZ,yEndZ);while(y>0)
{if(st<0)
{st+=bb2*((x<<1)+3);tt+=bb4*(++x);}
else if(tt<0)
{st+=bb2*((x<<1)+3)-aa4*(y-1);ox=x;tt+=bb4*(++x)-aa2*(((y--)<<1)-3);this._mkArcDiv(ox,y,oy,cx,cy,iOdds,aBndA,aBndZ,iSects);oy=y;}
else
{tt-=aa2*((y<<1)-3);st-=aa4*(--y);if(y&&(aBndA[y]!=aBndA[y-1]||aBndZ[y]!=aBndZ[y-1]))
{this._mkArcDiv(x,y,oy,cx,cy,iOdds,aBndA,aBndZ,iSects);ox=x;oy=y;}}}
this._mkArcDiv(x,0,oy,cx,cy,iOdds,aBndA,aBndZ,iSects);if(iOdds>>16)
{if(iSects>>16)
{var xl=(yEndA<=cy||yEndZ>cy)?(cx-x):cx;this._mkDiv(xl,cy,x+cx-xl+(iOdds&0xffff),1);}
else if((iSects&0x01)&&yEndZ>cy)
this._mkDiv(cx-x,cy,x,1);}};this.fillPolygon=function(array_x,array_y)
{var i;var y;var miny,maxy;var x1,y1;var x2,y2;var ind1,ind2;var ints;var n=array_x.length;if(!n)return;miny=array_y[0];maxy=array_y[0];for(i=1;imaxy)
maxy=array_y[i];}
for(y=miny;y<=maxy;y++)
{var polyInts=new Array();ints=0;for(i=0;iy2)
{y2=array_y[ind1];y1=array_y[ind2];x2=array_x[ind1];x1=array_x[ind2];}
else continue;if((y>=y1)&&(yy1)&&(y<=y2))
polyInts[ints++]=Math.round((y-y1)*(x2-x1)/(y2-y1)+x1);}
polyInts.sort(_CompInt);for(i=0;i'+
txt+'<\/div>';};this.drawStringRect=function(txt,x,y,width,height,halign,cls)
{var classBk=typeof(cls)!='undefined'?'class="'+cls+'" ':'';this.htm+=''+'
'+txt+'<\/span>'+'<\/div>';};this.drawImage=function(imgSrc,x,y,w,h,a)
{this.htm+=''+'

'+'<\/div>';};this.clear=function()
{this.htm="";if(this.cnv)this.cnv.innerHTML="";};this._mkOvQds=function(cx,cy,x,y,w,h,wod,hod)
{var xl=cx-x,xr=cx+x+wod-w,yt=cy-y,yb=cy+y+hod-h;if(xr>xl+w)
{this._mkDiv(xr,yt,w,h);this._mkDiv(xr,yb,w,h);}
else
w=xr-xl+w;this._mkDiv(xl,yt,w,h);this._mkDiv(xl,yb,w,h);};this._mkArcDiv=function(x,y,oy,cx,cy,iOdds,aBndA,aBndZ,iSects)
{var xrDef=cx+x+(iOdds&0xffff),y2,h=oy-y,xl,xr,w;if(!h)h=1;x=cx-x;if(iSects&0xff0000)
{y2=cy-y-h;if(iSects&0x00ff)
{if(iSects&0x02)
{xl=Math.max(x,aBndZ[y]);w=xrDef-xl;if(w>0)this._mkDiv(xl,y2,w,h);}
if(iSects&0x01)
{xr=Math.min(xrDef,aBndA[y]);w=xr-x;if(w>0)this._mkDiv(x,y2,w,h);}}
else
this._mkDiv(x,y2,xrDef-x,h);y2=cy+y+(iOdds>>16);if(iSects&0xff00)
{if(iSects&0x0100)
{xl=Math.max(x,aBndA[y]);w=xrDef-xl;if(w>0)this._mkDiv(xl,y2,w,h);}
if(iSects&0x0200)
{xr=Math.min(xrDef,aBndZ[y]);w=xr-x;if(w>0)this._mkDiv(x,y2,w,h);}}
else
this._mkDiv(x,y2,xrDef-x,h);}
else
{if(iSects&0x00ff)
{if(iSects&0x02)
xl=Math.max(x,aBndZ[y]);else
xl=x;if(iSects&0x01)
xr=Math.min(xrDef,aBndA[y]);else
xr=xrDef;y2=cy-y-h;w=xr-xl;if(w>0)this._mkDiv(xl,y2,w,h);}
if(iSects&0xff00)
{if(iSects&0x0100)
xl=Math.max(x,aBndA[y]);else
xl=x;if(iSects&0x0200)
xr=Math.min(xrDef,aBndZ[y]);else
xr=xrDef;y2=cy+y+(iOdds>>16);w=xr-xl;if(w>0)this._mkDiv(xl,y2,w,h);}}};this.setStroke(1);this.setFont("verdana,geneva,helvetica,sans-serif","12px",Font.PLAIN);this.color="#000000";this.htm="";this.wnd=wnd||window;if(!jg_ok)_chkDHTM(this.wnd);if(jg_ok)
{if(cnv)
{if(typeof(cnv)=="string")
this.cont=document.all?(this.wnd.document.all[cnv]||null):document.getElementById?(this.wnd.document.getElementById(cnv)||null):null;else if(cnv==window.document)
this.cont=document.getElementsByTagName("body")[0];else this.cont=cnv;this.cnv=this.wnd.document.createElement("div");this.cnv.style.fontSize=0;this.cont.appendChild(this.cnv);this.paint=jg_dom?_pntCnvDom:_pntCnvIe;}
else
this.paint=_pntDoc;}
else
this.paint=_pntN;this.setPrintable(false);}
function _mkLinVirt(aLin,x1,y1,x2,y2)
{var dx=Math.abs(x2-x1),dy=Math.abs(y2-y1),x=x1,y=y1,xIncr=(x1>x2)?-1:1,yIncr=(y1>y2)?-1:1,p,i=0;if(dx>=dy)
{var pr=dy<<1,pru=pr-(dx<<1);p=pr-dx;while(dx>0)
{--dx;if(p>0)
{aLin[i++]=x;y+=yIncr;p+=pru;}
else p+=pr;x+=xIncr;}}
else
{var pr=dx<<1,pru=pr-(dy<<1);p=pr-dy;while(dy>0)
{--dy;y+=yIncr;aLin[i++]=x;if(p>0)
{x+=xIncr;p+=pru;}
else p+=pr;}}
for(var len=aLin.length,i=len-i;i;)
aLin[len-(i--)]=x;};function _CompInt(x,y)
{return(x-y);}
var MooTools={version:'1.11'};function $defined(obj){return(obj!=undefined);};function $type(obj){if(!$defined(obj))return false;if(obj.htmlElement)return'element';var type=typeof obj;if(type=='object'&&obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}}
if(type=='object'||type=='function'){switch(obj.constructor){case Array:return'array';case RegExp:return'regexp';case Class:return'class';}
if(typeof obj.length=='number'){if(obj.item)return'collection';if(obj.callee)return'arguments';}}
return type;};function $merge(){var mix={};for(var i=0;i
-1:this.indexOf(string)>-1;},escapeRegExp:function(){return this.replace(/([.*+?^${}()|[\]\/\\])/g,'\\$1');}});Array.extend({rgbToHex:function(array){if(this.length<3)return false;if(this.length==4&&this[3]==0&&!array)return'transparent';var hex=[];for(var i=0;i<3;i++){var bit=(this[i]-0).toString(16);hex.push((bit.length==1)?'0'+bit:bit);}
return array?hex:'#'+hex.join('');},hexToRgb:function(array){if(this.length!=3)return false;var rgb=[];for(var i=0;i<3;i++){rgb.push(parseInt((this[i].length==1)?this[i]+this[i]:this[i],16));}
return array?rgb:'rgb('+rgb.join(',')+')';}});Function.extend({create:function(options){var fn=this;options=$merge({'bind':fn,'event':false,'arguments':null,'delay':false,'periodical':false,'attempt':false},options);if($chk(options.arguments)&&$type(options.arguments)!='array')options.arguments=[options.arguments];return function(event){var args;if(options.event){event=event||window.event;args=[(options.event===true)?event:new options.event(event)];if(options.arguments)args.extend(options.arguments);}
else args=options.arguments||arguments;var returns=function(){return fn.apply($pick(options.bind,fn),args);};if(options.delay)return setTimeout(returns,options.delay);if(options.periodical)return setInterval(returns,options.periodical);if(options.attempt)try{return returns();}catch(err){return false;};return returns();};},pass:function(args,bind){return this.create({'arguments':args,'bind':bind});},attempt:function(args,bind){return this.create({'arguments':args,'bind':bind,'attempt':true})();},bind:function(bind,args){return this.create({'bind':bind,'arguments':args});},bindAsEventListener:function(bind,args){return this.create({'bind':bind,'event':true,'arguments':args});},delay:function(delay,bind,args){return this.create({'delay':delay,'bind':bind,'arguments':args})();},periodical:function(interval,bind,args){return this.create({'periodical':interval,'bind':bind,'arguments':args})();}});Number.extend({toInt:function(){return parseInt(this);},toFloat:function(){return parseFloat(this);},limit:function(min,max){return Math.min(max,Math.max(min,this));},round:function(precision){precision=Math.pow(10,precision||0);return Math.round(this*precision)/precision;},times:function(fn){for(var i=0;i';}
el=document.createElement(el);}
el=$(el);return(!props||!el)?el:el.set(props);}});var Elements=new Class({initialize:function(elements){return(elements)?$extend(elements,this):this;}});Elements.extend=function(props){for(var prop in props){this.prototype[prop]=props[prop];this[prop]=$native.generic(prop);}};function $(el){if(!el)return null;if(el.htmlElement)return Garbage.collect(el);if([window,document].contains(el))return el;var type=$type(el);if(type=='string'){el=document.getElementById(el);type=(el)?'element':false;}
if(type!='element')return null;if(el.htmlElement)return Garbage.collect(el);if(['object','embed'].contains(el.tagName.toLowerCase()))return el;$extend(el,Element.prototype);el.htmlElement=function(){};return Garbage.collect(el);};document.getElementsBySelector=document.getElementsByTagName;function $$(){var elements=[];for(var i=0,j=arguments.length;ia1)this.lineTo(x+Math.cos(a0-=da)*rad,y+Math.sin(a0)*rad);}else{if(a1'];}else{color=this.processColor(this.strokeStyle);a=[10,''];}
this.element.insertAdjacentHTML('beforeEnd',''+
a[1]+'');this.parent.appendChild(this.fragment);if(fill&&this.fillStyle.img)this.element.getLast().fill.alignshape=false;this.path=[];},clip:function(){},isPointInPath:function(x,y){},processColor:function(col){var a=this.globalAlpha;if(col.substr(0,3)=='rgb'){if(col.charAt(3)=="a"){a*=col.match(/([\d.]*)\)$/)[1];}
col=col.rgbToHex();}
return{color:col,opacity:a};},processColorObject:function(obj){var ret='',col;if(obj.addColorStop){ret+=((obj.r0)?('type="gradientradial" '+'focusposition="0.2, 0.2" '+'focussize="0.2, 0.2" '):('type="gradient" '+'focus="0" '+'angle="'+(180+(180*obj.angle(obj.x0,obj.y0,obj.x1,obj.y1)/Math.PI))+'" '))+'color="'+obj.col0.color+'" '+'opacity="'+obj.col0.opacity*100+'%" '+'color2="'+obj.col1.color+'" '+'o:opacity2="'+obj.col1.opacity*100+'%" '+'colors="';if(obj.stops){for(var i=0,l=obj.stops.length;i');this.parent.appendChild(this.fragment);},drawImageFromRect:Function.empty,getImageData:function(sx,sy,sw,sh){},putImageData:function(image,dx,dy){},getCoords:function(x,y){var m=this.m;return{x:this.Z*(x*m[0][0]+y*m[1][0]+m[2][0])-this.Z2,y:this.Z*(x*m[0][1]+y*m[1][1]+m[2][1])-this.Z2};}});
/**This notice must be untouched at all times.
This is the COMPRESSED version of the Draw2D Library
WebSite: http://www.draw2d.org
Copyright: 2006 Andreas Herz. All rights reserved.
Created: 5.11.2006 by Andreas Herz (Web: http://www.freegroup.de )
LICENSE: LGPL
**/
Event=function(){
this.type=null;
this.target=null;
this.relatedTarget=null;
this.cancelable=false;
this.timeStamp=null;
this.returnValue=true;
};
Event.prototype.initEvent=function(sType,_3a0c){
this.type=sType;
this.cancelable=_3a0c;
this.timeStamp=(new Date()).getTime();
};
Event.prototype.preventDefault=function(){
if(this.cancelable){
this.returnValue=false;
}
};
Event.fireDOMEvent=function(_3a0d,_3a0e){
if(document.createEvent){
var evt=document.createEvent("Events");
evt.initEvent(_3a0d,true,true);
_3a0e.dispatchEvent(evt);
}else{
if(document.createEventObject){
var evt=document.createEventObject();
_3a0e.fireEvent("on"+_3a0d,evt);
}
}
};
EventTarget=function(){
this.eventhandlers=new Object();
};
EventTarget.prototype.addEventListener=function(sType,_3a11){
if(typeof this.eventhandlers[sType]=="undefined"){
this.eventhandlers[sType]=new Array;
}
this.eventhandlers[sType][this.eventhandlers[sType].length]=_3a11;
};
EventTarget.prototype.dispatchEvent=function(_3a12){
_3a12.target=this;
if(typeof this.eventhandlers[_3a12.type]!="undefined"){
for(var i=0;i=0){
return this.removeElementAt(index);
}
return null;
};
ArrayList.prototype.insertElementAt=function(obj,index){
if(this.size==this.capacity){
this.resize();
}
for(var i=this.getSize();i>index;i--){
this.data[i]=this.data[i-1];
}
this.data[index]=obj;
this.size++;
};
ArrayList.prototype.removeElementAt=function(index){
var _3dd3=this.data[index];
for(var i=index;i<(this.getSize()-1);i++){
this.data[i]=this.data[i+1];
}
this.data[this.getSize()-1]=null;
this.size--;
return _3dd3;
};
ArrayList.prototype.removeAllElements=function(){
this.size=0;
for(var i=0;i=0&&_3de2>_3ddf){
this.data[j+1]=this.data[j];
j--;
if(j>=0){
_3de1=this.data[j];
_3de2=_3de1[f];
}
}
this.data[j+1]=_3de0;
}
};
ArrayList.prototype.clone=function(){
var _3de3=new ArrayList(this.size);
for(var i=0;i"+_3dbe+"");
}
function openwindow(url,width,_3dc2){
var left=(screen.width-width)/2;
var top=(screen.height-_3dc2)/2;
property="left="+left+", top="+top+", toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,alwaysRaised,width="+width+",height="+_3dc2;
return window.open(url,"_blank",property);
}
function dumpObject(obj){
trace("----------------------------------------------------------------------------");
trace("- Object dump");
trace("----------------------------------------------------------------------------");
for(var i in obj){
try{
if(typeof obj[i]!="function"){
trace(i+" --> "+obj[i]);
}
}
catch(e){
}
}
for(var i in obj){
try{
if(typeof obj[i]=="function"){
trace(i+" --> "+obj[i]);
}
}
catch(e){
}
}
trace("----------------------------------------------------------------------------");
}
Drag=function(){
};
Drag.current=null;
Drag.currentTarget=null;
Drag.dragging=false;
Drag.isDragging=function(){
return this.dragging;
};
Drag.setCurrent=function(_326a){
this.current=_326a;
this.dragging=true;
};
Drag.getCurrent=function(){
return this.current;
};
Drag.clearCurrent=function(){
this.current=null;
this.dragging=false;
};
Draggable=function(_326b,_326c){
EventTarget.call(this);
this.construct(_326b,_326c);
this.diffX=0;
this.diffY=0;
this.targets=new ArrayList();
};
Draggable.prototype=new EventTarget;
Draggable.prototype.construct=function(_326d,_326e){
this.element=_326d;
this.constraints=_326e;
var oThis=this;
var _3270=function(){
var _3271=new DragDropEvent();
_3271.initDragDropEvent("dblclick",true);
oThis.dispatchEvent(_3271);
var _3272=arguments[0]||window.event;
_3272.cancelBubble=true;
_3272.returnValue=false;
};
var _3273=function(){
var _3274=arguments[0]||window.event;
var _3275=new DragDropEvent();
var _3276=oThis.node.workflow.getAbsoluteX();
var _3277=oThis.node.workflow.getAbsoluteY();
var _3278=oThis.node.workflow.getScrollLeft();
var _3279=oThis.node.workflow.getScrollTop();
_3275.x=_3274.clientX-oThis.element.offsetLeft+_3278-_3276;
_3275.y=_3274.clientY-oThis.element.offsetTop+_3279-_3277;
if(_3274.button==2){
_3275.initDragDropEvent("contextmenu",true);
oThis.dispatchEvent(_3275);
}else{
_3275.initDragDropEvent("dragstart",true);
if(oThis.dispatchEvent(_3275)){
oThis.diffX=_3274.clientX-oThis.element.offsetLeft;
oThis.diffY=_3274.clientY-oThis.element.offsetTop;
Drag.setCurrent(oThis);
if(oThis.isAttached==true){
oThis.detachEventHandlers();
}
oThis.attachEventHandlers();
}
}
_3274.cancelBubble=true;
_3274.returnValue=false;
};
var _327a=function(){
if(Drag.getCurrent()==null){
var _327b=arguments[0]||window.event;
if(Drag.currentHover!=null&&oThis!=Drag.currentHover){
var _327c=new DragDropEvent();
_327c.initDragDropEvent("mouseleave",false,oThis);
Drag.currentHover.dispatchEvent(_327c);
}
if(oThis!=null&&oThis!=Drag.currentHover){
var _327c=new DragDropEvent();
_327c.initDragDropEvent("mouseenter",false,oThis);
oThis.dispatchEvent(_327c);
}
Drag.currentHover=oThis;
}else{
}
};
if(this.element.addEventListener){
this.element.addEventListener("mousemove",_327a,false);
this.element.addEventListener("mousedown",_3273,false);
this.element.addEventListener("dblclick",_3270,false);
}else{
if(this.element.attachEvent){
this.element.attachEvent("onmousemove",_327a);
this.element.attachEvent("onmousedown",_3273);
this.element.attachEvent("ondblclick",_3270);
}else{
throw new Error("Drag not supported in this browser.");
}
}
};
Draggable.prototype.attachEventHandlers=function(){
var oThis=this;
oThis.isAttached=true;
this.tempMouseMove=function(){
var _327e=arguments[0]||window.event;
var _327f=new Point(_327e.clientX-oThis.diffX,_327e.clientY-oThis.diffY);
if(oThis.node.getCanSnapToHelper()){
_327f=oThis.node.getWorkflow().snapToHelper(oThis.node,_327f);
}
oThis.element.style.left=_327f.x+"px";
oThis.element.style.top=_327f.y+"px";
var _3280=oThis.node.workflow.getScrollLeft();
var _3281=oThis.node.workflow.getScrollTop();
var _3282=oThis.node.workflow.getAbsoluteX();
var _3283=oThis.node.workflow.getAbsoluteY();
var _3284=oThis.getDropTarget(_327e.clientX+_3280-_3282,_327e.clientY+_3281-_3283);
var _3285=oThis.getCompartment(_327e.clientX+_3280-_3282,_327e.clientY+_3281-_3283);
if(Drag.currentTarget!=null&&_3284!=Drag.currentTarget){
var _3286=new DragDropEvent();
_3286.initDragDropEvent("dragleave",false,oThis);
Drag.currentTarget.dispatchEvent(_3286);
}
if(_3284!=null&&_3284!=Drag.currentTarget){
var _3286=new DragDropEvent();
_3286.initDragDropEvent("dragenter",false,oThis);
_3284.dispatchEvent(_3286);
}
Drag.currentTarget=_3284;
if(Drag.currentCompartment!=null&&_3285!=Drag.currentCompartment){
var _3286=new DragDropEvent();
_3286.initDragDropEvent("figureleave",false,oThis);
Drag.currentCompartment.dispatchEvent(_3286);
}
if(_3285!=null&&_3285.node!=oThis.node&&_3285!=Drag.currentCompartment){
var _3286=new DragDropEvent();
_3286.initDragDropEvent("figureenter",false,oThis);
_3285.dispatchEvent(_3286);
}
Drag.currentCompartment=_3285;
var _3287=new DragDropEvent();
_3287.initDragDropEvent("drag",false);
oThis.dispatchEvent(_3287);
};
oThis.tempMouseUp=function(){
oThis.detachEventHandlers();
var _3288=arguments[0]||window.event;
var _3289=new DragDropEvent();
_3289.initDragDropEvent("dragend",false);
oThis.dispatchEvent(_3289);
var _328a=oThis.node.workflow.getScrollLeft();
var _328b=oThis.node.workflow.getScrollTop();
var _328c=oThis.node.workflow.getAbsoluteX();
var _328d=oThis.node.workflow.getAbsoluteY();
var _328e=oThis.getDropTarget(_3288.clientX+_328a-_328c,_3288.clientY+_328b-_328d);
var _328f=oThis.getCompartment(_3288.clientX+_328a-_328c,_3288.clientY+_328b-_328d);
if(_328e!=null){
var _3290=new DragDropEvent();
_3290.initDragDropEvent("drop",false,oThis);
_328e.dispatchEvent(_3290);
}
if(_328f!=null&&_328f.node!=oThis.node){
var _3290=new DragDropEvent();
_3290.initDragDropEvent("figuredrop",false,oThis);
_328f.dispatchEvent(_3290);
}
if(Drag.currentTarget!=null){
var _3290=new DragDropEvent();
_3290.initDragDropEvent("dragleave",false,oThis);
Drag.currentTarget.dispatchEvent(_3290);
Drag.currentTarget=null;
}
Drag.currentCompartment=null;
Drag.clearCurrent();
};
if(document.body.addEventListener){
document.body.addEventListener("mousemove",this.tempMouseMove,false);
document.body.addEventListener("mouseup",this.tempMouseUp,false);
}else{
if(document.body.attachEvent){
document.body.attachEvent("onmousemove",this.tempMouseMove);
document.body.attachEvent("onmouseup",this.tempMouseUp);
}else{
throw new Error("Drag doesn't support this browser.");
}
}
};
Draggable.prototype.detachEventHandlers=function(){
this.isAttached=false;
if(document.body.removeEventListener){
document.body.removeEventListener("mousemove",this.tempMouseMove,false);
document.body.removeEventListener("mouseup",this.tempMouseUp,false);
}else{
if(document.body.detachEvent){
document.body.detachEvent("onmousemove",this.tempMouseMove);
document.body.detachEvent("onmouseup",this.tempMouseUp);
}else{
throw new Error("Drag doesn't support this browser.");
}
}
};
Draggable.prototype.getDropTarget=function(x,y){
for(var i=0;i255){
red=255;
}
}
if(green<0){
green=0;
}else{
if(green>255){
green=255;
}
}
if(blue<0){
blue=0;
}else{
if(blue>255){
blue=255;
}
}
return new Color(red,green,blue);
};
Color.prototype.lighter=function(_3f0f){
var red=parseInt(Math.round(this.getRed()*(1+_3f0f)));
var green=parseInt(Math.round(this.getGreen()*(1+_3f0f)));
var blue=parseInt(Math.round(this.getBlue()*(1+_3f0f)));
if(red<0){
red=0;
}else{
if(red>255){
red=255;
}
}
if(green<0){
green=0;
}else{
if(green>255){
green=255;
}
}
if(blue<0){
blue=0;
}else{
if(blue>255){
blue=255;
}
}
return new Color(red,green,blue);
};
Point=function(x,y){
this.x=x;
this.y=y;
};
Point.prototype.type="Point";
Point.prototype.getX=function(){
return this.x;
};
Point.prototype.getY=function(){
return this.y;
};
Point.prototype.getPosition=function(p){
var dx=p.x-this.x;
var dy=p.y-this.y;
if(Math.abs(dx)>Math.abs(dy)){
if(dx<0){
return PositionConstants.WEST;
}
return PositionConstants.EAST;
}
if(dy<0){
return PositionConstants.NORTH;
}
return PositionConstants.SOUTH;
};
Point.prototype.equals=function(o){
return this.x==o.x&&this.y==o.y;
};
Point.prototype.getDistance=function(other){
return Math.sqrt((this.x-other.x)*(this.x-other.x)+(this.y-other.y)*(this.y-other.y));
};
Point.prototype.getTranslated=function(other){
return new Point(this.x+other.x,this.y+other.y);
};
Dimension=function(x,y,w,h){
Point.call(this,x,y);
this.w=w;
this.h=h;
};
Dimension.prototype=new Point;
Dimension.prototype.type="Dimension";
Dimension.prototype.translate=function(dx,dy){
this.x+=dx;
this.y+=dy;
return this;
};
Dimension.prototype.resize=function(dw,dh){
this.w+=dw;
this.h+=dh;
return this;
};
Dimension.prototype.setBounds=function(rect){
this.x=rect.x;
this.y=rect.y;
this.w=rect.w;
this.h=rect.h;
return this;
};
Dimension.prototype.isEmpty=function(){
return this.w<=0||this.h<=0;
};
Dimension.prototype.getWidth=function(){
return this.w;
};
Dimension.prototype.getHeight=function(){
return this.h;
};
Dimension.prototype.getRight=function(){
return this.x+this.w;
};
Dimension.prototype.getBottom=function(){
return this.y+this.h;
};
Dimension.prototype.getTopLeft=function(){
return new Point(this.x,this.y);
};
Dimension.prototype.getCenter=function(){
return new Point(this.x+this.w/2,this.y+this.h/2);
};
Dimension.prototype.getBottomRight=function(){
return new Point(this.x+this.w,this.y+this.h);
};
Dimension.prototype.equals=function(o){
return this.x==o.x&&this.y==o.y&&this.w==o.w&&this.h==o.h;
};
SnapToHelper=function(_3f1b){
this.workflow=_3f1b;
};
SnapToHelper.NORTH=1;
SnapToHelper.SOUTH=4;
SnapToHelper.WEST=8;
SnapToHelper.EAST=16;
SnapToHelper.NORTH_EAST=SnapToHelper.NORTH|SnapToHelper.EAST;
SnapToHelper.NORTH_WEST=SnapToHelper.NORTH|SnapToHelper.WEST;
SnapToHelper.SOUTH_EAST=SnapToHelper.SOUTH|SnapToHelper.EAST;
SnapToHelper.SOUTH_WEST=SnapToHelper.SOUTH|SnapToHelper.WEST;
SnapToHelper.NORTH_SOUTH=SnapToHelper.NORTH|SnapToHelper.SOUTH;
SnapToHelper.EAST_WEST=SnapToHelper.EAST|SnapToHelper.WEST;
SnapToHelper.NSEW=SnapToHelper.NORTH_SOUTH|SnapToHelper.EAST_WEST;
SnapToHelper.prototype.snapPoint=function(_3f1c,_3f1d,_3f1e){
return _3f1d;
};
SnapToHelper.prototype.snapRectangle=function(_3f1f,_3f20){
return _3f1f;
};
SnapToHelper.prototype.onSetDocumentDirty=function(){
};
SnapToGrid=function(_39d9){
SnapToHelper.call(this,_39d9);
};
SnapToGrid.prototype=new SnapToHelper;
SnapToGrid.prototype.snapPoint=function(_39da,_39db,_39dc){
_39dc.x=this.workflow.gridWidthX*Math.floor(((_39db.x+this.workflow.gridWidthX/2)/this.workflow.gridWidthX));
_39dc.y=this.workflow.gridWidthY*Math.floor(((_39db.y+this.workflow.gridWidthY/2)/this.workflow.gridWidthY));
return 0;
};
SnapToGrid.prototype.snapRectangle=function(_39dd,_39de){
_39de.x=_39dd.x;
_39de.y=_39dd.y;
_39de.w=_39dd.w;
_39de.h=_39dd.h;
return 0;
};
SnapToGeometryEntry=function(type,_39cd){
this.type=type;
this.location=_39cd;
};
SnapToGeometryEntry.prototype.getLocation=function(){
return this.location;
};
SnapToGeometryEntry.prototype.getType=function(){
return this.type;
};
SnapToGeometry=function(_40db){
SnapToHelper.call(this,_40db);
};
SnapToGeometry.prototype=new SnapToHelper;
SnapToGeometry.THRESHOLD=5;
SnapToGeometry.prototype.snapPoint=function(_40dc,_40dd,_40de){
if(this.rows==null||this.cols==null){
this.populateRowsAndCols();
}
if((_40dc&SnapToHelper.EAST)!=0){
var _40df=this.getCorrectionFor(this.cols,_40dd.getX()-1,1);
if(_40df!=SnapToGeometry.THRESHOLD){
_40dc&=~SnapToHelper.EAST;
_40de.x+=_40df;
}
}
if((_40dc&SnapToHelper.WEST)!=0){
var _40e0=this.getCorrectionFor(this.cols,_40dd.getX(),-1);
if(_40e0!=SnapToGeometry.THRESHOLD){
_40dc&=~SnapToHelper.WEST;
_40de.x+=_40e0;
}
}
if((_40dc&SnapToHelper.SOUTH)!=0){
var _40e1=this.getCorrectionFor(this.rows,_40dd.getY()-1,1);
if(_40e1!=SnapToGeometry.THRESHOLD){
_40dc&=~SnapToHelper.SOUTH;
_40de.y+=_40e1;
}
}
if((_40dc&SnapToHelper.NORTH)!=0){
var _40e2=this.getCorrectionFor(this.rows,_40dd.getY(),-1);
if(_40e2!=SnapToGeometry.THRESHOLD){
_40dc&=~SnapToHelper.NORTH;
_40de.y+=_40e2;
}
}
return _40dc;
};
SnapToGeometry.prototype.snapRectangle=function(_40e3,_40e4){
var _40e5=_40e3.getTopLeft();
var _40e6=_40e3.getBottomRight();
var _40e7=this.snapPoint(SnapToHelper.NORTH_WEST,_40e3.getTopLeft(),_40e5);
_40e4.x=_40e5.x;
_40e4.y=_40e5.y;
var _40e8=this.snapPoint(SnapToHelper.SOUTH_EAST,_40e3.getBottomRight(),_40e6);
if(_40e7&SnapToHelper.WEST){
_40e4.x=_40e6.x-_40e3.getWidth();
}
if(_40e7&SnapToHelper.NORTH){
_40e4.y=_40e6.y-_40e3.getHeight();
}
return _40e7|_40e8;
};
SnapToGeometry.prototype.populateRowsAndCols=function(){
this.rows=new Array();
this.cols=new Array();
var _40e9=this.workflow.getDocument().getFigures();
var index=0;
for(var i=0;i<_40e9.getSize();i++){
var _40ec=_40e9.get(i);
if(_40ec!=this.workflow.getCurrentSelection()){
var _40ed=_40ec.getBounds();
this.cols[index*3]=new SnapToGeometryEntry(-1,_40ed.getX());
this.rows[index*3]=new SnapToGeometryEntry(-1,_40ed.getY());
this.cols[index*3+1]=new SnapToGeometryEntry(0,_40ed.x+(_40ed.getWidth()-1)/2);
this.rows[index*3+1]=new SnapToGeometryEntry(0,_40ed.y+(_40ed.getHeight()-1)/2);
this.cols[index*3+2]=new SnapToGeometryEntry(1,_40ed.getRight()-1);
this.rows[index*3+2]=new SnapToGeometryEntry(1,_40ed.getBottom()-1);
index++;
}
}
};
SnapToGeometry.prototype.getCorrectionFor=function(_40ee,value,side){
var _40f1=SnapToGeometry.THRESHOLD;
var _40f2=SnapToGeometry.THRESHOLD;
for(var i=0;i<_40ee.length;i++){
var entry=_40ee[i];
var _40f5;
if(entry.type==-1&&side!=0){
_40f5=Math.abs(value-entry.location);
if(_40f5<_40f1){
_40f1=_40f5;
_40f2=entry.location-value;
}
}else{
if(entry.type==0&&side==0){
_40f5=Math.abs(value-entry.location);
if(_40f5<_40f1){
_40f1=_40f5;
_40f2=entry.location-value;
}
}else{
if(entry.type==1&&side!=0){
_40f5=Math.abs(value-entry.location);
if(_40f5<_40f1){
_40f1=_40f5;
_40f2=entry.location-value;
}
}
}
}
}
return _40f2;
};
SnapToGeometry.prototype.onSetDocumentDirty=function(){
this.rows=null;
this.cols=null;
};
Border=function(){
this.color=null;
};
Border.prototype.type="Border";
Border.prototype.dispose=function(){
this.color=null;
};
Border.prototype.getHTMLStyle=function(){
return "";
};
Border.prototype.setColor=function(c){
this.color=c;
};
Border.prototype.getColor=function(){
return this.color;
};
Border.prototype.refresh=function(){
};
LineBorder=function(width){
Border.call(this);
this.width=1;
if(width){
this.width=width;
}
this.figure=null;
};
LineBorder.prototype=new Border;
LineBorder.prototype.type="LineBorder";
LineBorder.prototype.dispose=function(){
Border.prototype.dispose.call(this);
this.figure=null;
};
LineBorder.prototype.setLineWidth=function(w){
this.width=w;
if(this.figure!=null){
this.figure.html.style.border=this.getHTMLStyle();
}
};
LineBorder.prototype.getHTMLStyle=function(){
if(this.getColor()!=null){
return this.width+"px solid "+this.getColor().getHTMLStyle();
}
return this.width+"px solid black";
};
LineBorder.prototype.refresh=function(){
this.setLineWidth(this.width);
};
Figure=function(){
this.construct();
};
Figure.prototype.type="Figure";
Figure.ZOrderBaseIndex=100;
Figure.setZOrderBaseIndex=function(index){
Figure.ZOrderBaseIndex=index;
};
Figure.prototype.construct=function(){
this.lastDragStartTime=0;
this.x=0;
this.y=0;
this.border=null;
this.setDimension(10,10);
this.id=this.generateUId();
this.html=this.createHTMLElement();
this.canvas=null;
this.workflow=null;
this.draggable=null;
this.parent=null;
this.isMoving=false;
this.canSnapToHelper=true;
this.snapToGridAnchor=new Point(0,0);
this.timer=-1;
this.setDeleteable(true);
this.setCanDrag(true);
this.setResizeable(true);
this.setSelectable(true);
this.properties=new Object();
this.moveListener=new ArrayList();
};
Figure.prototype.dispose=function(){
this.canvas=null;
this.workflow=null;
this.moveListener=null;
if(this.draggable!=null){
this.draggable.removeEventListener("mouseenter",this.tmpMouseEnter);
this.draggable.removeEventListener("mouseleave",this.tmpMouseLeave);
this.draggable.removeEventListener("dragend",this.tmpDragend);
this.draggable.removeEventListener("dragstart",this.tmpDragstart);
this.draggable.removeEventListener("drag",this.tmpDrag);
this.draggable.removeEventListener("dblclick",this.tmpDoubleClick);
this.draggable.node=null;
}
this.draggable=null;
if(this.border!=null){
this.border.dispose();
}
this.border=null;
if(this.parent!=null){
this.parent.removeChild(this);
}
};
Figure.prototype.getProperties=function(){
return this.properties;
};
Figure.prototype.getProperty=function(key){
return this.properties[key];
};
Figure.prototype.setProperty=function(key,value){
this.properties[key]=value;
this.setDocumentDirty();
};
Figure.prototype.getId=function(){
return this.id;
};
Figure.prototype.setCanvas=function(_3deb){
this.canvas=_3deb;
};
Figure.prototype.getWorkflow=function(){
return this.workflow;
};
Figure.prototype.setWorkflow=function(_3dec){
if(this.draggable==null){
this.html.tabIndex="0";
var oThis=this;
this.keyDown=function(event){
event.cancelBubble=true;
event.returnValue=true;
oThis.onKeyDown(event.keyCode,event.ctrlKey);
};
if(this.html.addEventListener){
this.html.addEventListener("keydown",this.keyDown,false);
}else{
if(this.html.attachEvent){
this.html.attachEvent("onkeydown",this.keyDown);
}
}
this.draggable=new Draggable(this.html,Draggable.DRAG_X|Draggable.DRAG_Y);
this.draggable.node=this;
this.tmpContextMenu=function(_3def){
oThis.onContextMenu(oThis.x+_3def.x,_3def.y+oThis.y);
};
this.tmpMouseEnter=function(_3df0){
oThis.onMouseEnter();
};
this.tmpMouseLeave=function(_3df1){
oThis.onMouseLeave();
};
this.tmpDragend=function(_3df2){
oThis.onDragend();
};
this.tmpDragstart=function(_3df3){
var w=oThis.workflow;
w.showMenu(null);
if(oThis.workflow.toolPalette&&oThis.workflow.toolPalette.activeTool){
_3df3.returnValue=false;
oThis.workflow.onMouseDown(oThis.x+_3df3.x,_3df3.y+oThis.y);
oThis.workflow.onMouseUp(oThis.x+_3df3.x,_3df3.y+oThis.y);
return;
}
_3df3.returnValue=oThis.onDragstart(_3df3.x,_3df3.y);
};
this.tmpDrag=function(_3df5){
oThis.onDrag();
};
this.tmpDoubleClick=function(_3df6){
oThis.onDoubleClick();
};
this.draggable.addEventListener("contextmenu",this.tmpContextMenu);
this.draggable.addEventListener("mouseenter",this.tmpMouseEnter);
this.draggable.addEventListener("mouseleave",this.tmpMouseLeave);
this.draggable.addEventListener("dragend",this.tmpDragend);
this.draggable.addEventListener("dragstart",this.tmpDragstart);
this.draggable.addEventListener("drag",this.tmpDrag);
this.draggable.addEventListener("dblclick",this.tmpDoubleClick);
}
this.workflow=_3dec;
};
Figure.prototype.createHTMLElement=function(){
var item=document.createElement("div");
item.id=this.id;
item.style.position="absolute";
item.style.left=this.x+"px";
item.style.top=this.y+"px";
item.style.height=this.width+"px";
item.style.width=this.height+"px";
item.style.margin="0px";
item.style.padding="0px";
item.style.outline="none";
item.style.zIndex=""+Figure.ZOrderBaseIndex;
return item;
};
Figure.prototype.setParent=function(_3df8){
this.parent=_3df8;
};
Figure.prototype.getParent=function(){
return this.parent;
};
Figure.prototype.getZOrder=function(){
return this.html.style.zIndex;
};
Figure.prototype.setZOrder=function(index){
this.html.style.zIndex=index;
};
Figure.prototype.hasFixedPosition=function(){
return false;
};
Figure.prototype.getMinWidth=function(){
return 5;
};
Figure.prototype.getMinHeight=function(){
return 5;
};
Figure.prototype.getHTMLElement=function(){
if(this.html==null){
this.html=this.createHTMLElement();
}
return this.html;
};
Figure.prototype.paint=function(){
};
Figure.prototype.setBorder=function(_3dfa){
if(this.border!=null){
this.border.figure=null;
}
this.border=_3dfa;
this.border.figure=this;
this.border.refresh();
this.setDocumentDirty();
};
Figure.prototype.onContextMenu=function(x,y){
var menu=this.getContextMenu();
if(menu!=null){
this.workflow.showMenu(menu,x,y);
}
};
Figure.prototype.getContextMenu=function(){
return null;
};
Figure.prototype.onDoubleClick=function(){
};
Figure.prototype.onMouseEnter=function(){
};
Figure.prototype.onMouseLeave=function(){
};
Figure.prototype.onDrag=function(){
this.x=this.draggable.getLeft();
this.y=this.draggable.getTop();
if(this.isMoving==false){
this.isMoving=true;
this.setAlpha(0.5);
}
this.fireMoveEvent();
};
Figure.prototype.onDragend=function(){
if(this.getWorkflow().getEnableSmoothFigureHandling()==true){
var _3dfe=this;
var _3dff=function(){
if(_3dfe.alpha<1){
_3dfe.setAlpha(Math.min(1,_3dfe.alpha+0.05));
}else{
window.clearInterval(_3dfe.timer);
_3dfe.timer=-1;
}
};
if(_3dfe.timer>0){
window.clearInterval(_3dfe.timer);
}
_3dfe.timer=window.setInterval(_3dff,20);
}else{
this.setAlpha(1);
}
this.command.setPosition(this.x,this.y);
this.workflow.commandStack.execute(this.command);
this.command=null;
this.isMoving=false;
this.workflow.hideSnapToHelperLines();
this.fireMoveEvent();
};
Figure.prototype.onDragstart=function(x,y){
if(!this.canDrag){
return false;
}
this.command=new CommandMove(this,this.x,this.y);
return true;
};
Figure.prototype.setCanDrag=function(flag){
this.canDrag=flag;
if(flag){
this.html.style.cursor="move";
}else{
this.html.style.cursor=null;
}
};
Figure.prototype.setAlpha=function(_3e03){
if(this.alpha==_3e03){
return;
}
try{
this.html.style.MozOpacity=_3e03;
}
catch(exc){
}
try{
this.html.style.opacity=_3e03;
}
catch(exc){
}
try{
var _3e04=Math.round(_3e03*100);
if(_3e04>=99){
this.html.style.filter="";
}else{
this.html.style.filter="alpha(opacity="+_3e04+")";
}
}
catch(exc){
}
this.alpha=_3e03;
};
Figure.prototype.setDimension=function(w,h){
this.width=Math.max(this.getMinWidth(),w);
this.height=Math.max(this.getMinHeight(),h);
if(this.html==null){
return;
}
this.html.style.width=this.width+"px";
this.html.style.height=this.height+"px";
this.fireMoveEvent();
if(this.workflow!=null&&this.workflow.getCurrentSelection()==this){
this.workflow.showResizeHandles(this);
}
};
Figure.prototype.setPosition=function(xPos,yPos){
this.x=xPos;
this.y=yPos;
if(this.html==null){
return;
}
this.html.style.left=this.x+"px";
this.html.style.top=this.y+"px";
this.fireMoveEvent();
if(this.workflow!=null&&this.workflow.getCurrentSelection()==this){
this.workflow.showResizeHandles(this);
}
};
Figure.prototype.isResizeable=function(){
return this.resizeable;
};
Figure.prototype.setResizeable=function(flag){
this.resizeable=flag;
};
Figure.prototype.isSelectable=function(){
return this.selectable;
};
Figure.prototype.setSelectable=function(flag){
this.selectable=flag;
};
Figure.prototype.isStrechable=function(){
return true;
};
Figure.prototype.isDeleteable=function(){
return this.deleteable;
};
Figure.prototype.setDeleteable=function(flag){
this.deleteable=flag;
};
Figure.prototype.setCanSnapToHelper=function(flag){
this.canSnapToHelper=flag;
};
Figure.prototype.getCanSnapToHelper=function(){
return this.canSnapToHelper;
};
Figure.prototype.getSnapToGridAnchor=function(){
return this.snapToGridAnchor;
};
Figure.prototype.setSnapToGridAnchor=function(point){
this.snapToGridAnchor=point;
};
Figure.prototype.getBounds=function(){
return new Dimension(this.getX(),this.getY(),this.getWidth(),this.getHeight());
};
Figure.prototype.getWidth=function(){
return this.width;
};
Figure.prototype.getHeight=function(){
return this.height;
};
Figure.prototype.getY=function(){
return this.y;
};
Figure.prototype.getX=function(){
return this.x;
};
Figure.prototype.getAbsoluteY=function(){
return this.y;
};
Figure.prototype.getAbsoluteX=function(){
return this.x;
};
Figure.prototype.onKeyDown=function(_3e0e,ctrl){
if(_3e0e==46&&this.isDeleteable()==true){
this.workflow.commandStack.execute(new CommandDelete(this));
}
if(ctrl){
this.workflow.onKeyDown(_3e0e,ctrl);
}
};
Figure.prototype.getPosition=function(){
return new Point(this.x,this.y);
};
Figure.prototype.isOver=function(iX,iY){
var x=this.getAbsoluteX();
var y=this.getAbsoluteY();
var iX2=x+this.width;
var iY2=y+this.height;
return (iX>=x&&iX<=iX2&&iY>=y&&iY<=iY2);
};
Figure.prototype.attachMoveListener=function(_3e16){
if(_3e16==null||this.moveListener==null){
return;
}
this.moveListener.add(_3e16);
};
Figure.prototype.detachMoveListener=function(_3e17){
if(_3e17==null||this.moveListener==null){
return;
}
this.moveListener.remove(_3e17);
};
Figure.prototype.fireMoveEvent=function(){
this.setDocumentDirty();
var size=this.moveListener.getSize();
for(var i=0;ih){
Oval.prototype.setDimension.call(this,w,w);
}else{
Oval.prototype.setDimension.call(this,h,h);
}
};
Circle.prototype.isStrechable=function(){
return false;
};
Rectangle=function(width,_3e35){
this.bgColor=null;
this.lineColor=new Color(0,0,0);
this.lineStroke=1;
Figure.call(this);
if(width&&_3e35){
this.setDimension(width,_3e35);
}
};
Rectangle.prototype=new Figure;
Rectangle.prototype.type="Rectangle";
Rectangle.prototype.dispose=function(){
Figure.prototype.dispose.call(this);
this.bgColor=null;
this.lineColor=null;
};
Rectangle.prototype.createHTMLElement=function(){
var item=Figure.prototype.createHTMLElement.call(this);
item.style.width="auto";
item.style.height="auto";
item.style.margin="0px";
item.style.padding="0px";
item.style.border=this.lineStroke+"px solid "+this.lineColor.getHTMLStyle();
item.style.fontSize="1px";
item.style.lineHeight="1px";
item.innerHTML=" ";
if(this.bgColor!=null){
item.style.backgroundColor=this.bgColor.getHTMLStyle();
}
return item;
};
Rectangle.prototype.setBackgroundColor=function(color){
this.bgColor=color;
if(this.bgColor!=null){
this.html.style.backgroundColor=this.bgColor.getHTMLStyle();
}else{
this.html.style.backgroundColor="transparent";
}
};
Rectangle.prototype.getBackgroundColor=function(){
return this.bgColor;
};
Rectangle.prototype.setColor=function(color){
this.lineColor=color;
if(this.lineColor!=null){
this.html.style.border=this.lineStroke+"px solid "+this.lineColor.getHTMLStyle();
}else{
this.html.style.border=this.lineStroke+"0px";
}
};
Rectangle.prototype.getColor=function(){
return this.lineColor;
};
Rectangle.prototype.getWidth=function(){
return Figure.prototype.getWidth.call(this)+2*this.lineStroke;
};
Rectangle.prototype.getHeight=function(){
return Figure.prototype.getHeight.call(this)+2*this.lineStroke;
};
Rectangle.prototype.setDimension=function(w,h){
return Figure.prototype.setDimension.call(this,w-2*this.lineStroke,h-2*this.lineStroke);
};
Rectangle.prototype.setLineWidth=function(w){
var diff=w-this.lineStroke;
this.setDimension(this.getWidth()-2*diff,this.getHeight()-2*diff);
this.lineStroke=w;
var c="transparent";
if(this.lineColor!=null){
c=this.lineColor.getHTMLStyle();
}
this.html.style.border=this.lineStroke+"px solid "+c;
};
Rectangle.prototype.getLineWidth=function(){
return this.lineStroke;
};
ImageFigure=function(url){
this.url=url;
Node.call(this);
this.setDimension(40,40);
};
ImageFigure.prototype=new Node;
ImageFigure.prototype.type="Image";
ImageFigure.prototype.createHTMLElement=function(){
var item=Node.prototype.createHTMLElement.call(this);
item.style.width=this.width+"px";
item.style.height=this.height+"px";
item.style.margin="0px";
item.style.padding="0px";
item.style.border="0px";
if(this.url!=null){
item.style.backgroundImage="url("+this.url+")";
}else{
item.style.backgroundImage="";
}
return item;
};
ImageFigure.prototype.setColor=function(color){
};
ImageFigure.prototype.isResizeable=function(){
return false;
};
ImageFigure.prototype.setImage=function(url){
this.url=url;
if(this.url!=null){
this.html.style.backgroundImage="url("+this.url+")";
}else{
this.html.style.backgroundImage="";
}
};
Port=function(_41c2,_41c3){
Corona=function(){
};
Corona.prototype=new Circle;
Corona.prototype.setAlpha=function(_41c4){
Circle.prototype.setAlpha.call(this,Math.min(0.3,_41c4));
};
if(_41c2==null){
this.currentUIRepresentation=new Circle();
}else{
this.currentUIRepresentation=_41c2;
}
if(_41c3==null){
this.connectedUIRepresentation=new Circle();
this.connectedUIRepresentation.setColor(null);
}else{
this.connectedUIRepresentation=_41c3;
}
this.disconnectedUIRepresentation=this.currentUIRepresentation;
this.hideIfConnected=false;
this.uiRepresentationAdded=true;
this.parentNode=null;
this.originX=0;
this.originY=0;
this.coronaWidth=10;
this.corona=null;
Rectangle.call(this);
this.setDimension(8,8);
this.setBackgroundColor(new Color(100,180,100));
this.setColor(new Color(90,150,90));
Rectangle.prototype.setColor.call(this,null);
this.dropable=new DropTarget(this.html);
this.dropable.node=this;
this.dropable.addEventListener("dragenter",function(_41c5){
_41c5.target.node.onDragEnter(_41c5.relatedTarget.node);
});
this.dropable.addEventListener("dragleave",function(_41c6){
_41c6.target.node.onDragLeave(_41c6.relatedTarget.node);
});
this.dropable.addEventListener("drop",function(_41c7){
_41c7.relatedTarget.node.onDrop(_41c7.target.node);
});
};
Port.prototype=new Rectangle;
Port.prototype.type="Port";
Port.ZOrderBaseIndex=5000;
Port.setZOrderBaseIndex=function(index){
Port.ZOrderBaseIndex=index;
};
Port.prototype.setHideIfConnected=function(flag){
this.hideIfConnected=flag;
};
Port.prototype.dispose=function(){
var size=this.moveListener.getSize();
for(var i=0;i=x&&iX<=iX2&&iY>=y&&iY<=iY2);
};
Port.prototype.showCorona=function(flag,_41ed){
if(flag==true){
this.corona=new Corona();
this.corona.setAlpha(0.3);
this.corona.setBackgroundColor(new Color(0,125,125));
this.corona.setColor(null);
this.corona.setDimension(this.getWidth()+(this.getCoronaWidth()*2),this.getWidth()+(this.getCoronaWidth()*2));
this.parentNode.getWorkflow().addFigure(this.corona,this.getAbsoluteX()-this.getCoronaWidth()-this.getWidth()/2,this.getAbsoluteY()-this.getCoronaWidth()-this.getHeight()/2);
}else{
if(flag==false&&this.corona!=null){
this.parentNode.getWorkflow().removeFigure(this.corona);
this.corona=null;
}
}
};
InputPort=function(_4067){
Port.call(this,_4067);
};
InputPort.prototype=new Port;
InputPort.prototype.type="InputPort";
InputPort.prototype.onDrop=function(port){
if(port.getMaxFanOut&&port.getMaxFanOut()<=port.getFanOut()){
return;
}
if(this.parentNode.id==port.parentNode.id){
}else{
if(port instanceof OutputPort){
var _4069=new CommandConnect(this.parentNode.workflow,port,this);
this.parentNode.workflow.getCommandStack().execute(_4069);
}
}
};
InputPort.prototype.onDragEnter=function(port){
if(port instanceof OutputPort){
Port.prototype.onDragEnter.call(this,port);
}else{
if(port instanceof LineStartResizeHandle){
var line=this.workflow.currentSelection;
if(line instanceof Connection&&line.getSource() instanceof InputPort){
Port.prototype.onDragEnter.call(this,line.getSource());
}
}else{
if(port instanceof LineEndResizeHandle){
var line=this.workflow.currentSelection;
if(line instanceof Connection&&line.getTarget() instanceof InputPort){
Port.prototype.onDragEnter.call(this,line.getTarget());
}
}
}
}
};
InputPort.prototype.onDragLeave=function(port){
if(port instanceof OutputPort){
Port.prototype.onDragLeave.call(this,port);
}else{
if(port instanceof LineStartResizeHandle){
var line=this.workflow.currentSelection;
if(line instanceof Connection&&line.getSource() instanceof InputPort){
Port.prototype.onDragLeave.call(this,line.getSource());
}
}else{
if(port instanceof LineEndResizeHandle){
var line=this.workflow.currentSelection;
if(line instanceof Connection&&line.getTarget() instanceof InputPort){
Port.prototype.onDragLeave.call(this,line.getTarget());
}
}
}
}
};
OutputPort=function(_357f){
Port.call(this,_357f);
this.maxFanOut=100;
};
OutputPort.prototype=new Port;
OutputPort.prototype.type="OutputPort";
OutputPort.prototype.onDrop=function(port){
if(this.getMaxFanOut()<=this.getFanOut()){
return;
}
if(this.parentNode.id==port.parentNode.id){
}else{
if(port instanceof InputPort){
var _3581=new CommandConnect(this.parentNode.workflow,this,port);
this.parentNode.workflow.getCommandStack().execute(_3581);
}
}
};
OutputPort.prototype.onDragEnter=function(port){
if(this.getMaxFanOut()<=this.getFanOut()){
return;
}
if(port instanceof InputPort){
Port.prototype.onDragEnter.call(this,port);
}else{
if(port instanceof LineStartResizeHandle){
var line=this.workflow.currentSelection;
if(line instanceof Connection&&line.getSource() instanceof OutputPort){
Port.prototype.onDragEnter.call(this,line.getSource());
}
}else{
if(port instanceof LineEndResizeHandle){
var line=this.workflow.currentSelection;
if(line instanceof Connection&&line.getTarget() instanceof OutputPort){
Port.prototype.onDragEnter.call(this,line.getTarget());
}
}
}
}
};
OutputPort.prototype.onDragLeave=function(port){
if(port instanceof InputPort){
Port.prototype.onDragLeave.call(this,port);
}else{
if(port instanceof LineStartResizeHandle){
var line=this.workflow.currentSelection;
if(line instanceof Connection&&line.getSource() instanceof OutputPort){
Port.prototype.onDragLeave.call(this,line.getSource());
}
}else{
if(port instanceof LineEndResizeHandle){
var line=this.workflow.currentSelection;
if(line instanceof Connection&&line.getTarget() instanceof OutputPort){
Port.prototype.onDragLeave.call(this,line.getTarget());
}
}
}
}
};
OutputPort.prototype.onDragstart=function(x,y){
if(this.maxFanOut==-1){
return true;
}
if(this.getMaxFanOut()<=this.getFanOut()){
return false;
}
return true;
};
OutputPort.prototype.setMaxFanOut=function(count){
this.maxFanOut=count;
};
OutputPort.prototype.getMaxFanOut=function(){
return this.maxFanOut;
};
OutputPort.prototype.getFanOut=function(){
if(this.getParent().workflow==null){
return 0;
}
var count=0;
var lines=this.getParent().workflow.getLines();
var size=lines.getSize();
for(var i=0;i=99){
this.html.style.filter="";
}else{
this.html.style.filter="alpha(opacity="+_3ed5+")";
}
}
catch(exc){
}
this.alpha=_3ed4;
};
Line.prototype.setStartPoint=function(x,y){
this.startX=x;
this.startY=y;
if(this.graphics!=null){
this.paint();
}
this.setDocumentDirty();
};
Line.prototype.setEndPoint=function(x,y){
this.endX=x;
this.endY=y;
if(this.graphics!=null){
this.paint();
}
this.setDocumentDirty();
};
Line.prototype.getStartX=function(){
return this.startX;
};
Line.prototype.getStartY=function(){
return this.startY;
};
Line.prototype.getStartPoint=function(){
return new Point(this.startX,this.startY);
};
Line.prototype.getEndX=function(){
return this.endX;
};
Line.prototype.getEndY=function(){
return this.endY;
};
Line.prototype.getEndPoint=function(){
return new Point(this.endX,this.endY);
};
Line.prototype.isSelectable=function(){
return this.selectable;
};
Line.prototype.setSelectable=function(flag){
this.selectable=flag;
};
Line.prototype.isDeleteable=function(){
return this.deleteable;
};
Line.prototype.setDeleteable=function(flag){
this.deleteable=flag;
};
Line.prototype.getLength=function(){
return Math.sqrt((this.startX-this.endX)*(this.startX-this.endX)+(this.startY-this.endY)*(this.startY-this.endY));
};
Line.prototype.getAngle=function(){
var _3edc=this.getLength();
var angle=-(180/Math.PI)*Math.asin((this.startY-this.endY)/_3edc);
if(angle<0){
if(this.endX0)&&((yDiff*yDiff)0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){
point=new Point(toPt.x,_3bad.y);
}else{
if(_3bae==toDir){
var pos=Math.min(_3bad.x,toPt.x)-this.MINDIST;
point=new Point(pos,_3bad.y);
}else{
point=new Point(_3bad.x-(xDiff/2),_3bad.y);
}
}
}
if(yDiff>0){
dir=UP;
}else{
dir=DOWN;
}
}
}else{
if(_3bae==RIGHT){
if((xDiff<0)&&((yDiff*yDiff)0){
point=new Point(_3bad.x+this.MINDIST,_3bad.y);
}else{
if(((yDiff>0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){
point=new Point(toPt.x,_3bad.y);
}else{
if(_3bae==toDir){
var pos=Math.max(_3bad.x,toPt.x)+this.MINDIST;
point=new Point(pos,_3bad.y);
}else{
point=new Point(_3bad.x-(xDiff/2),_3bad.y);
}
}
}
if(yDiff>0){
dir=UP;
}else{
dir=DOWN;
}
}
}else{
if(_3bae==DOWN){
if(((xDiff*xDiff)0){
point=new Point(_3bad.x,_3bad.y+this.MINDIST);
}else{
if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){
point=new Point(_3bad.x,toPt.y);
}else{
if(_3bae==toDir){
var pos=Math.max(_3bad.y,toPt.y)+this.MINDIST;
point=new Point(_3bad.x,pos);
}else{
point=new Point(_3bad.x,_3bad.y-(yDiff/2));
}
}
}
if(xDiff>0){
dir=LEFT;
}else{
dir=RIGHT;
}
}
}else{
if(_3bae==UP){
if(((xDiff*xDiff)0)&&(toDir==DOWN)){
point=toPt;
dir=toDir;
}else{
if(yDiff<0){
point=new Point(_3bad.x,_3bad.y-this.MINDIST);
}else{
if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){
point=new Point(_3bad.x,toPt.y);
}else{
if(_3bae==toDir){
var pos=Math.min(_3bad.y,toPt.y)-this.MINDIST;
point=new Point(_3bad.x,pos);
}else{
point=new Point(_3bad.x,_3bad.y-(yDiff/2));
}
}
}
if(xDiff>0){
dir=LEFT;
}else{
dir=RIGHT;
}
}
}
}
}
}
this._route(conn,point,dir,toPt,toDir);
conn.addPoint(_3bad);
};
BezierConnectionRouter=function(_354a){
if(!_354a){
this.cheapRouter=new ManhattanConnectionRouter();
}else{
this.cheapRouter=null;
}
this.iteration=5;
};
BezierConnectionRouter.prototype=new ConnectionRouter;
BezierConnectionRouter.prototype.type="BezierConnectionRouter";
BezierConnectionRouter.prototype.drawBezier=function(_354b,_354c,t,iter){
var n=_354b.length-1;
var q=new Array();
var _3551=n+1;
for(var i=0;i<_3551;i++){
q[i]=new Array();
q[i][0]=_354b[i];
}
for(var j=1;j<=n;j++){
for(var i=0;i<=(n-j);i++){
q[i][j]=new Point((1-t)*q[i][j-1].x+t*q[i+1][j-1].x,(1-t)*q[i][j-1].y+t*q[i+1][j-1].y);
}
}
var c1=new Array();
var c2=new Array();
for(var i=0;i=0){
this.drawBezier(c1,_354c,t,--iter);
this.drawBezier(c2,_354c,t,--iter);
}else{
for(var i=0;i0)&&((yDiff*yDiff)0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){
point=new Point(toPt.x,_355e.y);
}else{
if(_355f==toDir){
var pos=Math.min(_355e.x,toPt.x)-_3564;
point=new Point(pos,_355e.y);
}else{
point=new Point(_355e.x-(xDiff/2),_355e.y);
}
}
}
if(yDiff>0){
dir=UP;
}else{
dir=DOWN;
}
}
}else{
if(_355f==RIGHT){
if((xDiff<0)&&((yDiff*yDiff)0){
point=new Point(_355e.x+_3564,_355e.y);
}else{
if(((yDiff>0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){
point=new Point(toPt.x,_355e.y);
}else{
if(_355f==toDir){
var pos=Math.max(_355e.x,toPt.x)+_3564;
point=new Point(pos,_355e.y);
}else{
point=new Point(_355e.x-(xDiff/2),_355e.y);
}
}
}
if(yDiff>0){
dir=UP;
}else{
dir=DOWN;
}
}
}else{
if(_355f==DOWN){
if(((xDiff*xDiff)0){
point=new Point(_355e.x,_355e.y+_3564);
}else{
if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){
point=new Point(_355e.x,toPt.y);
}else{
if(_355f==toDir){
var pos=Math.max(_355e.y,toPt.y)+_3564;
point=new Point(_355e.x,pos);
}else{
point=new Point(_355e.x,_355e.y-(yDiff/2));
}
}
}
if(xDiff>0){
dir=LEFT;
}else{
dir=RIGHT;
}
}
}else{
if(_355f==UP){
if(((xDiff*xDiff)0)&&(toDir==DOWN)){
point=toPt;
dir=toDir;
}else{
if(yDiff<0){
point=new Point(_355e.x,_355e.y-_3564);
}else{
if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){
point=new Point(_355e.x,toPt.y);
}else{
if(_355f==toDir){
var pos=Math.min(_355e.y,toPt.y)-_3564;
point=new Point(_355e.x,pos);
}else{
point=new Point(_355e.x,_355e.y-(yDiff/2));
}
}
}
if(xDiff>0){
dir=LEFT;
}else{
dir=RIGHT;
}
}
}
}
}
}
this._route(_355c,conn,point,dir,toPt,toDir);
_355c.push(_355e);
};
FanConnectionRouter=function(){
};
FanConnectionRouter.prototype=new NullConnectionRouter;
FanConnectionRouter.prototype.type="FanConnectionRouter";
FanConnectionRouter.prototype.route=function(conn){
var _40c7=conn.getStartPoint();
var toPt=conn.getEndPoint();
var lines=conn.getSource().getConnections();
var _40ca=new ArrayList();
var index=0;
for(var i=0;i1){
this.routeCollision(conn,index);
}else{
NullConnectionRouter.prototype.route.call(this,conn);
}
};
FanConnectionRouter.prototype.routeNormal=function(conn){
conn.addPoint(conn.getStartPoint());
conn.addPoint(conn.getEndPoint());
};
FanConnectionRouter.prototype.routeCollision=function(conn,index){
var start=conn.getStartPoint();
var end=conn.getEndPoint();
conn.addPoint(start);
var _40d3=10;
var _40d4=new Point((end.x+start.x)/2,(end.y+start.y)/2);
var _40d5=end.getPosition(start);
var ray;
if(_40d5==PositionConstants.SOUTH||_40d5==PositionConstants.EAST){
ray=new Point(end.x-start.x,end.y-start.y);
}else{
ray=new Point(start.x-end.x,start.y-end.y);
}
var _40d7=Math.sqrt(ray.x*ray.x+ray.y*ray.y);
var _40d8=_40d3*ray.x/_40d7;
var _40d9=_40d3*ray.y/_40d7;
var _40da;
if(index%2==0){
_40da=new Point(_40d4.x+(index/2)*(-1*_40d9),_40d4.y+(index/2)*_40d8);
}else{
_40da=new Point(_40d4.x+(index/2)*_40d9,_40d4.y+(index/2)*(-1*_40d8));
}
conn.addPoint(_40da);
conn.addPoint(end);
};
Graphics=function(_3a61,_3a62,_3a63){
this.jsGraphics=_3a61;
this.xt=_3a63.x;
this.yt=_3a63.y;
this.radian=_3a62*Math.PI/180;
this.sinRadian=Math.sin(this.radian);
this.cosRadian=Math.cos(this.radian);
};
Graphics.prototype.setStroke=function(x){
this.jsGraphics.setStroke(x);
};
Graphics.prototype.drawLine=function(x1,y1,x2,y2){
var _x1=this.xt+x1*this.cosRadian-y1*this.sinRadian;
var _y1=this.yt+x1*this.sinRadian+y1*this.cosRadian;
var _x2=this.xt+x2*this.cosRadian-y2*this.sinRadian;
var _y2=this.yt+x2*this.sinRadian+y2*this.cosRadian;
this.jsGraphics.drawLine(_x1,_y1,_x2,_y2);
};
Graphics.prototype.fillRect=function(x,y,w,h){
var x1=this.xt+x*this.cosRadian-y*this.sinRadian;
var y1=this.yt+x*this.sinRadian+y*this.cosRadian;
var x2=this.xt+(x+w)*this.cosRadian-y*this.sinRadian;
var y2=this.yt+(x+w)*this.sinRadian+y*this.cosRadian;
var x3=this.xt+(x+w)*this.cosRadian-(y+h)*this.sinRadian;
var y3=this.yt+(x+w)*this.sinRadian+(y+h)*this.cosRadian;
var x4=this.xt+x*this.cosRadian-(y+h)*this.sinRadian;
var y4=this.yt+x*this.sinRadian+(y+h)*this.cosRadian;
this.jsGraphics.fillPolygon([x1,x2,x3,x4],[y1,y2,y3,y4]);
};
Graphics.prototype.fillPolygon=function(_3a79,_3a7a){
var rotX=new Array();
var rotY=new Array();
for(var i=0;i<_3a79.length;i++){
rotX[i]=this.xt+_3a79[i]*this.cosRadian-_3a7a[i]*this.sinRadian;
rotY[i]=this.yt+_3a79[i]*this.sinRadian+_3a7a[i]*this.cosRadian;
}
this.jsGraphics.fillPolygon(rotX,rotY);
};
Graphics.prototype.setColor=function(color){
this.jsGraphics.setColor(color.getHTMLStyle());
};
Graphics.prototype.drawPolygon=function(_3a7f,_3a80){
var rotX=new Array();
var rotY=new Array();
for(var i=0;i<_3a7f.length;i++){
rotX[i]=this.xt+_3a7f[i]*this.cosRadian-_3a80[i]*this.sinRadian;
rotY[i]=this.yt+_3a7f[i]*this.sinRadian+_3a80[i]*this.cosRadian;
}
this.jsGraphics.drawPolygon(rotX,rotY);
};
Connection=function(){
Line.call(this);
this.sourcePort=null;
this.targetPort=null;
this.sourceDecorator=null;
this.targetDecorator=null;
this.sourceAnchor=new ConnectionAnchor();
this.targetAnchor=new ConnectionAnchor();
this.router=Connection.defaultRouter;
this.lineSegments=new ArrayList();
this.children=new ArrayList();
this.setColor(new Color(0,0,115));
this.setLineWidth(1);
};
Connection.prototype=new Line;
Connection.defaultRouter=new ManhattanConnectionRouter();
Connection.setDefaultRouter=function(_2e24){
Connection.defaultRouter=_2e24;
};
Connection.prototype.disconnect=function(){
if(this.sourcePort!=null){
this.sourcePort.detachMoveListener(this);
this.fireSourcePortRouteEvent();
}
if(this.targetPort!=null){
this.targetPort.detachMoveListener(this);
this.fireTargetPortRouteEvent();
}
};
Connection.prototype.reconnect=function(){
if(this.sourcePort!=null){
this.sourcePort.attachMoveListener(this);
this.fireSourcePortRouteEvent();
}
if(this.targetPort!=null){
this.targetPort.attachMoveListener(this);
this.fireTargetPortRouteEvent();
}
};
Connection.prototype.isResizeable=function(){
return true;
};
Connection.prototype.addFigure=function(_2e25,_2e26){
var entry=new Object();
entry.figure=_2e25;
entry.locator=_2e26;
this.children.add(entry);
if(this.graphics!=null){
this.paint();
}
};
Connection.prototype.setSourceDecorator=function(_2e28){
this.sourceDecorator=_2e28;
if(this.graphics!=null){
this.paint();
}
};
Connection.prototype.setTargetDecorator=function(_2e29){
this.targetDecorator=_2e29;
if(this.graphics!=null){
this.paint();
}
};
Connection.prototype.setSourceAnchor=function(_2e2a){
this.sourceAnchor=_2e2a;
this.sourceAnchor.setOwner(this.sourcePort);
if(this.graphics!=null){
this.paint();
}
};
Connection.prototype.setTargetAnchor=function(_2e2b){
this.targetAnchor=_2e2b;
this.targetAnchor.setOwner(this.targetPort);
if(this.graphics!=null){
this.paint();
}
};
Connection.prototype.setRouter=function(_2e2c){
if(_2e2c!=null){
this.router=_2e2c;
}else{
this.router=new NullConnectionRouter();
}
if(this.graphics!=null){
this.paint();
}
};
Connection.prototype.getRouter=function(){
return this.router;
};
Connection.prototype.paint=function(){
for(var i=0;i0){
window.clearInterval(_3e60.timer);
}
_3e60.timer=window.setInterval(_3e61,30);
}
_3e5c.setCanvas(this);
if(xPos&&yPos){
_3e5c.setPosition(xPos,yPos);
}
if(_3e5c instanceof Line){
this.canvasLines.add(_3e5c);
this.html.appendChild(_3e5c.getHTMLElement());
}else{
var obj=this.canvasLines.getFirstElement();
if(obj==null){
this.html.appendChild(_3e5c.getHTMLElement());
}else{
this.html.insertBefore(_3e5c.getHTMLElement(),obj.getHTMLElement());
}
}
if(!_3e5f){
_3e5c.paint();
}
};
Canvas.prototype.removeFigure=function(_3e63){
if(this.enableSmoothFigureHandling==true){
var oThis=this;
var _3e65=_3e63;
var _3e66=function(){
if(_3e65.alpha>0){
_3e65.setAlpha(Math.max(0,_3e65.alpha-0.05));
}else{
window.clearInterval(_3e65.timer);
_3e65.timer=-1;
oThis.html.removeChild(_3e65.html);
_3e65.setCanvas(null);
}
};
if(_3e65.timer>0){
window.clearInterval(_3e65.timer);
}
_3e65.timer=window.setInterval(_3e66,20);
}else{
this.html.removeChild(_3e63.html);
_3e63.setCanvas(null);
}
if(_3e63 instanceof Line){
this.canvasLines.remove(_3e63);
}
};
Canvas.prototype.getEnableSmoothFigureHandling=function(){
return this.enableSmoothFigureHandling;
};
Canvas.prototype.setEnableSmoothFigureHandling=function(flag){
this.enableSmoothFigureHandling=flag;
};
Canvas.prototype.getWidth=function(){
return parseInt(this.html.style.width);
};
Canvas.prototype.getHeight=function(){
return parseInt(this.html.style.height);
};
Canvas.prototype.setBackgroundImage=function(_3e68,_3e69){
if(_3e68!=null){
if(_3e69){
this.html.style.background="transparent url("+_3e68+") ";
}else{
this.html.style.background="transparent url("+_3e68+") no-repeat";
}
}else{
this.html.style.background="transparent";
}
};
Canvas.prototype.getY=function(){
return this.y;
};
Canvas.prototype.getX=function(){
return this.x;
};
Canvas.prototype.getAbsoluteY=function(){
var el=this.html;
var ot=el.offsetTop;
while((el=el.offsetParent)!=null){
ot+=el.offsetTop;
}
return ot;
};
Canvas.prototype.getAbsoluteX=function(){
var el=this.html;
var ol=el.offsetLeft;
while((el=el.offsetParent)!=null){
ol+=el.offsetLeft;
}
return ol;
};
Canvas.prototype.getScrollLeft=function(){
return this.scrollArea.scrollLeft;
};
Canvas.prototype.getScrollTop=function(){
return this.scrollArea.scrollTop;
};
Workflow=function(id){
if(!id){
return;
}
this.gridWidthX=10;
this.gridWidthY=10;
this.snapToGridHelper=null;
this.verticalSnapToHelperLine=null;
this.horizontalSnapToHelperLine=null;
this.figures=new ArrayList();
this.lines=new ArrayList();
this.commonPorts=new ArrayList();
this.dropTargets=new ArrayList();
this.compartments=new ArrayList();
this.selectionListeners=new ArrayList();
this.dialogs=new ArrayList();
this.toolPalette=null;
this.dragging=false;
this.tooltip=null;
this.draggingLine=null;
this.commandStack=new CommandStack();
this.oldScrollPosLeft=0;
this.oldScrollPosTop=0;
this.currentSelection=null;
this.currentMenu=null;
this.connectionLine=new Line();
this.resizeHandleStart=new LineStartResizeHandle(this);
this.resizeHandleEnd=new LineEndResizeHandle(this);
this.resizeHandle1=new ResizeHandle(this,1);
this.resizeHandle2=new ResizeHandle(this,2);
this.resizeHandle3=new ResizeHandle(this,3);
this.resizeHandle4=new ResizeHandle(this,4);
this.resizeHandle5=new ResizeHandle(this,5);
this.resizeHandle6=new ResizeHandle(this,6);
this.resizeHandle7=new ResizeHandle(this,7);
this.resizeHandle8=new ResizeHandle(this,8);
this.resizeHandleHalfWidth=parseInt(this.resizeHandle2.getWidth()/2);
Canvas.call(this,id);
this.setPanning(false);
if(this.html!=null){
this.html.style.backgroundImage="url(grid_10.png)";
oThis=this;
this.html.tabIndex="0";
var _4116=function(){
var _4117=arguments[0]||window.event;
var diffX=_4117.clientX;
var diffY=_4117.clientY;
var _411a=oThis.getScrollLeft();
var _411b=oThis.getScrollTop();
var _411c=oThis.getAbsoluteX();
var _411d=oThis.getAbsoluteY();
if(oThis.getBestFigure(diffX+_411a-_411c,diffY+_411b-_411d)!=null){
return;
}
var line=oThis.getBestLine(diffX+_411a-_411c,diffY+_411b-_411d,null);
if(line!=null){
line.onContextMenu(diffX+_411a-_411c,diffY+_411b-_411d);
}else{
oThis.onContextMenu(diffX+_411a-_411c,diffY+_411b-_411d);
}
};
this.html.oncontextmenu=function(){
return false;
};
var oThis=this;
var _4120=function(event){
var ctrl=event.ctrlKey;
oThis.onKeyDown(event.keyCode,ctrl);
};
var _4123=function(){
var _4124=arguments[0]||window.event;
var diffX=_4124.clientX;
var diffY=_4124.clientY;
var _4127=oThis.getScrollLeft();
var _4128=oThis.getScrollTop();
var _4129=oThis.getAbsoluteX();
var _412a=oThis.getAbsoluteY();
oThis.onMouseDown(diffX+_4127-_4129,diffY+_4128-_412a);
};
var _412b=function(){
var _412c=arguments[0]||window.event;
if(oThis.currentMenu!=null){
oThis.removeFigure(oThis.currentMenu);
oThis.currentMenu=null;
}
if(_412c.button==2){
return;
}
var diffX=_412c.clientX;
var diffY=_412c.clientY;
var _412f=oThis.getScrollLeft();
var _4130=oThis.getScrollTop();
var _4131=oThis.getAbsoluteX();
var _4132=oThis.getAbsoluteY();
oThis.onMouseUp(diffX+_412f-_4131,diffY+_4130-_4132);
};
var _4133=function(){
var _4134=arguments[0]||window.event;
var diffX=_4134.clientX;
var diffY=_4134.clientY;
var _4137=oThis.getScrollLeft();
var _4138=oThis.getScrollTop();
var _4139=oThis.getAbsoluteX();
var _413a=oThis.getAbsoluteY();
oThis.currentMouseX=diffX+_4137-_4139;
oThis.currentMouseY=diffY+_4138-_413a;
var obj=oThis.getBestFigure(oThis.currentMouseX,oThis.currentMouseY);
if(Drag.currentHover!=null&&obj==null){
var _413c=new DragDropEvent();
_413c.initDragDropEvent("mouseleave",false,oThis);
Drag.currentHover.dispatchEvent(_413c);
}else{
var diffX=_4134.clientX;
var diffY=_4134.clientY;
var _4137=oThis.getScrollLeft();
var _4138=oThis.getScrollTop();
var _4139=oThis.getAbsoluteX();
var _413a=oThis.getAbsoluteY();
oThis.onMouseMove(diffX+_4137-_4139,diffY+_4138-_413a);
}
if(obj==null){
Drag.currentHover=null;
}
if(oThis.tooltip!=null){
if(Math.abs(oThis.currentTooltipX-oThis.currentMouseX)>10||Math.abs(oThis.currentTooltipY-oThis.currentMouseY)>10){
oThis.showTooltip(null);
}
}
};
var _413d=function(_413e){
var _413e=arguments[0]||window.event;
var diffX=_413e.clientX;
var diffY=_413e.clientY;
var _4141=oThis.getScrollLeft();
var _4142=oThis.getScrollTop();
var _4143=oThis.getAbsoluteX();
var _4144=oThis.getAbsoluteY();
var line=oThis.getBestLine(diffX+_4141-_4143,diffY+_4142-_4144,null);
if(line!=null){
line.onDoubleClick();
}
};
if(this.html.addEventListener){
this.html.addEventListener("contextmenu",_4116,false);
this.html.addEventListener("mousemove",_4133,false);
this.html.addEventListener("mouseup",_412b,false);
this.html.addEventListener("mousedown",_4123,false);
this.html.addEventListener("keydown",_4120,false);
this.html.addEventListener("dblclick",_413d,false);
}else{
if(this.html.attachEvent){
this.html.attachEvent("oncontextmenu",_4116);
this.html.attachEvent("onmousemove",_4133);
this.html.attachEvent("onmousedown",_4123);
this.html.attachEvent("onmouseup",_412b);
this.html.attachEvent("onkeydown",_4120);
this.html.attachEvent("ondblclick",_413d);
}else{
throw new Error("Open-jACOB Draw2D not supported in this browser.");
}
}
}
};
Workflow.prototype=new Canvas;
Workflow.prototype.type="Workflow";
Workflow.COLOR_GREEN=new Color(0,255,0);
Workflow.prototype.onScroll=function(){
var _4146=this.getScrollLeft();
var _4147=this.getScrollTop();
var _4148=_4146-this.oldScrollPosLeft;
var _4149=_4147-this.oldScrollPosTop;
for(var i=0;i=0){
window.clearTimeout(this.tooltipTimer);
this.tooltipTimer=-1;
}
}
this.tooltip=_4156;
if(this.tooltip!=null){
this.currentTooltipX=this.currentMouseX;
this.currentTooltipY=this.currentMouseY;
this.addFigure(this.tooltip,this.currentTooltipX+10,this.currentTooltipY+10);
var oThis=this;
var _4159=function(){
oThis.tooltipTimer=-1;
oThis.showTooltip(null);
};
if(_4157==true){
this.tooltipTimer=window.setTimeout(_4159,5000);
}
}
};
Workflow.prototype.showDialog=function(_415a,xPos,yPos){
if(xPos){
this.addFigure(_415a,xPos,yPos);
}else{
this.addFigure(_415a,200,100);
}
this.dialogs.add(_415a);
};
Workflow.prototype.showMenu=function(menu,xPos,yPos){
if(this.menu!=null){
this.html.removeChild(this.menu.getHTMLElement());
this.menu.setWorkflow();
}
this.menu=menu;
if(this.menu!=null){
this.menu.setWorkflow(this);
this.menu.setPosition(xPos,yPos);
this.html.appendChild(this.menu.getHTMLElement());
this.menu.paint();
}
};
Workflow.prototype.onContextMenu=function(x,y){
var menu=this.getContextMenu();
if(menu!=null){
this.showMenu(menu,x,y);
}
};
Workflow.prototype.getContextMenu=function(){
return null;
};
Workflow.prototype.setToolWindow=function(_4163,x,y){
this.toolPalette=_4163;
if(y){
this.addFigure(_4163,x,y);
}else{
this.addFigure(_4163,20,20);
}
this.dialogs.add(_4163);
};
Workflow.prototype.setSnapToGrid=function(flag){
if(flag){
this.snapToGridHelper=new SnapToGrid(this);
}else{
this.snapToGridHelper=null;
}
};
Workflow.prototype.setSnapToGeometry=function(flag){
if(flag){
this.snapToGeometryHelper=new SnapToGeometry(this);
}else{
this.snapToGeometryHelper=null;
}
};
Workflow.prototype.setGridWidth=function(dx,dy){
this.gridWidthX=dx;
this.gridWidthY=dy;
};
Workflow.prototype.addFigure=function(_416a,xPos,yPos){
Canvas.prototype.addFigure.call(this,_416a,xPos,yPos,true);
_416a.setWorkflow(this);
var _416d=this;
if(_416a instanceof CompartmentFigure){
this.compartments.add(_416a);
}
if(_416a instanceof Line){
this.lines.add(_416a);
}else{
this.figures.add(_416a);
_416a.draggable.addEventListener("dragend",function(_416e){
});
_416a.draggable.addEventListener("dragstart",function(_416f){
var _4170=_416d.getFigure(_416f.target.element.id);
if(_4170==null){
return;
}
if(_4170.isSelectable()==false){
return;
}
_416d.showResizeHandles(_4170);
_416d.setCurrentSelection(_4170);
});
_416a.draggable.addEventListener("drag",function(_4171){
var _4172=_416d.getFigure(_4171.target.element.id);
if(_4172==null){
return;
}
if(_4172.isSelectable()==false){
return;
}
_416d.moveResizeHandles(_4172);
});
}
_416a.paint();
this.setDocumentDirty();
};
Workflow.prototype.removeFigure=function(_4173){
Canvas.prototype.removeFigure.call(this,_4173);
this.figures.remove(_4173);
this.lines.remove(_4173);
this.dialogs.remove(_4173);
_4173.setWorkflow(null);
if(_4173 instanceof CompartmentFigure){
this.compartments.remove(_4173);
}
if(_4173 instanceof Connection){
_4173.disconnect();
}
if(this.currentSelection==_4173){
this.setCurrentSelection(null);
}
this.setDocumentDirty();
};
Workflow.prototype.moveFront=function(_4174){
this.html.removeChild(_4174.getHTMLElement());
this.html.appendChild(_4174.getHTMLElement());
};
Workflow.prototype.moveBack=function(_4175){
this.html.removeChild(_4175.getHTMLElement());
this.html.insertBefore(_4175.getHTMLElement(),this.html.firstChild);
};
Workflow.prototype.getBestCompartmentFigure=function(x,y,_4178){
var _4179=null;
for(var i=0;i=0&&a<=b){
return (a);
}else{
if(a>b){
return (b);
}else{
if(a<0){
return ("-"+oo);
}
}
}
};
ColorDialog.prototype.mouseDownH=function(e){
this.slideHSV[0]=this.HSV[0];
var oThis=this;
this.H.onmousemove=function(e){
oThis.dragH(e);
};
this.H.onmouseup=function(e){
oThis.H.onmousemove="";
oThis.H.onmouseup="";
};
this.dragH(e);
};
ColorDialog.prototype.dragH=function(e){
var y=this.XY(e,1)-this.getY()-40;
this.Hslide.style.top=(this.ckHSV(y,this.wH)-5)+"px";
this.slideHSV[0]=this.mkHSV(359,this.wH,this.Hslide.style.top);
this.updateSV();
this.showColor(this.commit());
this.SV.style.backgroundColor="#"+this.hsv2hex(Array(this.HSV[0],100,100));
};
ColorDialog.prototype.mouseDownSV=function(o,e){
this.slideHSV[0]=this.HSV[0];
var oThis=this;
function reset(){
oThis.SV.onmousemove="";
oThis.SV.onmouseup="";
oThis.SVslide.onmousemove="";
oThis.SVslide.onmouseup="";
}
this.SV.onmousemove=function(e){
oThis.dragSV(e);
};
this.SV.onmouseup=reset;
this.SVslide.onmousemove=function(e){
oThis.dragSV(e);
};
this.SVslide.onmouseup=reset;
this.dragSV(e);
};
ColorDialog.prototype.dragSV=function(e){
var x=this.XY(e,0)-this.getX()-1;
var y=this.XY(e,1)-this.getY()-20;
this.SVslide.style.left=this.ckHSV(x,this.wSV)+"px";
this.SVslide.style.top=this.ckHSV(y,this.wSV)+"px";
this.slideHSV[1]=this.mkHSV(100,this.wSV,this.SVslide.style.left);
this.slideHSV[2]=100-this.mkHSV(100,this.wSV,this.SVslide.style.top);
this.updateSV();
};
ColorDialog.prototype.commit=function(){
var r="hsv";
var z={};
var j="";
for(var i=0;i<=r.length-1;i++){
j=r.substr(i,1);
z[i]=(j=="h")?this.maxValue[j]-this.mkHSV(this.maxValue[j],this.wH,this.Hslide.style.top):this.HSV[i];
}
return (this.updateSV(this.hsv2hex(z)));
};
ColorDialog.prototype.updateSV=function(v){
this.HSV=v?this.hex2hsv(v):Array(this.slideHSV[0],this.slideHSV[1],this.slideHSV[2]);
if(!v){
v=this.hsv2hex(Array(this.slideHSV[0],this.slideHSV[1],this.slideHSV[2]));
}
this.showColor(v);
return v;
};
ColorDialog.prototype.loadSV=function(){
var z="";
for(var i=this.SVHeight;i>=0;i--){
z+="
";
}
this.Hmodel.innerHTML=z;
};
ColorDialog.prototype.updateH=function(v){
this.plugHEX.innerHTML=v;
this.HSV=this.hex2hsv(v);
this.SV.style.backgroundColor="#"+this.hsv2hex(Array(this.HSV[0],100,100));
this.SVslide.style.top=(parseInt(this.wSV-this.wSV*(this.HSV[1]/100))+20)+"px";
this.SVslide.style.left=(parseInt(this.wSV*(this.HSV[1]/100))+5)+"px";
this.Hslide.style.top=(parseInt(this.wH*((this.maxValue["h"]-this.HSV[0])/this.maxValue["h"]))-7)+"px";
};
ColorDialog.prototype.toHex=function(v){
v=Math.round(Math.min(Math.max(0,v),255));
return ("0123456789ABCDEF".charAt((v-v%16)/16)+"0123456789ABCDEF".charAt(v%16));
};
ColorDialog.prototype.hex2rgb=function(r){
return ({0:parseInt(r.substr(0,2),16),1:parseInt(r.substr(2,2),16),2:parseInt(r.substr(4,2),16)});
};
ColorDialog.prototype.rgb2hex=function(r){
return (this.toHex(r[0])+this.toHex(r[1])+this.toHex(r[2]));
};
ColorDialog.prototype.hsv2hex=function(h){
return (this.rgb2hex(this.hsv2rgb(h)));
};
ColorDialog.prototype.hex2hsv=function(v){
return (this.rgb2hsv(this.hex2rgb(v)));
};
ColorDialog.prototype.rgb2hsv=function(r){
var max=Math.max(r[0],r[1],r[2]);
var delta=max-Math.min(r[0],r[1],r[2]);
var H;
var S;
var V;
if(max!=0){
S=Math.round(delta/max*100);
if(r[0]==max){
H=(r[1]-r[2])/delta;
}else{
if(r[1]==max){
H=2+(r[2]-r[0])/delta;
}else{
if(r[2]==max){
H=4+(r[0]-r[1])/delta;
}
}
}
var H=Math.min(Math.round(H*60),360);
if(H<0){
H+=360;
}
}
return ({0:H?H:0,1:S?S:0,2:Math.round((max/255)*100)});
};
ColorDialog.prototype.hsv2rgb=function(r){
var R;
var B;
var G;
var S=r[1]/100;
var V=r[2]/100;
var H=r[0]/360;
if(S>0){
if(H>=1){
H=0;
}
H=6*H;
F=H-Math.floor(H);
A=Math.round(255*V*(1-S));
B=Math.round(255*V*(1-(S*F)));
C=Math.round(255*V*(1-(S*(1-F))));
V=Math.round(255*V);
switch(Math.floor(H)){
case 0:
R=V;
G=C;
B=A;
break;
case 1:
R=B;
G=V;
B=A;
break;
case 2:
R=A;
G=V;
B=C;
break;
case 3:
R=A;
G=B;
B=V;
break;
case 4:
R=C;
G=A;
B=V;
break;
case 5:
R=V;
G=A;
B=B;
break;
}
return ({0:R?R:0,1:G?G:0,2:B?B:0});
}else{
return ({0:(V=Math.round(V*255)),1:V,2:V});
}
};
LineColorDialog=function(_2e57){
ColorDialog.call(this);
this.figure=_2e57;
var color=_2e57.getColor();
this.updateH(this.rgb2hex(color.getRed(),color.getGreen(),color.getBlue()));
};
LineColorDialog.prototype=new ColorDialog;
LineColorDialog.prototype.type="LineColorDialog";
LineColorDialog.prototype.onOk=function(){
var _2e59=this.workflow;
ColorDialog.prototype.onOk.call(this);
if(typeof this.figure.setColor=="function"){
_2e59.getCommandStack().execute(new CommandSetColor(this.figure,this.getSelectedColor()));
if(_2e59.getCurrentSelection()==this.figure){
_2e59.setCurrentSelection(this.figure);
}
}
};
BackgroundColorDialog=function(_40a6){
ColorDialog.call(this);
this.figure=_40a6;
var color=_40a6.getBackgroundColor();
if(color!=null){
this.updateH(this.rgb2hex(color.getRed(),color.getGreen(),color.getBlue()));
}
};
BackgroundColorDialog.prototype=new ColorDialog;
BackgroundColorDialog.prototype.type="BackgroundColorDialog";
BackgroundColorDialog.prototype.onOk=function(){
var _40a8=this.workflow;
ColorDialog.prototype.onOk.call(this);
if(typeof this.figure.setBackgroundColor=="function"){
_40a8.getCommandStack().execute(new CommandSetBackgroundColor(this.figure,this.getSelectedColor()));
if(_40a8.getCurrentSelection()==this.figure){
_40a8.setCurrentSelection(this.figure);
}
}
};
AnnotationDialog=function(_2e5e){
this.figure=_2e5e;
Dialog.call(this);
this.setDimension(400,100);
};
AnnotationDialog.prototype=new Dialog;
AnnotationDialog.prototype.type="AnnotationDialog";
AnnotationDialog.prototype.createHTMLElement=function(){
var item=Dialog.prototype.createHTMLElement.call(this);
var _2e60=document.createElement("form");
_2e60.style.position="absolute";
_2e60.style.left="10px";
_2e60.style.top="30px";
_2e60.style.width="375px";
_2e60.style.font="normal 10px verdana";
item.appendChild(_2e60);
this.label=document.createTextNode("Text");
_2e60.appendChild(this.label);
this.input=document.createElement("input");
this.input.style.border="1px solid gray";
this.input.style.font="normal 10px verdana";
this.input.type="text";
var value=this.figure.getText();
if(value){
this.input.value=value;
}else{
this.input.value="";
}
this.input.style.width="100%";
_2e60.appendChild(this.input);
this.input.focus();
return item;
};
AnnotationDialog.prototype.onOk=function(){
this.workflow.getCommandStack().execute(new CommandSetText(this.figure,this.input.value));
this.workflow.removeFigure(this);
};
Command=function(label){
this.label=label;
};
Command.prototype.type="Command";
Command.prototype.getLabel=function(){
};
Command.prototype.canExecute=function(){
return true;
};
Command.prototype.execute=function(){
};
Command.prototype.undo=function(){
};
Command.prototype.redo=function(){
};
CommandStack=function(){
this.undostack=new Array();
this.redostack=new Array();
this.maxundo=50;
this.eventListeners=new ArrayList();
};
CommandStack.PRE_EXECUTE=1;
CommandStack.PRE_REDO=2;
CommandStack.PRE_UNDO=4;
CommandStack.POST_EXECUTE=8;
CommandStack.POST_REDO=16;
CommandStack.POST_UNDO=32;
CommandStack.POST_MASK=CommandStack.POST_EXECUTE|CommandStack.POST_UNDO|CommandStack.POST_REDO;
CommandStack.PRE_MASK=CommandStack.PRE_EXECUTE|CommandStack.PRE_UNDO|CommandStack.PRE_REDO;
CommandStack.prototype.type="CommandStack";
CommandStack.prototype.setUndoLimit=function(count){
this.maxundo=count;
};
CommandStack.prototype.markSaveLocation=function(){
this.undostack=new Array();
this.redostack=new Array();
};
CommandStack.prototype.execute=function(_3f6c){
if(_3f6c.canExecute()==false){
return;
}
this.notifyListeners(_3f6c,CommandStack.PRE_EXECUTE);
this.undostack.push(_3f6c);
_3f6c.execute();
this.redostack=new Array();
if(this.undostack.length>this.maxundo){
this.undostack=this.undostack.slice(this.undostack.length-this.maxundo);
}
this.notifyListeners(_3f6c,CommandStack.POST_EXECUTE);
};
CommandStack.prototype.undo=function(){
var _3f6d=this.undostack.pop();
if(_3f6d){
this.notifyListeners(_3f6d,CommandStack.PRE_UNDO);
this.redostack.push(_3f6d);
_3f6d.undo();
this.notifyListeners(_3f6d,CommandStack.POST_UNDO);
}
};
CommandStack.prototype.redo=function(){
var _3f6e=this.redostack.pop();
if(_3f6e){
this.notifyListeners(_3f6e,CommandStack.PRE_REDO);
this.undostack.push(_3f6e);
_3f6e.redo();
this.notifyListeners(_3f6e,CommandStack.POST_REDO);
}
};
CommandStack.prototype.canRedo=function(){
return this.redostack.length>0;
};
CommandStack.prototype.canUndo=function(){
return this.undostack.length>0;
};
CommandStack.prototype.addCommandStackEventListener=function(_3f6f){
this.eventListeners.add(_3f6f);
};
CommandStack.prototype.removeCommandStackEventListener=function(_3f70){
this.eventListeners.remove(_3f70);
};
CommandStack.prototype.notifyListeners=function(_3f71,state){
var event=new CommandStackEvent(_3f71,state);
var size=this.eventListeners.getSize();
for(var i=0;i