
/**This notice must be untouched at all times.
This is the COMPRESSED version of Open-jACOB Draw2D
WebSite: http://www.openjacob.org
Copyright: 2006 Andreas Herz. All rights reserved.
Created: 5.11.2006 by Andreas Herz (Web: http://www.freegroup.de )
LICENSE: LGPL
**/
var draw2d=new Object();draw2d.Event=function(){this.type=null;this.target=null;this.relatedTarget=null;this.cancelable=false;this.timeStamp=null;this.returnValue=true;};draw2d.Event.prototype.initEvent=function(sType,_5272){this.type=sType;this.cancelable=_5272;this.timeStamp=(new Date()).getTime();};draw2d.Event.prototype.preventDefault=function(){if(this.cancelable){this.returnValue=false;}};draw2d.Event.fireDOMEvent=function(_5273,_5274){if(document.createEvent){var evt=document.createEvent("Events");evt.initEvent(_5273,true,true);_5274.dispatchEvent(evt);}else{if(document.createEventObject){var evt=document.createEventObject();_5274.fireEvent("on"+_5273,evt);}}};draw2d.EventTarget=function(){this.eventhandlers=new Object();};draw2d.EventTarget.prototype.addEventListener=function(sType,_5277){if(typeof this.eventhandlers[sType]=="undefined"){this.eventhandlers[sType]=new Array;}this.eventhandlers[sType][this.eventhandlers[sType].length]=_5277;};draw2d.EventTarget.prototype.dispatchEvent=function(_5278){_5278.target=this;if(typeof this.eventhandlers[_5278.type]!="undefined"){for(var i=0;i<this.eventhandlers[_5278.type].length;i++){this.eventhandlers[_5278.type][i](_5278);}}return _5278.returnValue;};draw2d.EventTarget.prototype.removeEventListener=function(sType,_527b){if(typeof this.eventhandlers[sType]!="undefined"){var _527c=new Array;for(var i=0;i<this.eventhandlers[sType].length;i++){if(this.eventhandlers[sType][i]!=_527b){_527c[_527c.length]=this.eventhandlers[sType][i];}}this.eventhandlers[sType]=_527c;}};draw2d.ArrayList=function(){this.increment=10;this.size=0;this.data=new Array(this.increment);};draw2d.ArrayList.EMPTY_LIST=new draw2d.ArrayList();draw2d.ArrayList.prototype.reverse=function(){var _4df3=new Array(this.size);for(var i=0;i<this.size;i++){_4df3[i]=this.data[this.size-i-1];}this.data=_4df3;};draw2d.ArrayList.prototype.getCapacity=function(){return this.data.length;};draw2d.ArrayList.prototype.getSize=function(){return this.size;};draw2d.ArrayList.prototype.isEmpty=function(){return this.getSize()==0;};draw2d.ArrayList.prototype.getLastElement=function(){if(this.data[this.getSize()-1]!=null){return this.data[this.getSize()-1];}};draw2d.ArrayList.prototype.getFirstElement=function(){if(this.data[0]!=null){return this.data[0];}};draw2d.ArrayList.prototype.get=function(i){return this.data[i];};draw2d.ArrayList.prototype.add=function(obj){if(this.getSize()==this.data.length){this.resize();}this.data[this.size++]=obj;};draw2d.ArrayList.prototype.remove=function(obj){var index=this.indexOf(obj);if(index>=0){return this.removeElementAt(index);}return null;};draw2d.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++;};draw2d.ArrayList.prototype.removeElementAt=function(index){var _4dfd=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 _4dfd;};draw2d.ArrayList.prototype.removeAllElements=function(){this.size=0;for(var i=0;i<this.data.length;i++){this.data[i]=null;}};draw2d.ArrayList.prototype.indexOf=function(obj){for(var i=0;i<this.getSize();i++){if(this.data[i]==obj){return i;}}return -1;};draw2d.ArrayList.prototype.contains=function(obj){for(var i=0;i<this.getSize();i++){if(this.data[i]==obj){return true;}}return false;};draw2d.ArrayList.prototype.resize=function(){newData=new Array(this.data.length+this.increment);for(var i=0;i<this.data.length;i++){newData[i]=this.data[i];}this.data=newData;};draw2d.ArrayList.prototype.trimToSize=function(){var temp=new Array(this.getSize());for(var i=0;i<this.getSize();i++){temp[i]=this.data[i];}this.size=temp.length-1;this.data=temp;};draw2d.ArrayList.prototype.sort=function(f){var i,j;var _4e09;var _4e0a;var _4e0b;var _4e0c;for(i=1;i<this.getSize();i++){_4e0a=this.data[i];_4e09=_4e0a[f];j=i-1;_4e0b=this.data[j];_4e0c=_4e0b[f];while(j>=0&&_4e0c>_4e09){this.data[j+1]=this.data[j];j--;if(j>=0){_4e0b=this.data[j];_4e0c=_4e0b[f];}}this.data[j+1]=_4e0a;}};draw2d.ArrayList.prototype.clone=function(){var _4e0d=new draw2d.ArrayList(this.size);for(var i=0;i<this.size;i++){_4e0d.add(this.data[i]);}return _4e0d;};draw2d.ArrayList.prototype.overwriteElementAt=function(obj,index){this.data[index]=obj;};function trace(_50c1){var _50c2=openwindow("about:blank",700,400);_50c2.document.writeln("<pre>"+_50c1+"</pre>");}function openwindow(url,width,_50c5){var left=(screen.width-width)/2;var top=(screen.height-_50c5)/2;property="left="+left+", top="+top+", toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,alwaysRaised,width="+width+",height="+_50c5;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+" --&gt; "+obj[i]);}}catch(e){}}for(var i in obj){try{if(typeof obj[i]=="function"){trace(i+" --&gt; "+obj[i]);}}catch(e){}}trace("----------------------------------------------------------------------------");}draw2d.Drag=function(){};draw2d.Drag.current=null;draw2d.Drag.currentTarget=null;draw2d.Drag.dragging=false;draw2d.Drag.isDragging=function(){return this.dragging;};draw2d.Drag.setCurrent=function(_40dc){this.current=_40dc;this.dragging=true;};draw2d.Drag.getCurrent=function(){return this.current;};draw2d.Drag.clearCurrent=function(){this.current=null;this.dragging=false;};draw2d.Draggable=function(_40dd,_40de){draw2d.EventTarget.call(this);this.construct(_40dd,_40de);this.diffX=0;this.diffY=0;this.targets=new draw2d.ArrayList();};draw2d.Draggable.prototype=new draw2d.EventTarget;draw2d.Draggable.prototype.addDropTarget=function(_40df){this.targets.add(_40df);};draw2d.Draggable.prototype.construct=function(_40e0,_40e1){this.element=_40e0;this.constraints=_40e1;var oThis=this;var _40e3=function(){var _40e4=new draw2d.DragDropEvent();_40e4.initDragDropEvent("dblclick",true);oThis.dispatchEvent(_40e4);var _40e5=arguments[0]||window.event;_40e5.cancelBubble=true;_40e5.returnValue=false;};var _40e6=function(){var _40e7=arguments[0]||window.event;var _40e8=new draw2d.DragDropEvent();var _40e9=oThis.node.workflow.getAbsoluteX();var _40ea=oThis.node.workflow.getAbsoluteY();var _40eb=oThis.node.workflow.getScrollLeft();var _40ec=oThis.node.workflow.getScrollTop();_40e8.x=_40e7.clientX-oThis.element.offsetLeft+_40eb-_40e9;_40e8.y=_40e7.clientY-oThis.element.offsetTop+_40ec-_40ea;if(_40e7.button==2){_40e8.initDragDropEvent("contextmenu",true);oThis.dispatchEvent(_40e8);}else{_40e8.initDragDropEvent("dragstart",true);if(oThis.dispatchEvent(_40e8)){oThis.diffX=_40e7.clientX-oThis.element.offsetLeft;oThis.diffY=_40e7.clientY-oThis.element.offsetTop;draw2d.Drag.setCurrent(oThis);if(oThis.isAttached==true){oThis.detachEventHandlers();}oThis.attachEventHandlers();}}_40e7.cancelBubble=true;_40e7.returnValue=false;};var _40ed=function(){if(draw2d.Drag.getCurrent()==null){var _40ee=arguments[0]||window.event;if(draw2d.Drag.currentHover!=null&&oThis!=draw2d.Drag.currentHover){var _40ef=new draw2d.DragDropEvent();_40ef.initDragDropEvent("mouseleave",false,oThis);draw2d.Drag.currentHover.dispatchEvent(_40ef);}if(oThis!=null&&oThis!=draw2d.Drag.currentHover){var _40ef=new draw2d.DragDropEvent();_40ef.initDragDropEvent("mouseenter",false,oThis);oThis.dispatchEvent(_40ef);}draw2d.Drag.currentHover=oThis;}else{}};if(this.element.addEventListener){this.element.addEventListener("mousemove",_40ed,false);this.element.addEventListener("mousedown",_40e6,false);this.element.addEventListener("dblclick",_40e3,false);}else{if(this.element.attachEvent){this.element.attachEvent("onmousemove",_40ed);this.element.attachEvent("onmousedown",_40e6);this.element.attachEvent("ondblclick",_40e3);}else{throw new Error("Drag not supported in this browser.");}}};draw2d.Draggable.prototype.attachEventHandlers=function(){var oThis=this;oThis.isAttached=true;this.tempMouseMove=function(){var _40f1=arguments[0]||window.event;var _40f2=new draw2d.Point(_40f1.clientX-oThis.diffX,_40f1.clientY-oThis.diffY);if(oThis.node.getCanSnapToHelper()){_40f2=oThis.node.getWorkflow().snapToHelper(oThis.node,_40f2);}oThis.element.style.left=_40f2.x+"px";oThis.element.style.top=_40f2.y+"px";var _40f3=oThis.node.workflow.getScrollLeft();var _40f4=oThis.node.workflow.getScrollTop();var _40f5=oThis.node.workflow.getAbsoluteX();var _40f6=oThis.node.workflow.getAbsoluteY();var _40f7=oThis.getDropTarget(_40f1.clientX+_40f3-_40f5,_40f1.clientY+_40f4-_40f6);var _40f8=oThis.getCompartment(_40f1.clientX+_40f3-_40f5,_40f1.clientY+_40f4-_40f6);if(draw2d.Drag.currentTarget!=null&&_40f7!=draw2d.Drag.currentTarget){var _40f9=new draw2d.DragDropEvent();_40f9.initDragDropEvent("dragleave",false,oThis);draw2d.Drag.currentTarget.dispatchEvent(_40f9);}if(_40f7!=null&&_40f7!=draw2d.Drag.currentTarget){var _40f9=new draw2d.DragDropEvent();_40f9.initDragDropEvent("dragenter",false,oThis);_40f7.dispatchEvent(_40f9);}draw2d.Drag.currentTarget=_40f7;if(draw2d.Drag.currentCompartment!=null&&_40f8!=draw2d.Drag.currentCompartment){var _40f9=new draw2d.DragDropEvent();_40f9.initDragDropEvent("figureleave",false,oThis);draw2d.Drag.currentCompartment.dispatchEvent(_40f9);}if(_40f8!=null&&_40f8.node!=oThis.node&&_40f8!=draw2d.Drag.currentCompartment){var _40f9=new draw2d.DragDropEvent();_40f9.initDragDropEvent("figureenter",false,oThis);_40f8.dispatchEvent(_40f9);}draw2d.Drag.currentCompartment=_40f8;var _40fa=new draw2d.DragDropEvent();_40fa.initDragDropEvent("drag",false);oThis.dispatchEvent(_40fa);};oThis.tempMouseUp=function(){oThis.detachEventHandlers();var _40fb=arguments[0]||window.event;var _40fc=new draw2d.DragDropEvent();_40fc.initDragDropEvent("dragend",false);oThis.dispatchEvent(_40fc);var _40fd=oThis.node.workflow.getScrollLeft();var _40fe=oThis.node.workflow.getScrollTop();var _40ff=oThis.node.workflow.getAbsoluteX();var _4100=oThis.node.workflow.getAbsoluteY();var _4101=oThis.getDropTarget(_40fb.clientX+_40fd-_40ff,_40fb.clientY+_40fe-_4100);var _4102=oThis.getCompartment(_40fb.clientX+_40fd-_40ff,_40fb.clientY+_40fe-_4100);if(_4101!=null){var _4103=new draw2d.DragDropEvent();_4103.initDragDropEvent("drop",false,oThis);_4101.dispatchEvent(_4103);}if(_4102!=null&&_4102.node!=oThis.node){var _4103=new draw2d.DragDropEvent();_4103.initDragDropEvent("figuredrop",false,oThis);_4102.dispatchEvent(_4103);}if(draw2d.Drag.currentTarget!=null){var _4103=new draw2d.DragDropEvent();_4103.initDragDropEvent("dragleave",false,oThis);draw2d.Drag.currentTarget.dispatchEvent(_4103);draw2d.Drag.currentTarget=null;}draw2d.Drag.currentCompartment=null;draw2d.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.");}}};draw2d.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.");}}};draw2d.Draggable.prototype.getDropTarget=function(x,y){for(var i=0;i<this.targets.getSize();i++){var _4107=this.targets.get(i);if(_4107.node.isOver(x,y)&&_4107.node!=this.node){return _4107;}}return null;};draw2d.Draggable.prototype.getCompartment=function(x,y){var _410a=null;for(var i=0;i<this.node.workflow.compartments.getSize();i++){var _410c=this.node.workflow.compartments.get(i);if(_410c.isOver(x,y)&&_410c!=this.node){if(_410a==null){_410a=_410c;}else{if(_410a.getZOrder()<_410c.getZOrder()){_410a=_410c;}}}}return _410a==null?null:_410a.dropable;};draw2d.Draggable.prototype.getLeft=function(){return this.element.offsetLeft;};draw2d.Draggable.prototype.getTop=function(){return this.element.offsetTop;};draw2d.DragDropEvent=function(){draw2d.Event.call(this);};draw2d.DragDropEvent.prototype=new draw2d.Event();draw2d.DragDropEvent.prototype.initDragDropEvent=function(sType,_410e,_410f){this.initEvent(sType,_410e);this.relatedTarget=_410f;};draw2d.DropTarget=function(_4110){draw2d.EventTarget.call(this);this.construct(_4110);};draw2d.DropTarget.prototype=new draw2d.EventTarget;draw2d.DropTarget.prototype.construct=function(_4111){this.element=_4111;};draw2d.DropTarget.prototype.getLeft=function(){var el=this.element;var ol=el.offsetLeft;while((el=el.offsetParent)!=null){ol+=el.offsetLeft;}return ol;};draw2d.DropTarget.prototype.getTop=function(){var el=this.element;var ot=el.offsetTop;while((el=el.offsetParent)!=null){ot+=el.offsetTop;}return ot;};draw2d.DropTarget.prototype.getHeight=function(){return this.element.offsetHeight;};draw2d.DropTarget.prototype.getWidth=function(){return this.element.offsetWidth;};draw2d.PositionConstants=function(){};draw2d.PositionConstants.NORTH=1;draw2d.PositionConstants.SOUTH=4;draw2d.PositionConstants.WEST=8;draw2d.PositionConstants.EAST=16;draw2d.Color=function(red,green,blue){if(typeof green=="undefined"){var rgb=this.hex2rgb(red);this.red=rgb[0];this.green=rgb[1];this.blue=rgb[2];}else{this.red=red;this.green=green;this.blue=blue;}};draw2d.Color.prototype.type="Color";draw2d.Color.prototype.getHTMLStyle=function(){return "rgb("+this.red+","+this.green+","+this.blue+")";};draw2d.Color.prototype.getRed=function(){return this.red;};draw2d.Color.prototype.getGreen=function(){return this.green;};draw2d.Color.prototype.getBlue=function(){return this.blue;};draw2d.Color.prototype.getIdealTextColor=function(){var _42c5=105;var _42c6=(this.red*0.299)+(this.green*0.587)+(this.blue*0.114);return (255-_42c6<_42c5)?new draw2d.Color(0,0,0):new draw2d.Color(255,255,255);};draw2d.Color.prototype.hex2rgb=function(_42c7){_42c7=_42c7.replace("#","");return ({0:parseInt(_42c7.substr(0,2),16),1:parseInt(_42c7.substr(2,2),16),2:parseInt(_42c7.substr(4,2),16)});};draw2d.Color.prototype.hex=function(){return (this.int2hex(this.red)+this.int2hex(this.green)+this.int2hex(this.blue));};draw2d.Color.prototype.int2hex=function(v){v=Math.round(Math.min(Math.max(0,v),255));return ("0123456789ABCDEF".charAt((v-v%16)/16)+"0123456789ABCDEF".charAt(v%16));};draw2d.Color.prototype.darker=function(_42c9){var red=parseInt(Math.round(this.getRed()*(1-_42c9)));var green=parseInt(Math.round(this.getGreen()*(1-_42c9)));var blue=parseInt(Math.round(this.getBlue()*(1-_42c9)));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 draw2d.Color(red,green,blue);};draw2d.Color.prototype.lighter=function(_42cd){var red=parseInt(Math.round(this.getRed()*(1+_42cd)));var green=parseInt(Math.round(this.getGreen()*(1+_42cd)));var blue=parseInt(Math.round(this.getBlue()*(1+_42cd)));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 draw2d.Color(red,green,blue);};draw2d.Point=function(x,y){this.x=x;this.y=y;};draw2d.Point.prototype.type="Point";draw2d.Point.prototype.getX=function(){return this.x;};draw2d.Point.prototype.getY=function(){return this.y;};draw2d.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 draw2d.PositionConstants.WEST;}return draw2d.PositionConstants.EAST;}if(dy<0){return draw2d.PositionConstants.NORTH;}return draw2d.PositionConstants.SOUTH;};draw2d.Point.prototype.equals=function(o){return this.x==o.x&&this.y==o.y;};draw2d.Point.prototype.getDistance=function(other){return Math.sqrt((this.x-other.x)*(this.x-other.x)+(this.y-other.y)*(this.y-other.y));};draw2d.Point.prototype.getTranslated=function(other){return new draw2d.Point(this.x+other.x,this.y+other.y);};draw2d.Dimension=function(x,y,w,h){draw2d.Point.call(this,x,y);this.w=w;this.h=h;};draw2d.Dimension.prototype=new draw2d.Point;draw2d.Dimension.prototype.type="Dimension";draw2d.Dimension.prototype.translate=function(dx,dy){this.x+=dx;this.y+=dy;return this;};draw2d.Dimension.prototype.resize=function(dw,dh){this.w+=dw;this.h+=dh;return this;};draw2d.Dimension.prototype.setBounds=function(rect){this.x=rect.x;this.y=rect.y;this.w=rect.w;this.h=rect.h;return this;};draw2d.Dimension.prototype.isEmpty=function(){return this.w<=0||this.h<=0;};draw2d.Dimension.prototype.getWidth=function(){return this.w;};draw2d.Dimension.prototype.getHeight=function(){return this.h;};draw2d.Dimension.prototype.getRight=function(){return this.x+this.w;};draw2d.Dimension.prototype.getBottom=function(){return this.y+this.h;};draw2d.Dimension.prototype.getTopLeft=function(){return new draw2d.Point(this.x,this.y);};draw2d.Dimension.prototype.getCenter=function(){return new draw2d.Point(this.x+this.w/2,this.y+this.h/2);};draw2d.Dimension.prototype.getBottomRight=function(){return new draw2d.Point(this.x+this.w,this.y+this.h);};draw2d.Dimension.prototype.equals=function(o){return this.x==o.x&&this.y==o.y&&this.w==o.w&&this.h==o.h;};draw2d.SnapToHelper=function(_448d){this.workflow=_448d;};draw2d.SnapToHelper.NORTH=1;draw2d.SnapToHelper.SOUTH=4;draw2d.SnapToHelper.WEST=8;draw2d.SnapToHelper.EAST=16;draw2d.SnapToHelper.NORTH_EAST=draw2d.SnapToHelper.NORTH|draw2d.SnapToHelper.EAST;draw2d.SnapToHelper.NORTH_WEST=draw2d.SnapToHelper.NORTH|draw2d.SnapToHelper.WEST;draw2d.SnapToHelper.SOUTH_EAST=draw2d.SnapToHelper.SOUTH|draw2d.SnapToHelper.EAST;draw2d.SnapToHelper.SOUTH_WEST=draw2d.SnapToHelper.SOUTH|draw2d.SnapToHelper.WEST;draw2d.SnapToHelper.NORTH_SOUTH=draw2d.SnapToHelper.NORTH|draw2d.SnapToHelper.SOUTH;draw2d.SnapToHelper.EAST_WEST=draw2d.SnapToHelper.EAST|draw2d.SnapToHelper.WEST;draw2d.SnapToHelper.NSEW=draw2d.SnapToHelper.NORTH_SOUTH|draw2d.SnapToHelper.EAST_WEST;draw2d.SnapToHelper.prototype.snapPoint=function(_448e,_448f,_4490){return _448f;};draw2d.SnapToHelper.prototype.snapRectangle=function(_4491,_4492){return _4491;};draw2d.SnapToHelper.prototype.onSetDocumentDirty=function(){};draw2d.SnapToGrid=function(_450d){draw2d.SnapToHelper.call(this,_450d);};draw2d.SnapToGrid.prototype=new draw2d.SnapToHelper;draw2d.SnapToGrid.prototype.snapPoint=function(_450e,_450f,_4510){_4510.x=this.workflow.gridWidthX*Math.floor(((_450f.x+this.workflow.gridWidthX/2)/this.workflow.gridWidthX));_4510.y=this.workflow.gridWidthY*Math.floor(((_450f.y+this.workflow.gridWidthY/2)/this.workflow.gridWidthY));return 0;};draw2d.SnapToGrid.prototype.snapRectangle=function(_4511,_4512){_4512.x=_4511.x;_4512.y=_4511.y;_4512.w=_4511.w;_4512.h=_4511.h;return 0;};draw2d.SnapToGeometryEntry=function(type,_4e3d){this.type=type;this.location=_4e3d;};draw2d.SnapToGeometryEntry.prototype.getLocation=function(){return this.location;};draw2d.SnapToGeometryEntry.prototype.getType=function(){return this.type;};draw2d.SnapToGeometry=function(_4280){draw2d.SnapToHelper.call(this,_4280);};draw2d.SnapToGeometry.prototype=new draw2d.SnapToHelper;draw2d.SnapToGeometry.THRESHOLD=5;draw2d.SnapToGeometry.prototype.snapPoint=function(_4281,_4282,_4283){if(this.rows==null||this.cols==null){this.populateRowsAndCols();}if((_4281&draw2d.SnapToHelper.EAST)!=0){var _4284=this.getCorrectionFor(this.cols,_4282.getX()-1,1);if(_4284!=draw2d.SnapToGeometry.THRESHOLD){_4281&=~draw2d.SnapToHelper.EAST;_4283.x+=_4284;}}if((_4281&draw2d.SnapToHelper.WEST)!=0){var _4285=this.getCorrectionFor(this.cols,_4282.getX(),-1);if(_4285!=draw2d.SnapToGeometry.THRESHOLD){_4281&=~draw2d.SnapToHelper.WEST;_4283.x+=_4285;}}if((_4281&draw2d.SnapToHelper.SOUTH)!=0){var _4286=this.getCorrectionFor(this.rows,_4282.getY()-1,1);if(_4286!=draw2d.SnapToGeometry.THRESHOLD){_4281&=~draw2d.SnapToHelper.SOUTH;_4283.y+=_4286;}}if((_4281&draw2d.SnapToHelper.NORTH)!=0){var _4287=this.getCorrectionFor(this.rows,_4282.getY(),-1);if(_4287!=draw2d.SnapToGeometry.THRESHOLD){_4281&=~draw2d.SnapToHelper.NORTH;_4283.y+=_4287;}}return _4281;};draw2d.SnapToGeometry.prototype.snapRectangle=function(_4288,_4289){var _428a=_4288.getTopLeft();var _428b=_4288.getBottomRight();var _428c=this.snapPoint(draw2d.SnapToHelper.NORTH_WEST,_4288.getTopLeft(),_428a);_4289.x=_428a.x;_4289.y=_428a.y;var _428d=this.snapPoint(draw2d.SnapToHelper.SOUTH_EAST,_4288.getBottomRight(),_428b);if(_428c&draw2d.SnapToHelper.WEST){_4289.x=_428b.x-_4288.getWidth();}if(_428c&draw2d.SnapToHelper.NORTH){_4289.y=_428b.y-_4288.getHeight();}return _428c|_428d;};draw2d.SnapToGeometry.prototype.populateRowsAndCols=function(){this.rows=new Array();this.cols=new Array();var _428e=this.workflow.getDocument().getFigures();var index=0;for(var i=0;i<_428e.length;i++){var _4291=_428e[i];if(_4291!=this.workflow.getCurrentSelection()){var _4292=_4291.getBounds();this.cols[index*3]=new draw2d.SnapToGeometryEntry(-1,_4292.getX());this.rows[index*3]=new draw2d.SnapToGeometryEntry(-1,_4292.getY());this.cols[index*3+1]=new draw2d.SnapToGeometryEntry(0,_4292.x+(_4292.getWidth()-1)/2);this.rows[index*3+1]=new draw2d.SnapToGeometryEntry(0,_4292.y+(_4292.getHeight()-1)/2);this.cols[index*3+2]=new draw2d.SnapToGeometryEntry(1,_4292.getRight()-1);this.rows[index*3+2]=new draw2d.SnapToGeometryEntry(1,_4292.getBottom()-1);index++;}}};draw2d.SnapToGeometry.prototype.getCorrectionFor=function(_4293,value,side){var _4296=draw2d.SnapToGeometry.THRESHOLD;var _4297=draw2d.SnapToGeometry.THRESHOLD;for(var i=0;i<_4293.length;i++){var entry=_4293[i];var _429a;if(entry.type==-1&&side!=0){_429a=Math.abs(value-entry.location);if(_429a<_4296){_4296=_429a;_4297=entry.location-value;}}else{if(entry.type==0&&side==0){_429a=Math.abs(value-entry.location);if(_429a<_4296){_4296=_429a;_4297=entry.location-value;}}else{if(entry.type==1&&side!=0){_429a=Math.abs(value-entry.location);if(_429a<_4296){_4296=_429a;_4297=entry.location-value;}}}}}return _4297;};draw2d.SnapToGeometry.prototype.onSetDocumentDirty=function(){this.rows=null;this.cols=null;};draw2d.Border=function(){this.color=null;};draw2d.Border.prototype.type="Border";draw2d.Border.prototype.dispose=function(){this.color=null;};draw2d.Border.prototype.getHTMLStyle=function(){return "";};draw2d.Border.prototype.setColor=function(c){this.color=c;};draw2d.Border.prototype.getColor=function(){return this.color;};draw2d.Border.prototype.refresh=function(){};draw2d.LineBorder=function(width){draw2d.Border.call(this);this.width=1;if(width){this.width=width;}this.figure=null;};draw2d.LineBorder.prototype=new draw2d.Border;draw2d.LineBorder.prototype.type="LineBorder";draw2d.LineBorder.prototype.dispose=function(){draw2d.Border.prototype.dispose.call(this);this.figure=null;};draw2d.LineBorder.prototype.setLineWidth=function(w){this.width=w;if(this.figure!=null){this.figure.html.style.border=this.getHTMLStyle();}};draw2d.LineBorder.prototype.getHTMLStyle=function(){if(this.getColor()!=null){return this.width+"px solid "+this.getColor().getHTMLStyle();}return this.width+"px solid black";};draw2d.LineBorder.prototype.refresh=function(){this.setLineWidth(this.width);};draw2d.Figure=function(){this.construct();};draw2d.Figure.prototype.type="Figure";draw2d.Figure.ZOrderBaseIndex=100;draw2d.Figure.setZOrderBaseIndex=function(index){draw2d.Figure.ZOrderBaseIndex=index;};draw2d.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 draw2d.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 Object();};draw2d.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);}};draw2d.Figure.prototype.getProperties=function(){return this.properties;};draw2d.Figure.prototype.getProperty=function(key){return this.properties[key];};draw2d.Figure.prototype.setProperty=function(key,value){this.properties[key]=value;this.setDocumentDirty();};draw2d.Figure.prototype.getId=function(){return this.id;};draw2d.Figure.prototype.setCanvas=function(_4dbc){this.canvas=_4dbc;};draw2d.Figure.prototype.getWorkflow=function(){return this.workflow;};draw2d.Figure.prototype.setWorkflow=function(_4dbd){if(this.draggable==null){this.html.tabIndex="0";var oThis=this;this.keyDown=function(event){event.cancelBubble=true;event.returnValue=false;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 draw2d.Draggable(this.html,draw2d.Draggable.DRAG_X|draw2d.Draggable.DRAG_Y);this.draggable.node=this;this.tmpContextMenu=function(_4dc0){oThis.onContextMenu(oThis.x+_4dc0.x,_4dc0.y+oThis.y);};this.tmpMouseEnter=function(_4dc1){oThis.onMouseEnter();};this.tmpMouseLeave=function(_4dc2){oThis.onMouseLeave();};this.tmpDragend=function(_4dc3){oThis.onDragend();};this.tmpDragstart=function(_4dc4){var w=oThis.workflow;w.showMenu(null);if(oThis.workflow.toolPalette&&oThis.workflow.toolPalette.activeTool){_4dc4.returnValue=false;oThis.workflow.onMouseDown(oThis.x+_4dc4.x,_4dc4.y+oThis.y);oThis.workflow.onMouseUp(oThis.x+_4dc4.x,_4dc4.y+oThis.y);return;}_4dc4.returnValue=oThis.onDragstart(_4dc4.x,_4dc4.y);};this.tmpDrag=function(_4dc6){oThis.onDrag();};this.tmpDoubleClick=function(_4dc7){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=_4dbd;};draw2d.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=""+draw2d.Figure.ZOrderBaseIndex;return item;};draw2d.Figure.prototype.setParent=function(_4dc9){this.parent=_4dc9;};draw2d.Figure.prototype.getParent=function(){return this.parent;};draw2d.Figure.prototype.getZOrder=function(){return this.html.style.zIndex;};draw2d.Figure.prototype.setZOrder=function(index){this.html.style.zIndex=index;};draw2d.Figure.prototype.hasFixedPosition=function(){return false;};draw2d.Figure.prototype.getMinWidth=function(){return 5;};draw2d.Figure.prototype.getMinHeight=function(){return 5;};draw2d.Figure.prototype.getHTMLElement=function(){if(this.html==null){this.html=this.createHTMLElement();}return this.html;};draw2d.Figure.prototype.paint=function(){};draw2d.Figure.prototype.setBorder=function(_4dcb){if(this.border!=null){this.border.figure=null;}this.border=_4dcb;this.border.figure=this;this.border.refresh();this.setDocumentDirty();};draw2d.Figure.prototype.onContextMenu=function(x,y){var menu=this.getContextMenu();if(menu!=null){this.workflow.showMenu(menu,x,y);}};draw2d.Figure.prototype.getContextMenu=function(){return null;};draw2d.Figure.prototype.onDoubleClick=function(){};draw2d.Figure.prototype.onMouseEnter=function(){};draw2d.Figure.prototype.onMouseLeave=function(){};draw2d.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();};draw2d.Figure.prototype.onDragend=function(){if(this.getWorkflow().getEnableSmoothFigureHandling()==true){var _4dcf=this;var _4dd0=function(){if(_4dcf.alpha<1){_4dcf.setAlpha(Math.min(1,_4dcf.alpha+0.05));}else{window.clearInterval(_4dcf.timer);_4dcf.timer=-1;}};if(_4dcf.timer>0){window.clearInterval(_4dcf.timer);}_4dcf.timer=window.setInterval(_4dd0,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();};draw2d.Figure.prototype.onDragstart=function(x,y){if(!this.canDrag){return false;}this.command=new draw2d.CommandMove(this,this.x,this.y);return true;};draw2d.Figure.prototype.setCanDrag=function(flag){this.canDrag=flag;if(flag){this.html.style.cursor="move";}else{this.html.style.cursor=null;}};draw2d.Figure.prototype.setAlpha=function(_4dd4){if(this.alpha==_4dd4){return;}try{this.html.style.MozOpacity=_4dd4;}catch(exc){}try{this.html.style.opacity=_4dd4;}catch(exc){}try{var _4dd5=Math.round(_4dd4*100);if(_4dd5>=99){this.html.style.filter="";}else{this.html.style.filter="alpha(opacity="+_4dd5+")";}}catch(exc){}this.alpha=_4dd4;};draw2d.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);}};draw2d.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);}};draw2d.Figure.prototype.isResizeable=function(){return this.resizeable;};draw2d.Figure.prototype.setResizeable=function(flag){this.resizeable=flag;};draw2d.Figure.prototype.isSelectable=function(){return this.selectable;};draw2d.Figure.prototype.setSelectable=function(flag){this.selectable=flag;};draw2d.Figure.prototype.isStrechable=function(){return true;};draw2d.Figure.prototype.isDeleteable=function(){return this.deleteable;};draw2d.Figure.prototype.setDeleteable=function(flag){this.deleteable=flag;};draw2d.Figure.prototype.setCanSnapToHelper=function(flag){this.canSnapToHelper=flag;};draw2d.Figure.prototype.getCanSnapToHelper=function(){return this.canSnapToHelper;};draw2d.Figure.prototype.getSnapToGridAnchor=function(){return this.snapToGridAnchor;};draw2d.Figure.prototype.setSnapToGridAnchor=function(point){this.snapToGridAnchor=point;};draw2d.Figure.prototype.getBounds=function(){return new draw2d.Dimension(this.getX(),this.getY(),this.getWidth(),this.getHeight());};draw2d.Figure.prototype.getWidth=function(){return this.width;};draw2d.Figure.prototype.getHeight=function(){return this.height;};draw2d.Figure.prototype.getY=function(){return this.y;};draw2d.Figure.prototype.getX=function(){return this.x;};draw2d.Figure.prototype.getAbsoluteY=function(){return this.y;};draw2d.Figure.prototype.getAbsoluteX=function(){return this.x;};draw2d.Figure.prototype.onKeyDown=function(_4ddf,ctrl){if(_4ddf==46&&this.isDeleteable()==true){this.workflow.commandStack.execute(new draw2d.CommandDelete(this));}if(ctrl){this.workflow.onKeyDown(_4ddf,ctrl);}};draw2d.Figure.prototype.getPosition=function(){return new draw2d.Point(this.x,this.y);};draw2d.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);};draw2d.Figure.prototype.attachMoveListener=function(_4de7){if(_4de7==null||this.moveListener==null){return;}this.moveListener[_4de7.id]=_4de7;};draw2d.Figure.prototype.detachMoveListener=function(_4de8){if(_4de8==null||this.moveListener==null){return;}this.moveListener[_4de8.id]=null;};draw2d.Figure.prototype.fireMoveEvent=function(){this.setDocumentDirty();for(key in this.moveListener){var _4de9=this.moveListener[key];if(_4de9!=null){_4de9.onOtherFigureMoved(this);}}};draw2d.Figure.prototype.onOtherFigureMoved=function(_4dea){};draw2d.Figure.prototype.setDocumentDirty=function(){if(this.workflow!=null){this.workflow.setDocumentDirty();}};draw2d.Figure.prototype.generateUId=function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var _4dec=10;var _4ded=10;nbTry=0;while(nbTry<1000){var id="";for(var i=0;i<_4dec;i++){var rnum=Math.floor(Math.random()*chars.length);id+=chars.substring(rnum,rnum+1);}elem=document.getElementById(id);if(!elem){return id;}nbTry+=1;}return null;};draw2d.Figure.prototype.disableTextSelection=function(e){if(typeof e.onselectstart!="undefined"){e.onselectstart=function(){return false;};}else{if(typeof e.style.MozUserSelect!="undefined"){e.style.MozUserSelect="none";}}};draw2d.Node=function(){this.bgColor=null;this.lineColor=new draw2d.Color(128,128,255);this.lineStroke=1;this.ports=new draw2d.ArrayList();draw2d.Figure.call(this);};draw2d.Node.prototype=new draw2d.Figure;draw2d.Node.prototype.type="Node";draw2d.Node.prototype.dispose=function(){for(var i=0;i<this.ports.getSize();i++){this.ports.get(i).dispose();}this.ports=null;draw2d.Figure.prototype.dispose.call(this);};draw2d.Node.prototype.createHTMLElement=function(){var item=draw2d.Figure.prototype.createHTMLElement.call(this);item.style.width="auto";item.style.height="auto";item.style.margin="0px";item.style.padding="0px";if(this.lineColor!=null){item.style.border=this.lineStroke+"px solid "+this.lineColor.getHTMLStyle();}item.style.fontSize="1px";if(this.bgColor!=null){item.style.backgroundColor=this.bgColor.getHTMLStyle();}return item;};draw2d.Node.prototype.paint=function(){draw2d.Figure.prototype.paint.call(this);for(var i=0;i<this.ports.getSize();i++){this.ports.get(i).paint();}};draw2d.Node.prototype.getPorts=function(){var _3de4=new Array();for(var i=0;i<this.ports.getSize();i++){_3de4.push(this.ports.get(i));}return _3de4;};draw2d.Node.prototype.getPort=function(_3de6){if(this.ports==null){return null;}for(var i=0;i<this.ports.getSize();i++){var port=this.ports.get(i);if(port.getName()==_3de6){return port;}}};draw2d.Node.prototype.addPort=function(port,x,y){this.ports.add(port);port.setOrigin(x,y);port.setPosition(x,y);port.setParent(this);port.setDeleteable(false);this.html.appendChild(port.getHTMLElement());if(this.workflow!=null){this.workflow.registerPort(port);}};draw2d.Node.prototype.removePort=function(port){if(this.ports!=null){this.ports.removeElementAt(this.ports.indexOf(port));}try{this.html.removeChild(port.getHTMLElement());}catch(exc){}if(this.workflow!=null){this.workflow.unregisterPort(port);}};draw2d.Node.prototype.setWorkflow=function(_3ded){var _3dee=this.workflow;draw2d.Figure.prototype.setWorkflow.call(this,_3ded);if(_3dee!=null){for(var i=0;i<this.ports.getSize();i++){_3dee.unregisterPort(this.ports.get(i));}}if(this.workflow!=null){for(var i=0;i<this.ports.getSize();i++){this.workflow.registerPort(this.ports.get(i));}}};draw2d.Node.prototype.setBackgroundColor=function(color){this.bgColor=color;if(this.bgColor!=null){this.html.style.backgroundColor=this.bgColor.getHTMLStyle();}else{this.html.style.backgroundColor="transparent";}};draw2d.Node.prototype.getBackgroundColor=function(){return this.bgColor;};draw2d.Node.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="0px";}};draw2d.Node.prototype.setLineWidth=function(w){this.lineStroke=w;if(this.lineColor!=null){this.html.style.border=this.lineStroke+"px solid "+this.lineColor.getHTMLStyle();}else{this.html.style.border="0px";}};draw2d.VectorFigure=function(){this.bgColor=null;this.lineColor=new draw2d.Color(0,0,0);this.stroke=1;this.graphics=null;draw2d.Node.call(this);};draw2d.VectorFigure.prototype=new draw2d.Node;draw2d.VectorFigure.prototype.type="VectorFigure";draw2d.VectorFigure.prototype.dispose=function(){draw2d.Node.prototype.dispose.call(this);this.bgColor=null;this.lineColor=null;if(this.graphics!=null){this.graphics.clear();}this.graphics=null;};draw2d.VectorFigure.prototype.createHTMLElement=function(){var item=draw2d.Node.prototype.createHTMLElement.call(this);item.style.border="0px";item.style.backgroundColor="transparent";return item;};draw2d.VectorFigure.prototype.setWorkflow=function(_50d0){draw2d.Node.prototype.setWorkflow.call(this,_50d0);if(this.workflow==null){this.graphics.clear();this.graphics=null;}};draw2d.VectorFigure.prototype.paint=function(){if(this.graphics==null){this.graphics=new jsGraphics(this.id);}else{this.graphics.clear();}draw2d.Node.prototype.paint.call(this);for(var i=0;i<this.ports.getSize();i++){this.html.appendChild(this.ports.get(i).getHTMLElement());}};draw2d.VectorFigure.prototype.setDimension=function(w,h){draw2d.Node.prototype.setDimension.call(this,w,h);if(this.graphics!=null){this.paint();}};draw2d.VectorFigure.prototype.setBackgroundColor=function(color){this.bgColor=color;if(this.graphics!=null){this.paint();}};draw2d.VectorFigure.prototype.getBackgroundColor=function(){return this.bgColor;};draw2d.VectorFigure.prototype.setLineWidth=function(w){this.stroke=w;if(this.graphics!=null){this.paint();}};draw2d.VectorFigure.prototype.setColor=function(color){this.lineColor=color;if(this.graphics!=null){this.paint();}};draw2d.VectorFigure.prototype.getColor=function(){return this.lineColor;};draw2d.Label=function(msg){this.msg=msg;this.bgColor=null;this.color=new draw2d.Color(0,0,0);this.fontSize=10;this.textNode=null;this.align="center";draw2d.Figure.call(this);};draw2d.Label.prototype=new draw2d.Figure;draw2d.Label.prototype.type="Label";draw2d.Label.prototype.createHTMLElement=function(){var item=draw2d.Figure.prototype.createHTMLElement.call(this);this.textNode=document.createTextNode(this.msg);item.appendChild(this.textNode);item.style.color=this.color.getHTMLStyle();item.style.fontSize=this.fontSize+"pt";item.style.width="auto";item.style.height="auto";item.style.paddingLeft="3px";item.style.paddingRight="3px";item.style.textAlign=this.align;if(this.bgColor!=null){item.style.backgroundColor=this.bgColor.getHTMLStyle();}return item;};draw2d.Label.prototype.isResizeable=function(){return false;};draw2d.Label.prototype.setWordwrap=function(flag){this.html.style.whiteSpace=flag?"wrap":"nowrap";};draw2d.Label.prototype.setAlign=function(align){this.align=align;this.html.style.textAlign=align;};draw2d.Label.prototype.setBackgroundColor=function(color){this.bgColor=color;if(this.bgColor!=null){this.html.style.backgroundColor=this.bgColor.getHTMLStyle();}else{this.html.style.backgroundColor="transparent";}};draw2d.Label.prototype.setColor=function(color){this.color=color;this.html.style.color=this.color.getHTMLStyle();};draw2d.Label.prototype.setFontSize=function(size){this.fontSize=size;this.html.style.fontSize=this.fontSize+"pt";};draw2d.Label.prototype.getWidth=function(){try{return parseInt(getComputedStyle(this.html,"").getPropertyValue("width"));}catch(e){return (this.html.clientWidth);}return 100;};draw2d.Label.prototype.getHeight=function(){try{return parseInt(getComputedStyle(this.html,"").getPropertyValue("height"));}catch(e){return (this.html.clientHeight);}return 30;};draw2d.Label.prototype.setText=function(text){this.msg=text;this.html.removeChild(this.textNode);this.textNode=document.createTextNode(this.msg);this.html.appendChild(this.textNode);};draw2d.Label.prototype.setStyledText=function(text){this.msg=text;this.html.removeChild(this.textNode);this.textNode=document.createElement("div");this.textNode.style.whiteSpace="nowrap";this.textNode.innerHTML=text;this.html.appendChild(this.textNode);};draw2d.Oval=function(){draw2d.VectorFigure.call(this);};draw2d.Oval.prototype=new draw2d.VectorFigure;draw2d.Oval.prototype.type="Oval";draw2d.Oval.prototype.paint=function(){draw2d.VectorFigure.prototype.paint.call(this);this.graphics.setStroke(this.stroke);if(this.bgColor!=null){this.graphics.setColor(this.bgColor.getHTMLStyle());this.graphics.fillOval(0,0,this.getWidth()-1,this.getHeight()-1);}if(this.lineColor!=null){this.graphics.setColor(this.lineColor.getHTMLStyle());this.graphics.drawOval(0,0,this.getWidth()-1,this.getHeight()-1);}this.graphics.paint();};draw2d.Circle=function(_4a78){draw2d.Oval.call(this);if(_4a78){this.setDimension(_4a78,_4a78);}};draw2d.Circle.prototype=new draw2d.Oval;draw2d.Circle.prototype.type="Circle";draw2d.Circle.prototype.setDimension=function(w,h){if(w>h){draw2d.Oval.prototype.setDimension.call(this,w,w);}else{draw2d.Oval.prototype.setDimension.call(this,h,h);}};draw2d.Circle.prototype.isStrechable=function(){return false;};draw2d.Rectangle=function(width,_4e61){this.bgColor=null;this.lineColor=new draw2d.Color(0,0,0);this.lineStroke=1;draw2d.Figure.call(this);if(width&&_4e61){this.setDimension(width,_4e61);}};draw2d.Rectangle.prototype=new draw2d.Figure;draw2d.Rectangle.prototype.type="Rectangle";draw2d.Rectangle.prototype.dispose=function(){draw2d.Figure.prototype.dispose.call(this);this.bgColor=null;this.lineColor=null;};draw2d.Rectangle.prototype.createHTMLElement=function(){var item=draw2d.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="&nbsp";if(this.bgColor!=null){item.style.backgroundColor=this.bgColor.getHTMLStyle();}return item;};draw2d.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";}};draw2d.Rectangle.prototype.getBackgroundColor=function(){return this.bgColor;};draw2d.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";}};draw2d.Rectangle.prototype.getColor=function(){return this.lineColor;};draw2d.Rectangle.prototype.getWidth=function(){return draw2d.Figure.prototype.getWidth.call(this)+2*this.lineStroke;};draw2d.Rectangle.prototype.getHeight=function(){return draw2d.Figure.prototype.getHeight.call(this)+2*this.lineStroke;};draw2d.Rectangle.prototype.setDimension=function(w,h){return draw2d.Figure.prototype.setDimension.call(this,w-2*this.lineStroke,h-2*this.lineStroke);};draw2d.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;};draw2d.Rectangle.prototype.getLineWidth=function(){return this.lineStroke;};draw2d.ImageFigure=function(url){this.url=url;draw2d.Node.call(this);this.setDimension(40,40);};draw2d.ImageFigure.prototype=new draw2d.Node;draw2d.ImageFigure.prototype.type="Image";draw2d.ImageFigure.prototype.createHTMLElement=function(){var item=draw2d.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;};draw2d.ImageFigure.prototype.setBackgroundColor=function(color){};draw2d.ImageFigure.prototype.setColor=function(color){};draw2d.ImageFigure.prototype.isResizeable=function(){return false;};draw2d.ImageFigure.prototype.setImage=function(url){this.url=url;if(this.url!=null){this.html.style.backgroundImage="url("+this.url+")";}else{this.html.style.backgroundImage="";}};draw2d.Port=function(_44cd,_44ce){Corona=function(){};Corona.prototype=new draw2d.Circle;Corona.prototype.setAlpha=function(_44cf){draw2d.Circle.prototype.setAlpha.call(this,Math.min(0.3,_44cf));};if(_44cd==null){this.currentUIRepresentation=new draw2d.Circle();}else{this.currentUIRepresentation=_44cd;}if(_44ce==null){this.connectedUIRepresentation=new draw2d.Circle();this.connectedUIRepresentation.setColor(null);}else{this.connectedUIRepresentation=_44ce;}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;draw2d.Rectangle.call(this);this.setDimension(8,8);this.setBackgroundColor(new draw2d.Color(100,180,100));this.setColor(new draw2d.Color(90,150,90));draw2d.Rectangle.prototype.setColor.call(this,null);this.dropable=new draw2d.DropTarget(this.html);this.dropable.node=this;this.dropable.addEventListener("dragenter",function(_44d0){_44d0.target.node.onDragEnter(_44d0.relatedTarget.node);});this.dropable.addEventListener("dragleave",function(_44d1){_44d1.target.node.onDragLeave(_44d1.relatedTarget.node);});this.dropable.addEventListener("drop",function(_44d2){_44d2.relatedTarget.node.onDrop(_44d2.target.node);});};draw2d.Port.prototype=new draw2d.Rectangle;draw2d.Port.prototype.type="Port";draw2d.Port.ZOrderBaseIndex=5000;draw2d.Port.setZOrderBaseIndex=function(index){draw2d.Port.ZOrderBaseIndex=index;};draw2d.Port.prototype.setHideIfConnected=function(flag){this.hideIfConnected=flag;};draw2d.Port.prototype.dispose=function(){for(key in this.moveListener){var _44d5=this.moveListener[key];if(_44d5!=null){this.parentNode.workflow.removeFigure(_44d5);_44d5.dispose();}}draw2d.Rectangle.prototype.dispose.call(this);this.parentNode=null;this.dropable.node=null;this.dropable=null;this.disconnectedUIRepresentation.dispose();this.connectedUIRepresentation.dispose();};draw2d.Port.prototype.createHTMLElement=function(){var item=draw2d.Rectangle.prototype.createHTMLElement.call(this);item.style.zIndex=draw2d.Port.ZOrderBaseIndex;this.currentUIRepresentation.html.zIndex=draw2d.Port.ZOrderBaseIndex;item.appendChild(this.currentUIRepresentation.html);this.uiRepresentationAdded=true;return item;};draw2d.Port.prototype.setUiRepresentation=function(_44d7){if(_44d7==null){_44d7=new draw2d.Figure();}if(this.uiRepresentationAdded){this.html.removeChild(this.currentUIRepresentation.getHTMLElement());}this.html.appendChild(_44d7.getHTMLElement());_44d7.paint();this.currentUIRepresentation=_44d7;};draw2d.Port.prototype.onMouseEnter=function(){this.setLineWidth(2);};draw2d.Port.prototype.onMouseLeave=function(){this.setLineWidth(0);};draw2d.Port.prototype.setDimension=function(width,_44d9){draw2d.Rectangle.prototype.setDimension.call(this,width,_44d9);this.connectedUIRepresentation.setDimension(width,_44d9);this.disconnectedUIRepresentation.setDimension(width,_44d9);this.setPosition(this.x,this.y);};draw2d.Port.prototype.setBackgroundColor=function(color){this.currentUIRepresentation.setBackgroundColor(color);};draw2d.Port.prototype.getBackgroundColor=function(){return this.currentUIRepresentation.getBackgroundColor();};draw2d.Port.prototype.getConnections=function(){var _44db=new Array();for(key in this.moveListener){var _44dc=this.moveListener[key];if(_44dc instanceof draw2d.Connection){_44db.push(_44dc);}}return _44db;};draw2d.Port.prototype.setColor=function(color){this.currentUIRepresentation.setColor(color);};draw2d.Port.prototype.getColor=function(){return this.currentUIRepresentation.getColor();};draw2d.Port.prototype.setLineWidth=function(width){this.currentUIRepresentation.setLineWidth(width);};draw2d.Port.prototype.getLineWidth=function(){return this.currentUIRepresentation.getLineWidth();};draw2d.Port.prototype.paint=function(){this.currentUIRepresentation.paint();};draw2d.Port.prototype.setPosition=function(xPos,yPos){this.originX=xPos;this.originY=yPos;draw2d.Rectangle.prototype.setPosition.call(this,xPos,yPos);if(this.html==null){return;}this.html.style.left=(this.x-this.getWidth()/2)+"px";this.html.style.top=(this.y-this.getHeight()/2)+"px";};draw2d.Port.prototype.setParent=function(_44e1){if(this.parentNode!=null){this.parentNode.detachMoveListener(this);}this.parentNode=_44e1;if(this.parentNode!=null){this.parentNode.attachMoveListener(this);}};draw2d.Port.prototype.attachMoveListener=function(_44e2){draw2d.Rectangle.prototype.attachMoveListener.call(this,_44e2);if(this.hideIfConnected==true){this.setUiRepresentation(this.connectedUIRepresentation);}};draw2d.Port.prototype.detachMoveListener=function(_44e3){draw2d.Rectangle.prototype.detachMoveListener.call(this,_44e3);if(this.getConnections().length==0){this.setUiRepresentation(this.disconnectedUIRepresentation);}};draw2d.Port.prototype.getParent=function(){return this.parentNode;};draw2d.Port.prototype.onDrag=function(){draw2d.Rectangle.prototype.onDrag.call(this);this.parentNode.workflow.showConnectionLine(this.parentNode.x+this.x,this.parentNode.y+this.y,this.parentNode.x+this.originX,this.parentNode.y+this.originY);};draw2d.Port.prototype.getCoronaWidth=function(){return this.coronaWidth;};draw2d.Port.prototype.setCoronaWidth=function(width){this.coronaWidth=width;};draw2d.Port.prototype.onDragend=function(){this.setAlpha(1);this.setPosition(this.originX,this.originY);this.parentNode.workflow.hideConnectionLine();};draw2d.Port.prototype.setOrigin=function(x,y){this.originX=x;this.originY=y;};draw2d.Port.prototype.onDragEnter=function(port){this.parentNode.workflow.connectionLine.setColor(new draw2d.Color(0,150,0));this.parentNode.workflow.connectionLine.setLineWidth(3);this.showCorona(true);};draw2d.Port.prototype.onDragLeave=function(port){this.parentNode.workflow.connectionLine.setColor(new draw2d.Color(0,0,0));this.parentNode.workflow.connectionLine.setLineWidth(1);this.showCorona(false);};draw2d.Port.prototype.onDrop=function(port){if(this.parentNode.id==port.parentNode.id){}else{var _44ea=new draw2d.CommandConnect(this.parentNode.workflow,port,this);this.parentNode.workflow.getCommandStack().execute(_44ea);}};draw2d.Port.prototype.getAbsolutePosition=function(){return new draw2d.Point(this.getAbsoluteX(),this.getAbsoluteY());};draw2d.Port.prototype.getAbsoluteBounds=function(){return new draw2d.Dimension(this.getAbsoluteX(),this.getAbsoluteY(),this.getWidth(),this.getHeight());};draw2d.Port.prototype.getAbsoluteY=function(){return this.originY+this.parentNode.getY();};draw2d.Port.prototype.getAbsoluteX=function(){return this.originX+this.parentNode.getX();};draw2d.Port.prototype.onOtherFigureMoved=function(_44eb){this.fireMoveEvent();};draw2d.Port.prototype.getName=function(){return this.getProperty("name");};draw2d.Port.prototype.setName=function(name){this.setProperty("name",name);};draw2d.Port.prototype.isOver=function(iX,iY){var x=this.getAbsoluteX()-this.coronaWidth-this.getWidth()/2;var y=this.getAbsoluteY()-this.coronaWidth-this.getHeight()/2;var iX2=x+this.width+(this.coronaWidth*2)+this.getWidth()/2;var iY2=y+this.height+(this.coronaWidth*2)+this.getHeight()/2;return (iX>=x&&iX<=iX2&&iY>=y&&iY<=iY2);};draw2d.Port.prototype.showCorona=function(flag,_44f4){if(flag==true){this.corona=new Corona();this.corona.setAlpha(0.3);this.corona.setBackgroundColor(new draw2d.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;}}};draw2d.InputPort=function(_45ac){draw2d.Port.call(this,_45ac);};draw2d.InputPort.prototype=new draw2d.Port;draw2d.InputPort.prototype.type="InputPort";draw2d.InputPort.prototype.onDrop=function(port){if(port.getMaxFanOut&&port.getMaxFanOut()<=port.getFanOut()){return;}if(this.parentNode.id==port.parentNode.id){}else{if(port instanceof draw2d.OutputPort){var _45ae=new draw2d.CommandConnect(this.parentNode.workflow,port,this);this.parentNode.workflow.getCommandStack().execute(_45ae);}}};draw2d.InputPort.prototype.onDragEnter=function(port){if(port instanceof draw2d.OutputPort){draw2d.Port.prototype.onDragEnter.call(this,port);}};draw2d.InputPort.prototype.onDragLeave=function(port){if(port instanceof draw2d.OutputPort){draw2d.Port.prototype.onDragLeave.call(this,port);}};draw2d.OutputPort=function(_3e01){draw2d.Port.call(this,_3e01);this.maxFanOut=-1;};draw2d.OutputPort.prototype=new draw2d.Port;draw2d.OutputPort.prototype.type="OutputPort";draw2d.OutputPort.prototype.onDrop=function(port){if(this.getMaxFanOut()<=this.getFanOut()){return;}if(this.parentNode.id==port.parentNode.id){}else{if(port instanceof draw2d.InputPort){var _3e03=new draw2d.CommandConnect(this.parentNode.workflow,this,port);this.parentNode.workflow.getCommandStack().execute(_3e03);}}};draw2d.OutputPort.prototype.onDragEnter=function(port){if(this.getMaxFanOut()<=this.getFanOut()){return;}if(port instanceof draw2d.InputPort){draw2d.Port.prototype.onDragEnter.call(this,port);}};draw2d.OutputPort.prototype.onDragLeave=function(port){if(port instanceof draw2d.InputPort){draw2d.Port.prototype.onDragLeave.call(this,port);}};draw2d.OutputPort.prototype.onDragstart=function(x,y){if(this.maxFanOut==-1){return true;}if(this.getMaxFanOut()<=this.getFanOut()){return false;}return true;};draw2d.OutputPort.prototype.setMaxFanOut=function(count){this.maxFanOut=count;};draw2d.OutputPort.prototype.getMaxFanOut=function(){return this.maxFanOut;};draw2d.OutputPort.prototype.getFanOut=function(){if(this.getParent().workflow==null){return 0;}var count=0;var lines=this.getParent().workflow.getLines();for(key in lines){var line=lines[key];if(line instanceof draw2d.Connection){if(line.getSource()==this){count++;}else{if(line.getTarget()==this){count++;}}}}return count;};draw2d.Line=function(){this.lineColor=new draw2d.Color(0,0,0);this.stroke=1;this.canvas=null;this.workflow=null;this.html=null;this.graphics=null;this.id=this.generateUId();this.startX=30;this.startY=30;this.endX=100;this.endY=100;this.alpha=1;this.zOrder=draw2d.Line.ZOrderBaseIndex;this.moveListener=new Object();this.setSelectable(true);this.setDeleteable(true);};draw2d.Line.ZOrderBaseIndex=20;draw2d.Line.setZOrderBaseIndex=function(index){draw2d.Line.ZOrderBaseIndex=index;};draw2d.Line.prototype.dispose=function(){this.canvas=null;this.workflow=null;if(this.graphics!=null){this.graphics.clear();}this.graphics=null;};draw2d.Line.prototype.getZOrder=function(){return this.zOrder;};draw2d.Line.prototype.setZOrder=function(index){if(this.html!=null){this.html.style.zIndex=index;}this.zOrder=index;};draw2d.Line.prototype.createHTMLElement=function(){var item=document.createElement("div");item.id=this.id;item.style.position="absolute";item.style.left="0px";item.style.top="0px";item.style.height="0px";item.style.width="0px";item.style.zIndex=this.zOrder;return item;};draw2d.Line.prototype.getHTMLElement=function(){if(this.html==null){this.html=this.createHTMLElement();}return this.html;};draw2d.Line.prototype.getWorkflow=function(){return this.workflow;};draw2d.Line.prototype.isResizeable=function(){return true;};draw2d.Line.prototype.setCanvas=function(_4127){this.canvas=_4127;if(this.graphics!=null){this.graphics.clear();}this.graphics=null;};draw2d.Line.prototype.setWorkflow=function(_4128){this.workflow=_4128;if(this.graphics!=null){this.graphics.clear();}this.graphics=null;};draw2d.Line.prototype.paint=function(){if(this.graphics==null){this.graphics=new jsGraphics(this.id);}else{this.graphics.clear();}this.graphics.setStroke(this.stroke);this.graphics.setColor(this.lineColor.getHTMLStyle());this.graphics.drawLine(this.startX,this.startY,this.endX,this.endY);this.graphics.paint();};draw2d.Line.prototype.attachMoveListener=function(_4129){this.moveListener[_4129.id]=_4129;};draw2d.Line.prototype.detachMoveListener=function(_412a){this.moveListener[_412a.id]=null;};draw2d.Line.prototype.fireMoveEvent=function(){for(key in this.moveListener){var _412b=this.moveListener[key];if(_412b!=null){_412b.onOtherFigureMoved(this);}}};draw2d.Line.prototype.onOtherFigureMoved=function(_412c){};draw2d.Line.prototype.setLineWidth=function(w){this.stroke=w;if(this.graphics!=null){this.paint();}this.setDocumentDirty();};draw2d.Line.prototype.setColor=function(color){this.lineColor=color;if(this.graphics!=null){this.paint();}this.setDocumentDirty();};draw2d.Line.prototype.getColor=function(){return this.lineColor;};draw2d.Line.prototype.setAlpha=function(_412f){if(_412f==this.alpha){return;}try{this.html.style.MozOpacity=_412f;}catch(exc){}try{this.html.style.opacity=_412f;}catch(exc){}try{var _4130=Math.round(_412f*100);if(_4130>=99){this.html.style.filter="";}else{this.html.style.filter="alpha(opacity="+_4130+")";}}catch(exc){}this.alpha=_412f;};draw2d.Line.prototype.setStartPoint=function(x,y){this.startX=x;this.startY=y;if(this.graphics!=null){this.paint();}this.setDocumentDirty();};draw2d.Line.prototype.setEndPoint=function(x,y){this.endX=x;this.endY=y;if(this.graphics!=null){this.paint();}this.setDocumentDirty();};draw2d.Line.prototype.getStartX=function(){return this.startX;};draw2d.Line.prototype.getStartY=function(){return this.startY;};draw2d.Line.prototype.getStartPoint=function(){return new draw2d.Point(this.startX,this.startY);};draw2d.Line.prototype.getEndX=function(){return this.endX;};draw2d.Line.prototype.getEndY=function(){return this.endY;};draw2d.Line.prototype.getEndPoint=function(){return new draw2d.Point(this.endX,this.endY);};draw2d.Line.prototype.isSelectable=function(){return this.selectable;};draw2d.Line.prototype.setSelectable=function(flag){this.selectable=flag;};draw2d.Line.prototype.isDeleteable=function(){return this.deleteable;};draw2d.Line.prototype.setDeleteable=function(flag){this.deleteable=flag;};draw2d.Line.prototype.getLength=function(){return Math.sqrt((this.startX-this.endX)*(this.startX-this.endX)+(this.startY-this.endY)*(this.startY-this.endY));};draw2d.Line.prototype.getAngle=function(){var _4137=this.getLength();var angle=-(180/Math.PI)*Math.asin((this.startY-this.endY)/_4137);if(angle<0){if(this.endX<this.startX){angle=Math.abs(angle)+180;}else{angle=360-Math.abs(angle);}}else{if(this.endX<this.startX){angle=180-angle;}}return angle;};draw2d.Line.prototype.onContextMenu=function(x,y){var menu=this.getContextMenu();if(menu!=null){this.workflow.showMenu(menu,x,y);}};draw2d.Line.prototype.getContextMenu=function(){return null;};draw2d.Line.prototype.onDoubleClick=function(){};draw2d.Line.prototype.setDocumentDirty=function(){if(this.workflow!=null){this.workflow.setDocumentDirty();}};draw2d.Line.prototype.generateUId=function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var _413d=10;var _413e=10;nbTry=0;while(nbTry<1000){var id="";for(var i=0;i<_413d;i++){var rnum=Math.floor(Math.random()*chars.length);id+=chars.substring(rnum,rnum+1);}elem=document.getElementById(id);if(!elem){return id;}nbTry+=1;}return null;};draw2d.Line.prototype.containsPoint=function(px,py){return draw2d.Line.hit(this.startX,this.startY,this.endX,this.endY,px,py);};draw2d.Line.hit=function(X1,Y1,X2,Y2,px,py){var _414a=5;X2-=X1;Y2-=Y1;px-=X1;py-=Y1;var _414b=px*X2+py*Y2;var _414c;if(_414b<=0){_414c=0;}else{px=X2-px;py=Y2-py;_414b=px*X2+py*Y2;if(_414b<=0){_414c=0;}else{_414c=_414b*_414b/(X2*X2+Y2*Y2);}}var lenSq=px*px+py*py-_414c;if(lenSq<0){lenSq=0;}return Math.sqrt(lenSq)<_414a;};draw2d.ConnectionRouter=function(){};draw2d.ConnectionRouter.prototype.type="ConnectionRouter";draw2d.ConnectionRouter.prototype.getDirection=function(r,p){var _4176=Math.abs(r.x-p.x);var _4177=3;var i=Math.abs(r.y-p.y);if(i<=_4176){_4176=i;_4177=0;}i=Math.abs(r.getBottom()-p.y);if(i<=_4176){_4176=i;_4177=2;}i=Math.abs(r.getRight()-p.x);if(i<_4176){_4176=i;_4177=1;}return _4177;};draw2d.ConnectionRouter.prototype.getEndDirection=function(conn){var p=conn.getEndPoint();var rect=conn.getTarget().getParent().getBounds();return this.getDirection(rect,p);};draw2d.ConnectionRouter.prototype.getStartDirection=function(conn){var p=conn.getStartPoint();var rect=conn.getSource().getParent().getBounds();return this.getDirection(rect,p);};draw2d.ConnectionRouter.prototype.route=function(_417f){};draw2d.NullConnectionRouter=function(){};draw2d.NullConnectionRouter.prototype=new draw2d.ConnectionRouter;draw2d.NullConnectionRouter.prototype.type="NullConnectionRouter";draw2d.NullConnectionRouter.prototype.invalidate=function(){};draw2d.NullConnectionRouter.prototype.route=function(_50c0){_50c0.addPoint(_50c0.getStartPoint());_50c0.addPoint(_50c0.getEndPoint());};draw2d.ManhattanConnectionRouter=function(){this.MINDIST=20;};draw2d.ManhattanConnectionRouter.prototype=new draw2d.ConnectionRouter;draw2d.ManhattanConnectionRouter.prototype.type="ManhattanConnectionRouter";draw2d.ManhattanConnectionRouter.prototype.route=function(conn){var _4d61=conn.getStartPoint();var _4d62=this.getStartDirection(conn);var toPt=conn.getEndPoint();var toDir=this.getEndDirection(conn);this._route(conn,toPt,toDir,_4d61,_4d62);};draw2d.ManhattanConnectionRouter.prototype._route=function(conn,_4d66,_4d67,toPt,toDir){var TOL=0.1;var _4d6b=0.01;var UP=0;var RIGHT=1;var DOWN=2;var LEFT=3;var xDiff=_4d66.x-toPt.x;var yDiff=_4d66.y-toPt.y;var point;var dir;if(((xDiff*xDiff)<(_4d6b))&&((yDiff*yDiff)<(_4d6b))){conn.addPoint(new draw2d.Point(toPt.x,toPt.y));return;}if(_4d67==LEFT){if((xDiff>0)&&((yDiff*yDiff)<TOL)&&(toDir==RIGHT)){point=toPt;dir=toDir;}else{if(xDiff<0){point=new draw2d.Point(_4d66.x-this.MINDIST,_4d66.y);}else{if(((yDiff>0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){point=new draw2d.Point(toPt.x,_4d66.y);}else{if(_4d67==toDir){var pos=Math.min(_4d66.x,toPt.x)-this.MINDIST;point=new draw2d.Point(pos,_4d66.y);}else{point=new draw2d.Point(_4d66.x-(xDiff/2),_4d66.y);}}}if(yDiff>0){dir=UP;}else{dir=DOWN;}}}else{if(_4d67==RIGHT){if((xDiff<0)&&((yDiff*yDiff)<TOL)&&(toDir==LEFT)){point=toPt;dir=toDir;}else{if(xDiff>0){point=new draw2d.Point(_4d66.x+this.MINDIST,_4d66.y);}else{if(((yDiff>0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){point=new draw2d.Point(toPt.x,_4d66.y);}else{if(_4d67==toDir){var pos=Math.max(_4d66.x,toPt.x)+this.MINDIST;point=new draw2d.Point(pos,_4d66.y);}else{point=new draw2d.Point(_4d66.x-(xDiff/2),_4d66.y);}}}if(yDiff>0){dir=UP;}else{dir=DOWN;}}}else{if(_4d67==DOWN){if(((xDiff*xDiff)<TOL)&&(yDiff<0)&&(toDir==UP)){point=toPt;dir=toDir;}else{if(yDiff>0){point=new draw2d.Point(_4d66.x,_4d66.y+this.MINDIST);}else{if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){point=new draw2d.Point(_4d66.x,toPt.y);}else{if(_4d67==toDir){var pos=Math.max(_4d66.y,toPt.y)+this.MINDIST;point=new draw2d.Point(_4d66.x,pos);}else{point=new draw2d.Point(_4d66.x,_4d66.y-(yDiff/2));}}}if(xDiff>0){dir=LEFT;}else{dir=RIGHT;}}}else{if(_4d67==UP){if(((xDiff*xDiff)<TOL)&&(yDiff>0)&&(toDir==DOWN)){point=toPt;dir=toDir;}else{if(yDiff<0){point=new draw2d.Point(_4d66.x,_4d66.y-this.MINDIST);}else{if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){point=new draw2d.Point(_4d66.x,toPt.y);}else{if(_4d67==toDir){var pos=Math.min(_4d66.y,toPt.y)-this.MINDIST;point=new draw2d.Point(_4d66.x,pos);}else{point=new draw2d.Point(_4d66.x,_4d66.y-(yDiff/2));}}}if(xDiff>0){dir=LEFT;}else{dir=RIGHT;}}}}}}this._route(conn,point,dir,toPt,toDir);conn.addPoint(_4d66);};draw2d.BezierConnectionRouter=function(_4d88){if(!_4d88){this.cheapRouter=new draw2d.ManhattanConnectionRouter();}else{this.cheapRouter=null;}this.iteration=5;};draw2d.BezierConnectionRouter.prototype=new draw2d.ConnectionRouter;draw2d.BezierConnectionRouter.prototype.type="BezierConnectionRouter";draw2d.BezierConnectionRouter.prototype.drawBezier=function(_4d89,_4d8a,t,iter){var n=_4d89.length-1;var q=new Array();for(var i=0;i<n+1;i++){q[i]=new Array();q[i][0]=_4d89[i];}for(var j=1;j<=n;j++){for(var i=0;i<=(n-j);i++){q[i][j]=new draw2d.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<n+1;i++){c1[i]=q[0][i];c2[i]=q[i][n-i];}if(iter>=0){this.drawBezier(c1,_4d8a,t,--iter);this.drawBezier(c2,_4d8a,t,--iter);}else{for(var i=0;i<n;i++){_4d8a.push(q[i][n-i]);}}};draw2d.BezierConnectionRouter.prototype.route=function(conn){if(this.cheapRouter!=null&&(conn.getSource().getParent().isMoving==true||conn.getTarget().getParent().isMoving==true)){this.cheapRouter.route(conn);return;}var _4d94=new Array();var _4d95=conn.getStartPoint();var toPt=conn.getEndPoint();this._route(_4d94,conn,toPt,this.getEndDirection(conn),_4d95,this.getStartDirection(conn));var _4d97=new Array();this.drawBezier(_4d94,_4d97,0.5,this.iteration);for(var i=0;i<_4d97.length;i++){conn.addPoint(_4d97[i]);}conn.addPoint(toPt);};draw2d.BezierConnectionRouter.prototype._route=function(_4d99,conn,_4d9b,_4d9c,toPt,toDir){var TOL=0.1;var _4da0=0.01;var _4da1=90;var UP=0;var RIGHT=1;var DOWN=2;var LEFT=3;var xDiff=_4d9b.x-toPt.x;var yDiff=_4d9b.y-toPt.y;var point;var dir;if(((xDiff*xDiff)<(_4da0))&&((yDiff*yDiff)<(_4da0))){_4d99.push(new draw2d.Point(toPt.x,toPt.y));return;}if(_4d9c==LEFT){if((xDiff>0)&&((yDiff*yDiff)<TOL)&&(toDir==RIGHT)){point=toPt;dir=toDir;}else{if(xDiff<0){point=new draw2d.Point(_4d9b.x-_4da1,_4d9b.y);}else{if(((yDiff>0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){point=new draw2d.Point(toPt.x,_4d9b.y);}else{if(_4d9c==toDir){var pos=Math.min(_4d9b.x,toPt.x)-_4da1;point=new draw2d.Point(pos,_4d9b.y);}else{point=new draw2d.Point(_4d9b.x-(xDiff/2),_4d9b.y);}}}if(yDiff>0){dir=UP;}else{dir=DOWN;}}}else{if(_4d9c==RIGHT){if((xDiff<0)&&((yDiff*yDiff)<TOL)&&(toDir==LEFT)){point=toPt;dir=toDir;}else{if(xDiff>0){point=new draw2d.Point(_4d9b.x+_4da1,_4d9b.y);}else{if(((yDiff>0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){point=new draw2d.Point(toPt.x,_4d9b.y);}else{if(_4d9c==toDir){var pos=Math.max(_4d9b.x,toPt.x)+_4da1;point=new draw2d.Point(pos,_4d9b.y);}else{point=new draw2d.Point(_4d9b.x-(xDiff/2),_4d9b.y);}}}if(yDiff>0){dir=UP;}else{dir=DOWN;}}}else{if(_4d9c==DOWN){if(((xDiff*xDiff)<TOL)&&(yDiff<0)&&(toDir==UP)){point=toPt;dir=toDir;}else{if(yDiff>0){point=new draw2d.Point(_4d9b.x,_4d9b.y+_4da1);}else{if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){point=new draw2d.Point(_4d9b.x,toPt.y);}else{if(_4d9c==toDir){var pos=Math.max(_4d9b.y,toPt.y)+_4da1;point=new draw2d.Point(_4d9b.x,pos);}else{point=new draw2d.Point(_4d9b.x,_4d9b.y-(yDiff/2));}}}if(xDiff>0){dir=LEFT;}else{dir=RIGHT;}}}else{if(_4d9c==UP){if(((xDiff*xDiff)<TOL)&&(yDiff>0)&&(toDir==DOWN)){point=toPt;dir=toDir;}else{if(yDiff<0){point=new draw2d.Point(_4d9b.x,_4d9b.y-_4da1);}else{if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){point=new draw2d.Point(_4d9b.x,toPt.y);}else{if(_4d9c==toDir){var pos=Math.min(_4d9b.y,toPt.y)-_4da1;point=new draw2d.Point(_4d9b.x,pos);}else{point=new draw2d.Point(_4d9b.x,_4d9b.y-(yDiff/2));}}}if(xDiff>0){dir=LEFT;}else{dir=RIGHT;}}}}}}this._route(_4d99,conn,point,dir,toPt,toDir);_4d99.push(_4d9b);};draw2d.FanConnectionRouter=function(){};draw2d.FanConnectionRouter.prototype=new draw2d.NullConnectionRouter;draw2d.FanConnectionRouter.prototype.type="FanConnectionRouter";draw2d.FanConnectionRouter.prototype.route=function(conn){var _4e40=conn.getStartPoint();var toPt=conn.getEndPoint();var lines=conn.getSource().getConnections();var _4e43=new draw2d.ArrayList();var index=0;for(var i=0;i<lines.length;i++){var _4e46=lines[i];if(_4e46.getTarget()==conn.getTarget()||_4e46.getSource()==conn.getTarget()){_4e43.add(_4e46);if(conn==_4e46){index=_4e43.getSize();}}}if(_4e43.getSize()>1){this.routeCollision(conn,index);}else{draw2d.NullConnectionRouter.prototype.route.call(this,conn);}};draw2d.FanConnectionRouter.prototype.routeNormal=function(conn){conn.addPoint(conn.getStartPoint());conn.addPoint(conn.getEndPoint());};draw2d.FanConnectionRouter.prototype.routeCollision=function(conn,index){var start=conn.getStartPoint();var end=conn.getEndPoint();conn.addPoint(start);var _4e4c=10;var _4e4d=new draw2d.Point((end.x+start.x)/2,(end.y+start.y)/2);var _4e4e=end.getPosition(start);var ray;if(_4e4e==draw2d.PositionConstants.SOUTH||_4e4e==draw2d.PositionConstants.EAST){ray=new draw2d.Point(end.x-start.x,end.y-start.y);}else{ray=new draw2d.Point(start.x-end.x,start.y-end.y);}var _4e50=Math.sqrt(ray.x*ray.x+ray.y*ray.y);var _4e51=_4e4c*ray.x/_4e50;var _4e52=_4e4c*ray.y/_4e50;var _4e53;if(index%2==0){_4e53=new draw2d.Point(_4e4d.x+(index/2)*(-1*_4e52),_4e4d.y+(index/2)*_4e51);}else{_4e53=new draw2d.Point(_4e4d.x+(index/2)*_4e52,_4e4d.y+(index/2)*(-1*_4e51));}conn.addPoint(_4e53);conn.addPoint(end);};draw2d.Graphics=function(_4075,_4076,_4077){this.jsGraphics=_4075;this.xt=_4077.x;this.yt=_4077.y;this.radian=_4076*Math.PI/180;this.sinRadian=Math.sin(this.radian);this.cosRadian=Math.cos(this.radian);};draw2d.Graphics.prototype.setStroke=function(x){this.jsGraphics.setStroke(x);};draw2d.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);};draw2d.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]);};draw2d.Graphics.prototype.fillPolygon=function(_408d,_408e){var rotX=new Array();var rotY=new Array();for(var i=0;i<_408d.length;i++){rotX[i]=this.xt+_408d[i]*this.cosRadian-_408e[i]*this.sinRadian;rotY[i]=this.yt+_408d[i]*this.sinRadian+_408e[i]*this.cosRadian;}this.jsGraphics.fillPolygon(rotX,rotY);};draw2d.Graphics.prototype.setColor=function(color){this.jsGraphics.setColor(color.getHTMLStyle());};draw2d.Graphics.prototype.drawPolygon=function(_4093,_4094){var rotX=new Array();var rotY=new Array();for(var i=0;i<_4093.length;i++){rotX[i]=this.xt+_4093[i]*this.cosRadian-_4094[i]*this.sinRadian;rotY[i]=this.yt+_4093[i]*this.sinRadian+_4094[i]*this.cosRadian;}this.jsGraphics.drawPolygon(rotX,rotY);};draw2d.Connection=function(){draw2d.Line.call(this);this.sourcePort=null;this.targetPort=null;this.sourceDecorator=null;this.targetDecorator=null;this.sourceAnchor=new draw2d.ConnectionAnchor();this.targetAnchor=new draw2d.ConnectionAnchor();this.router=draw2d.Connection.defaultRouter;this.lineSegments=new Array();this.children=new draw2d.ArrayList();this.setColor(new draw2d.Color(0,0,115));this.setLineWidth(1);};draw2d.Connection.prototype=new draw2d.Line;draw2d.Connection.defaultRouter=new draw2d.ManhattanConnectionRouter();draw2d.Connection.setDefaultRouter=function(_4934){draw2d.Connection.defaultRouter=_4934;};draw2d.Connection.prototype.disconnect=function(){if(this.sourcePort!=null){this.sourcePort.detachMoveListener(this);this.fireSourcePortRouteEvent();}if(this.targetPort!=null){this.targetPort.detachMoveListener(this);this.fireTargetPortRouteEvent();}};draw2d.Connection.prototype.reconnect=function(){if(this.sourcePort!=null){this.sourcePort.attachMoveListener(this);this.fireSourcePortRouteEvent();}if(this.targetPort!=null){this.targetPort.attachMoveListener(this);this.fireTargetPortRouteEvent();}};draw2d.Connection.prototype.isResizeable=function(){return false;};draw2d.Connection.prototype.addFigure=function(_4935,_4936){var entry=new Object();entry.figure=_4935;entry.locator=_4936;this.children.add(entry);if(this.graphics!=null){this.paint();}};draw2d.Connection.prototype.setSourceDecorator=function(_4938){this.sourceDecorator=_4938;if(this.graphics!=null){this.paint();}};draw2d.Connection.prototype.setTargetDecorator=function(_4939){this.targetDecorator=_4939;if(this.graphics!=null){this.paint();}};draw2d.Connection.prototype.setSourceAnchor=function(_493a){this.sourceAnchor=_493a;this.sourceAnchor.setOwner(this.sourcePort);if(this.graphics!=null){this.paint();}};draw2d.Connection.prototype.setTargetAnchor=function(_493b){this.targetAnchor=_493b;this.targetAnchor.setOwner(this.targetPort);if(this.graphics!=null){this.paint();}};draw2d.Connection.prototype.setRouter=function(_493c){if(_493c!=null){this.router=_493c;}else{this.router=new draw2d.NullConnectionRouter();}if(this.graphics!=null){this.paint();}};draw2d.Connection.prototype.paint=function(){if(this.graphics==null){this.graphics=new jsGraphics(this.id);}else{this.graphics.clear();}this.graphics.setStroke(this.stroke);this.graphics.setColor(this.lineColor.getHTMLStyle());this.startStroke();this.router.route(this);if(this.getSource().getParent().isMoving==false&&this.getTarget().getParent().isMoving==false){if(this.targetDecorator!=null){this.targetDecorator.paint(new draw2d.Graphics(this.graphics,this.getEndAngle(),this.getEndPoint()));}if(this.sourceDecorator!=null){this.sourceDecorator.paint(new draw2d.Graphics(this.graphics,this.getStartAngle(),this.getStartPoint()));}}this.finishStroke();for(var i=0;i<this.children.getSize();i++){var entry=this.children.get(i);this.html.appendChild(entry.figure.getHTMLElement());entry.locator.relocate(entry.figure);}};draw2d.Connection.prototype.getStartPoint=function(){return this.sourceAnchor.getLocation(this.targetAnchor.getReferencePoint());};draw2d.Connection.prototype.getEndPoint=function(){return this.targetAnchor.getLocation(this.sourceAnchor.getReferencePoint());};draw2d.Connection.prototype.startStroke=function(){this.oldPoint=null;this.lineSegments=new Array();};draw2d.Connection.prototype.finishStroke=function(){this.graphics.paint();this.oldPoint=null;};draw2d.Connection.prototype.getPoints=function(){var _493f=new draw2d.ArrayList();var line;for(var i=0;i<this.lineSegments.length;i++){line=this.lineSegments[i];_493f.add(line.start);}_493f.add(line.end);return _493f;};draw2d.Connection.prototype.addPoint=function(p){p=new draw2d.Point(parseInt(p.x),parseInt(p.y));if(this.oldPoint!=null){this.graphics.drawLine(this.oldPoint.x,this.oldPoint.y,p.x,p.y);var line=new Object();line.start=this.oldPoint;line.end=p;this.lineSegments.push(line);}this.oldPoint=new Object();this.oldPoint.x=p.x;this.oldPoint.y=p.y;};draw2d.Connection.prototype.setSource=function(port){if(this.sourcePort!=null){this.sourcePort.detachMoveListener(this);}this.sourcePort=port;if(this.sourcePort==null){return;}this.sourceAnchor.setOwner(this.sourcePort);this.fireSourcePortRouteEvent();this.sourcePort.attachMoveListener(this);this.setStartPoint(port.getAbsoluteX(),port.getAbsoluteY());};draw2d.Connection.prototype.getSource=function(){return this.sourcePort;};draw2d.Connection.prototype.setTarget=function(port){if(this.targetPort!=null){this.targetPort.detachMoveListener(this);}this.targetPort=port;if(this.targetPort==null){return;}this.targetAnchor.setOwner(this.targetPort);this.fireTargetPortRouteEvent();this.targetPort.attachMoveListener(this);this.setEndPoint(port.getAbsoluteX(),port.getAbsoluteY());};draw2d.Connection.prototype.getTarget=function(){return this.targetPort;};draw2d.Connection.prototype.onOtherFigureMoved=function(_4946){if(_4946==this.sourcePort){this.setStartPoint(this.sourcePort.getAbsoluteX(),this.sourcePort.getAbsoluteY());}else{this.setEndPoint(this.targetPort.getAbsoluteX(),this.targetPort.getAbsoluteY());}};draw2d.Connection.prototype.containsPoint=function(px,py){for(var i=0;i<this.lineSegments.length;i++){var line=this.lineSegments[i];if(draw2d.Line.hit(line.start.x,line.start.y,line.end.x,line.end.y,px,py)){return true;}}return false;};draw2d.Connection.prototype.getStartAngle=function(){var p1=this.lineSegments[0].start;var p2=this.lineSegments[0].end;if(this.router instanceof draw2d.BezierConnectionRouter){p2=this.lineSegments[5].end;}var _494d=Math.sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));var angle=-(180/Math.PI)*Math.asin((p1.y-p2.y)/_494d);if(angle<0){if(p2.x<p1.x){angle=Math.abs(angle)+180;}else{angle=360-Math.abs(angle);}}else{if(p2.x<p1.x){angle=180-angle;}}return angle;};draw2d.Connection.prototype.getEndAngle=function(){var p1=this.lineSegments[this.lineSegments.length-1].end;var p2=this.lineSegments[this.lineSegments.length-1].start;if(this.router instanceof draw2d.BezierConnectionRouter){p2=this.lineSegments[this.lineSegments.length-5].end;}var _4951=Math.sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));var angle=-(180/Math.PI)*Math.asin((p1.y-p2.y)/_4951);if(angle<0){if(p2.x<p1.x){angle=Math.abs(angle)+180;}else{angle=360-Math.abs(angle);}}else{if(p2.x<p1.x){angle=180-angle;}}return angle;};draw2d.Connection.prototype.fireSourcePortRouteEvent=function(){var _4953=this.sourcePort.getConnections();for(var i=0;i<_4953.length;i++){_4953[i].paint();}};draw2d.Connection.prototype.fireTargetPortRouteEvent=function(){var _4955=this.targetPort.getConnections();for(var i=0;i<_4955.length;i++){_4955[i].paint();}};draw2d.ConnectionAnchor=function(owner){this.owner=owner;};draw2d.ConnectionAnchor.prototype.type="ConnectionAnchor";draw2d.ConnectionAnchor.prototype.getLocation=function(_50cd){return this.getReferencePoint();};draw2d.ConnectionAnchor.prototype.getOwner=function(){return this.owner;};draw2d.ConnectionAnchor.prototype.setOwner=function(owner){this.owner=owner;};draw2d.ConnectionAnchor.prototype.getBox=function(){return this.getOwner().getAbsoluteBounds();};draw2d.ConnectionAnchor.prototype.getReferencePoint=function(){if(this.getOwner()==null){return null;}else{return this.getOwner().getAbsolutePosition();}};draw2d.ChopboxConnectionAnchor=function(owner){draw2d.ConnectionAnchor.call(this,owner);};draw2d.ChopboxConnectionAnchor.prototype=new draw2d.ConnectionAnchor;draw2d.ChopboxConnectionAnchor.prototype.type="ChopboxConnectionAnchor";draw2d.ChopboxConnectionAnchor.prototype.getLocation=function(_4e59){var r=new draw2d.Dimension();r.setBounds(this.getBox());r.translate(-1,-1);r.resize(1,1);var _4e5b=r.x+r.w/2;var _4e5c=r.y+r.h/2;if(r.isEmpty()||(_4e59.x==_4e5b&&_4e59.y==_4e5c)){return new Point(_4e5b,_4e5c);}var dx=_4e59.x-_4e5b;var dy=_4e59.y-_4e5c;var scale=0.5/Math.max(Math.abs(dx)/r.w,Math.abs(dy)/r.h);dx*=scale;dy*=scale;_4e5b+=dx;_4e5c+=dy;return new draw2d.Point(Math.round(_4e5b),Math.round(_4e5c));};draw2d.ChopboxConnectionAnchor.prototype.getBox=function(){return this.getOwner().getParent().getBounds();};draw2d.ChopboxConnectionAnchor.prototype.getReferencePoint=function(){return this.getBox().getCenter();};draw2d.ConnectionDecorator=function(){this.color=new draw2d.Color(0,0,0);this.backgroundColor=new draw2d.Color(250,250,250);};draw2d.ConnectionDecorator.prototype.type="ConnectionDecorator";draw2d.ConnectionDecorator.prototype.paint=function(g){};draw2d.ConnectionDecorator.prototype.setColor=function(c){this.color=c;};draw2d.ConnectionDecorator.prototype.setBackgroundColor=function(c){this.backgroundColor=c;};draw2d.ArrowConnectionDecorator=function(){};draw2d.ArrowConnectionDecorator.prototype=new draw2d.ConnectionDecorator;draw2d.ArrowConnectionDecorator.prototype.type="ArrowConnectionDecorator";draw2d.ArrowConnectionDecorator.prototype.paint=function(g){if(this.backgroundColor!=null){g.setColor(this.backgroundColor);g.fillPolygon([3,20,20,3],[0,5,-5,0]);}g.setColor(this.color);g.setStroke(1);g.drawPolygon([3,20,20,3],[0,5,-5,0]);};draw2d.CompartmentFigure=function(){draw2d.Node.call(this);this.children=new draw2d.ArrayList();this.setBorder(new draw2d.LineBorder(1));this.dropable=new draw2d.DropTarget(this.html);this.dropable.node=this;this.dropable.addEventListener("figureenter",function(_3e18){_3e18.target.node.onFigureEnter(_3e18.relatedTarget.node);});this.dropable.addEventListener("figureleave",function(_3e19){_3e19.target.node.onFigureLeave(_3e19.relatedTarget.node);});this.dropable.addEventListener("figuredrop",function(_3e1a){_3e1a.target.node.onFigureDrop(_3e1a.relatedTarget.node);});};draw2d.CompartmentFigure.prototype=new draw2d.Node;draw2d.CompartmentFigure.prototype.type="CompartmentFigure";draw2d.CompartmentFigure.prototype.onFigureEnter=function(_3e1b){};draw2d.CompartmentFigure.prototype.onFigureLeave=function(_3e1c){};draw2d.CompartmentFigure.prototype.onFigureDrop=function(_3e1d){};draw2d.CompartmentFigure.prototype.getChildren=function(){var _3e1e=new Array();for(var i=0;i<this.children.getSize();i++){_3e1e.push(this.children.get(i));}return _3e1e;};draw2d.CompartmentFigure.prototype.addChild=function(_3e20){_3e20.setZOrder(this.getZOrder()+1);_3e20.setParent(this);this.children.add(_3e20);};draw2d.CompartmentFigure.prototype.removeChild=function(_3e21){_3e21.setParent(null);this.children.remove(_3e21);};draw2d.CompartmentFigure.prototype.setZOrder=function(index){draw2d.Node.prototype.setZOrder.call(this,index);for(var i=0;i<this.children.getSize();i++){this.children.get(i).setZOrder(index+1);}};draw2d.CompartmentFigure.prototype.setPosition=function(xPos,yPos){var oldX=this.getX();var oldY=this.getY();draw2d.Node.prototype.setPosition.call(this,xPos,yPos);for(var i=0;i<this.children.getSize();i++){var child=this.children.get(i);child.setPosition(child.getX()+this.getX()-oldX,child.getY()+this.getY()-oldY);}};draw2d.CompartmentFigure.prototype.onDrag=function(){var oldX=this.getX();var oldY=this.getY();draw2d.Node.prototype.onDrag.call(this);for(var i=0;i<this.children.getSize();i++){var child=this.children.get(i);child.setPosition(child.getX()+this.getX()-oldX,child.getY()+this.getY()-oldY);}};draw2d.Document=function(_4272){this.canvas=_4272;};draw2d.Document.prototype.getFigures=function(){var _4273=new Array();var _4274=this.canvas.figures;var _4275=this.canvas.dialogs;for(var i=0;i<_4274.getSize();i++){var _4277=_4274.get(i);if(_4275.indexOf(_4277)==-1&&_4277.getParent()==null&&!(_4277 instanceof draw2d.Window)){_4273.push(_4277);}}return _4273;};draw2d.Document.prototype.getLines=function(){var _4278=new Array();var lines=this.canvas.getLines();for(var i=0;i<lines.getSize();i++){_4278.push(lines.get(i));}return _4278;};draw2d.Annotation=function(msg){this.msg=msg;this.color=new draw2d.Color(0,0,0);this.bgColor=new draw2d.Color(241,241,121);this.fontSize=10;this.textNode=null;draw2d.Figure.call(this);};draw2d.Annotation.prototype=new draw2d.Figure;draw2d.Annotation.prototype.type="Annotation";draw2d.Annotation.prototype.createHTMLElement=function(){var item=draw2d.Figure.prototype.createHTMLElement.call(this);item.style.color=this.color.getHTMLStyle();item.style.backgroundColor=this.bgColor.getHTMLStyle();item.style.fontSize=this.fontSize+"pt";item.style.width="auto";item.style.height="auto";item.style.margin="0px";item.style.padding="0px";item.onselectstart=function(){return false;};item.unselectable="on";item.style.MozUserSelect="none";item.style.cursor="default";item.style.zIndex=(draw2d.Figure.ZOrderIndex-1);this.textNode=document.createTextNode(this.msg);item.appendChild(this.textNode);this.disableTextSelection(item);return item;};draw2d.Annotation.prototype.onDoubleClick=function(){var _4e36=new draw2d.AnnotationDialog(this);this.workflow.showDialog(_4e36);};draw2d.Annotation.prototype.setBackgroundColor=function(color){this.bgColor=color;if(this.bgColor!=null){this.html.style.backgroundColor=this.bgColor.getHTMLStyle();}else{this.html.style.backgroundColor="transparent";}};draw2d.Annotation.prototype.getBackgroundColor=function(){return this.bgColor;};draw2d.Annotation.prototype.setFontSize=function(size){this.fontSize=size;this.html.style.fontSize=this.fontSize+"pt";};draw2d.Annotation.prototype.getText=function(){return this.msg;};draw2d.Annotation.prototype.setText=function(text){this.msg=text;this.html.removeChild(this.textNode);this.textNode=document.createTextNode(this.msg);this.html.appendChild(this.textNode);};draw2d.Annotation.prototype.setStyledText=function(text){this.msg=text;this.html.removeChild(this.textNode);this.textNode=document.createElement("div");this.textNode.innerHTML=text;this.html.appendChild(this.textNode);};draw2d.ResizeHandle=function(_4256,type){draw2d.Rectangle.call(this,5,5);this.type=type;var _4258=this.getWidth();var _4259=_4258/2;switch(this.type){case 1:this.setSnapToGridAnchor(new draw2d.Point(_4258,_4258));break;case 2:this.setSnapToGridAnchor(new draw2d.Point(_4259,_4258));break;case 3:this.setSnapToGridAnchor(new draw2d.Point(0,_4258));break;case 4:this.setSnapToGridAnchor(new draw2d.Point(0,_4259));break;case 5:this.setSnapToGridAnchor(new draw2d.Point(0,0));break;case 6:this.setSnapToGridAnchor(new draw2d.Point(_4259,0));break;case 7:this.setSnapToGridAnchor(new draw2d.Point(_4258,0));break;case 8:this.setSnapToGridAnchor(new draw2d.Point(_4258,_4259));break;}this.setBackgroundColor(new draw2d.Color(0,255,0));this.setWorkflow(_4256);this.setZOrder(10000);};draw2d.ResizeHandle.prototype=new draw2d.Rectangle;draw2d.ResizeHandle.prototype.type="ResizeHandle";draw2d.ResizeHandle.prototype.getSnapToDirection=function(){switch(this.type){case 1:return draw2d.SnapToHelper.NORTH_WEST;case 2:return draw2d.SnapToHelper.NORTH;case 3:return draw2d.SnapToHelper.NORTH_EAST;case 4:return draw2d.SnapToHelper.EAST;case 5:return draw2d.SnapToHelper.SOUTH_EAST;case 6:return draw2d.SnapToHelper.SOUTH;case 7:return draw2d.SnapToHelper.SOUTH_WEST;case 8:return draw2d.SnapToHelper.WEST;}};draw2d.ResizeHandle.prototype.onDragend=function(){if(this.commandMove==null){return;}var _425a=this.workflow.currentSelection;this.commandMove.setPosition(_425a.getX(),_425a.getY());this.commandResize.setDimension(_425a.getWidth(),_425a.getHeight());this.workflow.getCommandStack().execute(this.commandResize);this.workflow.getCommandStack().execute(this.commandMove);this.commandMove=null;this.commandResize=null;this.workflow.hideSnapToHelperLines();};draw2d.ResizeHandle.prototype.setPosition=function(xPos,yPos){this.x=xPos;this.y=yPos;this.html.style.left=this.x+"px";this.html.style.top=this.y+"px";};draw2d.ResizeHandle.prototype.onDragstart=function(x,y){if(!this.canDrag){return false;}var _425f=this.workflow.currentSelection;this.commandMove=new draw2d.CommandMove(_425f,_425f.getX(),_425f.getY());this.commandResize=new draw2d.CommandResize(_425f,_425f.getWidth(),_425f.getHeight());return true;};draw2d.ResizeHandle.prototype.onDrag=function(){var oldX=this.getX();var oldY=this.getY();draw2d.Rectangle.prototype.onDrag.call(this);var diffX=oldX-this.getX();var diffY=oldY-this.getY();var _4264=this.workflow.currentSelection.getX();var _4265=this.workflow.currentSelection.getY();var _4266=this.workflow.currentSelection.getWidth();var _4267=this.workflow.currentSelection.getHeight();switch(this.type){case 1:this.workflow.currentSelection.setPosition(_4264-diffX,_4265-diffY);this.workflow.currentSelection.setDimension(_4266+diffX,_4267+diffY);break;case 2:this.workflow.currentSelection.setPosition(_4264,_4265-diffY);this.workflow.currentSelection.setDimension(_4266,_4267+diffY);break;case 3:this.workflow.currentSelection.setPosition(_4264,_4265-diffY);this.workflow.currentSelection.setDimension(_4266-diffX,_4267+diffY);break;case 4:this.workflow.currentSelection.setPosition(_4264,_4265);this.workflow.currentSelection.setDimension(_4266-diffX,_4267);break;case 5:this.workflow.currentSelection.setPosition(_4264,_4265);this.workflow.currentSelection.setDimension(_4266-diffX,_4267-diffY);break;case 6:this.workflow.currentSelection.setPosition(_4264,_4265);this.workflow.currentSelection.setDimension(_4266,_4267-diffY);break;case 7:this.workflow.currentSelection.setPosition(_4264-diffX,_4265);this.workflow.currentSelection.setDimension(_4266+diffX,_4267-diffY);break;case 8:this.workflow.currentSelection.setPosition(_4264-diffX,_4265);this.workflow.currentSelection.setDimension(_4266+diffX,_4267);break;}this.workflow.moveResizeHandles(this.workflow.getCurrentSelection());};draw2d.ResizeHandle.prototype.setCanDrag=function(flag){draw2d.Rectangle.prototype.setCanDrag.call(this,flag);if(!flag){this.html.style.cursor="";return;}switch(this.type){case 1:this.html.style.cursor="nw-resize";break;case 2:this.html.style.cursor="s-resize";break;case 3:this.html.style.cursor="ne-resize";break;case 4:this.html.style.cursor="w-resize";break;case 5:this.html.style.cursor="se-resize";break;case 6:this.html.style.cursor="n-resize";break;case 7:this.html.style.cursor="sw-resize";break;case 8:this.html.style.cursor="e-resize";break;}};draw2d.ResizeHandle.prototype.onKeyDown=function(_4269,ctrl){this.workflow.onKeyDown(_4269,ctrl);};draw2d.ResizeHandle.prototype.fireMoveEvent=function(){};draw2d.LineStartResizeHandle=function(_4a5f){draw2d.Rectangle.call(this);this.setDimension(5,5);this.setBackgroundColor(new draw2d.Color(0,255,0));this.setWorkflow(_4a5f);this.setZOrder(10000);};draw2d.LineStartResizeHandle.prototype=new draw2d.Rectangle;draw2d.LineStartResizeHandle.prototype.type="LineStartResizeHandle";draw2d.LineStartResizeHandle.prototype.onDragend=function(){if(this.command==null){return;}var line=this.workflow.currentSelection;var x1=line.getStartX();var y1=line.getStartY();var x2=line.getEndX();var y2=line.getEndY();this.command.setEndPoints(x1,y1,x2,y2);this.workflow.getCommandStack().execute(this.command);this.command=null;};draw2d.LineStartResizeHandle.prototype.onDragstart=function(x,y){if(!this.canDrag){return false;}var line=this.workflow.currentSelection;var x1=line.getStartX();var y1=line.getStartY();var x2=line.getEndX();var y2=line.getEndY();this.command=new draw2d.CommandMoveLine(line,x1,y1,x2,y2);return true;};draw2d.LineStartResizeHandle.prototype.onDrag=function(){var oldX=this.getX();var oldY=this.getY();draw2d.Rectangle.prototype.onDrag.call(this);var diffX=oldX-this.getX();var diffY=oldY-this.getY();var _4a70=this.workflow.currentSelection.getStartX();var _4a71=this.workflow.currentSelection.getStartY();this.workflow.currentSelection.setStartPoint(_4a70-diffX,_4a71-diffY);};draw2d.LineStartResizeHandle.prototype.onKeyDown=function(_4a72,ctrl){if(this.workflow!=null){this.workflow.onKeyDown(_4a72,ctrl);}};draw2d.LineStartResizeHandle.prototype.fireMoveEvent=function(){};draw2d.LineEndResizeHandle=function(_44af){draw2d.Rectangle.call(this);this.setDimension(5,5);this.setBackgroundColor(new draw2d.Color(0,255,0));this.setWorkflow(_44af);this.setZOrder(10000);};draw2d.LineEndResizeHandle.prototype=new draw2d.Rectangle;draw2d.LineEndResizeHandle.prototype.type="LineEndResizeHandle";draw2d.LineEndResizeHandle.prototype.onDragend=function(){if(this.command==null){return;}var line=this.workflow.currentSelection;var x1=line.getStartX();var y1=line.getStartY();var x2=line.getEndX();var y2=line.getEndY();this.command.setEndPoints(x1,y1,x2,y2);this.workflow.getCommandStack().execute(this.command);this.command=null;};draw2d.LineEndResizeHandle.prototype.onDragstart=function(x,y){if(!this.canDrag){return false;}var line=this.workflow.currentSelection;var x1=line.getStartX();var y1=line.getStartY();var x2=line.getEndX();var y2=line.getEndY();this.command=new draw2d.CommandMoveLine(line,x1,y1,x2,y2);return true;};draw2d.LineEndResizeHandle.prototype.onDrag=function(){var oldX=this.getX();var oldY=this.getY();draw2d.Rectangle.prototype.onDrag.call(this);var diffX=oldX-this.getX();var diffY=oldY-this.getY();var _44c0=this.workflow.currentSelection.getEndX();var _44c1=this.workflow.currentSelection.getEndY();this.workflow.currentSelection.setEndPoint(_44c0-diffX,_44c1-diffY);};draw2d.LineEndResizeHandle.prototype.onKeyDown=function(_44c2){if(this.workflow!=null){this.workflow.onKeyDown(_44c2);}};draw2d.LineEndResizeHandle.prototype.fireMoveEvent=function(){};draw2d.Canvas=function(_4d4b){if(_4d4b){this.construct(_4d4b);}this.enableSmoothFigureHandling=false;};draw2d.Canvas.prototype.type="Canvas";draw2d.Canvas.prototype.construct=function(_4d4c){this.canvasId=_4d4c;this.html=document.getElementById(this.canvasId);this.scrollArea=document.body.parentNode;};draw2d.Canvas.prototype.setViewPort=function(divId){this.scrollArea=document.getElementById(divId);};draw2d.Canvas.prototype.addFigure=function(_4d4e,xPos,yPos,_4d51){if(this.enableSmoothFigureHandling==true){if(_4d4e.timer<=0){_4d4e.setAlpha(0.001);}var _4d52=_4d4e;var _4d53=function(){if(_4d52.alpha<1){_4d52.setAlpha(Math.min(1,_4d52.alpha+0.05));}else{window.clearInterval(_4d52.timer);_4d52.timer=-1;}};if(_4d52.timer>0){window.clearInterval(_4d52.timer);}_4d52.timer=window.setInterval(_4d53,30);}_4d4e.setCanvas(this);if(xPos&&yPos){_4d4e.setPosition(xPos,yPos);}this.html.appendChild(_4d4e.getHTMLElement());if(!_4d51){_4d4e.paint();}};draw2d.Canvas.prototype.removeFigure=function(_4d54){if(this.enableSmoothFigureHandling==true){var oThis=this;var _4d56=_4d54;var _4d57=function(){if(_4d56.alpha>0){_4d56.setAlpha(Math.max(0,_4d56.alpha-0.05));}else{window.clearInterval(_4d56.timer);_4d56.timer=-1;oThis.html.removeChild(_4d56.html);_4d56.setCanvas(null);}};if(_4d56.timer>0){window.clearInterval(_4d56.timer);}_4d56.timer=window.setInterval(_4d57,20);}else{this.html.removeChild(_4d54.html);_4d54.setCanvas(null);}};draw2d.Canvas.prototype.getEnableSmoothFigureHandling=function(){return this.enableSmoothFigureHandling;};draw2d.Canvas.prototype.setEnableSmoothFigureHandling=function(flag){this.enableSmoothFigureHandling=flag;};draw2d.Canvas.prototype.getWidth=function(){return parseInt(this.html.style.width);};draw2d.Canvas.prototype.getHeight=function(){return parseInt(this.html.style.height);};draw2d.Canvas.prototype.setBackgroundImage=function(_4d59,_4d5a){if(_4d59!=null){if(_4d5a){this.html.style.background="transparent url("+_4d59+") ";}else{this.html.style.background="transparent url("+_4d59+") no-repeat";}}else{this.html.style.background="transparent";}};draw2d.Canvas.prototype.getY=function(){return this.y;};draw2d.Canvas.prototype.getX=function(){return this.x;};draw2d.Canvas.prototype.getAbsoluteY=function(){var el=this.html;var ot=el.offsetTop;while((el=el.offsetParent)!=null){ot+=el.offsetTop;}return ot;};draw2d.Canvas.prototype.getAbsoluteX=function(){var el=this.html;var ol=el.offsetLeft;while((el=el.offsetParent)!=null){ol+=el.offsetLeft;}return ol;};draw2d.Canvas.prototype.getScrollLeft=function(){return this.scrollArea.scrollLeft;};draw2d.Canvas.prototype.getScrollTop=function(){return this.scrollArea.scrollTop;};draw2d.Workflow=function(id){if(!id){return;}this.gridWidthX=10;this.gridWidthY=10;this.snapToGridHelper=null;this.verticalSnapToHelperLine=null;this.horizontalSnapToHelperLine=null;this.figures=new draw2d.ArrayList();this.lines=new draw2d.ArrayList();this.commonPorts=new draw2d.ArrayList();this.dropTargets=new draw2d.ArrayList();this.compartments=new draw2d.ArrayList();this.selectionListeners=new draw2d.ArrayList();this.dialogs=new draw2d.ArrayList();this.toolPalette=null;this.dragging=false;this.tooltip=null;this.draggingLine=null;this.commandStack=new draw2d.CommandStack();this.oldScrollPosLeft=0;this.oldScrollPosTop=0;this.currentSelection=null;this.currentMenu=null;this.connectionLine=new draw2d.Line();this.resizeHandleStart=new draw2d.LineStartResizeHandle(this);this.resizeHandleEnd=new draw2d.LineEndResizeHandle(this);this.resizeHandle1=new draw2d.ResizeHandle(this,1);this.resizeHandle2=new draw2d.ResizeHandle(this,2);this.resizeHandle3=new draw2d.ResizeHandle(this,3);this.resizeHandle4=new draw2d.ResizeHandle(this,4);this.resizeHandle5=new draw2d.ResizeHandle(this,5);this.resizeHandle6=new draw2d.ResizeHandle(this,6);this.resizeHandle7=new draw2d.ResizeHandle(this,7);this.resizeHandle8=new draw2d.ResizeHandle(this,8);this.resizeHandleHalfWidth=parseInt(this.resizeHandle2.getWidth()/2);draw2d.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 _42e3=function(){var _42e4=arguments[0]||window.event;var diffX=_42e4.clientX;var diffY=_42e4.clientY;var _42e7=oThis.getScrollLeft();var _42e8=oThis.getScrollTop();var _42e9=oThis.getAbsoluteX();var _42ea=oThis.getAbsoluteY();if(oThis.getBestFigure(diffX+_42e7-_42e9,diffY+_42e8-_42ea)!=null){return;}var line=oThis.getBestLine(diffX+_42e7-_42e9,diffY+_42e8-_42ea,null);if(line!=null){line.onContextMenu(diffX+_42e7-_42e9,diffY+_42e8-_42ea);}else{oThis.onContextMenu(diffX+_42e7-_42e9,diffY+_42e8-_42ea);}};this.html.oncontextmenu=function(){return false;};var oThis=this;var _42ed=function(event){var ctrl=event.ctrlKey;oThis.onKeyDown(event.keyCode,ctrl);};var _42f0=function(){var _42f1=arguments[0]||window.event;var diffX=_42f1.clientX;var diffY=_42f1.clientY;var _42f4=oThis.getScrollLeft();var _42f5=oThis.getScrollTop();var _42f6=oThis.getAbsoluteX();var _42f7=oThis.getAbsoluteY();oThis.onMouseDown(diffX+_42f4-_42f6,diffY+_42f5-_42f7);};var _42f8=function(){var _42f9=arguments[0]||window.event;if(oThis.currentMenu!=null){oThis.removeFigure(oThis.currentMenu);oThis.currentMenu=null;}if(_42f9.button==2){return;}var diffX=_42f9.clientX;var diffY=_42f9.clientY;var _42fc=oThis.getScrollLeft();var _42fd=oThis.getScrollTop();var _42fe=oThis.getAbsoluteX();var _42ff=oThis.getAbsoluteY();oThis.onMouseUp(diffX+_42fc-_42fe,diffY+_42fd-_42ff);};var _4300=function(){var _4301=arguments[0]||window.event;var diffX=_4301.clientX;var diffY=_4301.clientY;var _4304=oThis.getScrollLeft();var _4305=oThis.getScrollTop();var _4306=oThis.getAbsoluteX();var _4307=oThis.getAbsoluteY();oThis.currentMouseX=diffX+_4304-_4306;oThis.currentMouseY=diffY+_4305-_4307;var obj=oThis.getBestFigure(oThis.currentMouseX,oThis.currentMouseY);if(draw2d.Drag.currentHover!=null&&obj==null){var _4309=new draw2d.DragDropEvent();_4309.initDragDropEvent("mouseleave",false,oThis);draw2d.Drag.currentHover.dispatchEvent(_4309);}else{var diffX=_4301.clientX;var diffY=_4301.clientY;var _4304=oThis.getScrollLeft();var _4305=oThis.getScrollTop();var _4306=oThis.getAbsoluteX();var _4307=oThis.getAbsoluteY();oThis.onMouseMove(diffX+_4304-_4306,diffY+_4305-_4307);}if(obj==null){draw2d.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 _430a=function(_430b){var _430b=arguments[0]||window.event;var diffX=_430b.clientX;var diffY=_430b.clientY;var _430e=oThis.getScrollLeft();var _430f=oThis.getScrollTop();var _4310=oThis.getAbsoluteX();var _4311=oThis.getAbsoluteY();var line=oThis.getBestLine(diffX+_430e-_4310,diffY+_430f-_4311,null);if(line!=null){line.onDoubleClick();}};if(this.html.addEventListener){this.html.addEventListener("contextmenu",_42e3,false);this.html.addEventListener("mousemove",_4300,false);this.html.addEventListener("mouseup",_42f8,false);this.html.addEventListener("mousedown",_42f0,false);this.html.addEventListener("keydown",_42ed,false);this.html.addEventListener("dblclick",_430a,false);}else{if(this.html.attachEvent){this.html.attachEvent("oncontextmenu",_42e3);this.html.attachEvent("onmousemove",_4300);this.html.attachEvent("onmousedown",_42f0);this.html.attachEvent("onmouseup",_42f8);this.html.attachEvent("onkeydown",_42ed);this.html.attachEvent("ondblclick",_430a);}else{throw new Error("Open-jACOB Draw2D not supported in this browser.");}}}};draw2d.Workflow.prototype=new draw2d.Canvas;draw2d.Workflow.prototype.type="Workflow";draw2d.Workflow.prototype.onScroll=function(){var _4313=this.getScrollLeft();var _4314=this.getScrollTop();var _4315=_4313-this.oldScrollPosLeft;var _4316=_4314-this.oldScrollPosTop;for(var i=0;i<this.figures.getSize();i++){var _4318=this.figures.get(i);if(_4318.hasFixedPosition&&_4318.hasFixedPosition()==true){_4318.setPosition(_4318.getX()+_4315,_4318.getY()+_4316);}}this.oldScrollPosLeft=_4313;this.oldScrollPosTop=_4314;};draw2d.Workflow.prototype.setPanning=function(flag){this.panning=flag;if(flag){this.html.style.cursor="move";}else{this.html.style.cursor="default";}};draw2d.Workflow.prototype.scrollTo=function(x,y,fast){if(fast){this.scrollArea.scrollLeft=x;this.scrollArea.scrollTop=y;}else{var steps=40;var xStep=(x-this.getScrollLeft())/steps;var yStep=(y-this.getScrollTop())/steps;var oldX=this.getScrollLeft();var oldY=this.getScrollTop();for(var i=0;i<steps;i++){this.scrollArea.scrollLeft=oldX+(xStep*i);this.scrollArea.scrollTop=oldY+(yStep*i);}}};draw2d.Workflow.prototype.showTooltip=function(_4323,_4324){if(this.tooltip!=null){this.removeFigure(this.tooltip);this.tooltip=null;if(this.tooltipTimer>=0){window.clearTimeout(this.tooltipTimer);this.tooltipTimer=-1;}}this.tooltip=_4323;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 _4326=function(){oThis.tooltipTimer=-1;oThis.showTooltip(null);};if(_4324==true){this.tooltipTimer=window.setTimeout(_4326,5000);}}};draw2d.Workflow.prototype.showDialog=function(_4327,xPos,yPos){if(xPos){this.addFigure(_4327,xPos,yPos);}else{this.addFigure(_4327,200,100);}this.dialogs.add(_4327);};draw2d.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();}};draw2d.Workflow.prototype.onContextMenu=function(x,y){var menu=this.getContextMenu();if(menu!=null){this.showMenu(menu,x,y);}};draw2d.Workflow.prototype.getContextMenu=function(){return null;};draw2d.Workflow.prototype.setToolWindow=function(_4330,x,y){this.toolPalette=_4330;if(y){this.addFigure(_4330,x,y);}else{this.addFigure(_4330,20,20);}this.dialogs.add(_4330);};draw2d.Workflow.prototype.setSnapToGrid=function(flag){if(flag){this.snapToGridHelper=new draw2d.SnapToGrid(this);}else{this.snapToGridHelper=null;}};draw2d.Workflow.prototype.setSnapToGeometry=function(flag){if(flag){this.snapToGeometryHelper=new draw2d.SnapToGeometry(this);}else{this.snapToGeometryHelper=null;}};draw2d.Workflow.prototype.setGridWidth=function(dx,dy){this.gridWidthX=dx;this.gridWidthY=dy;};draw2d.Workflow.prototype.addFigure=function(_4337,xPos,yPos){draw2d.Canvas.prototype.addFigure.call(this,_4337,xPos,yPos,true);_4337.setWorkflow(this);var _433a=this;if(_4337 instanceof draw2d.CompartmentFigure){this.compartments.add(_4337);}if(_4337 instanceof draw2d.Line){this.lines.add(_4337);}else{this.figures.add(_4337);_4337.draggable.addEventListener("dragend",function(_433b){});_4337.draggable.addEventListener("dragstart",function(_433c){var _433d=_433a.getFigure(_433c.target.element.id);if(_433d==null){return;}if(_433d.isSelectable()==false){return;}_433a.showResizeHandles(_433d);_433a.setCurrentSelection(_433d);});_4337.draggable.addEventListener("drag",function(_433e){var _433f=_433a.getFigure(_433e.target.element.id);if(_433f==null){return;}if(_433f.isSelectable()==false){return;}_433a.moveResizeHandles(_433f);});}_4337.paint();this.setDocumentDirty();};draw2d.Workflow.prototype.removeFigure=function(_4340){draw2d.Canvas.prototype.removeFigure.call(this,_4340);this.figures.remove(_4340);this.lines.remove(_4340);this.dialogs.remove(_4340);_4340.setWorkflow(null);if(_4340 instanceof draw2d.CompartmentFigure){this.compartments.remove(_4340);}if(_4340 instanceof draw2d.Connection){_4340.disconnect();}if(this.currentSelection==_4340){this.setCurrentSelection(null);}this.setDocumentDirty();};draw2d.Workflow.prototype.moveFront=function(_4341){this.html.removeChild(_4341.getHTMLElement());this.html.appendChild(_4341.getHTMLElement());};draw2d.Workflow.prototype.moveBack=function(_4342){this.html.removeChild(_4342.getHTMLElement());this.html.insertBefore(_4342.getHTMLElement(),this.html.firstChild);};draw2d.Workflow.prototype.getBestCompartmentFigure=function(x,y,_4345){var _4346=null;for(var i=0;i<this.figures.getSize();i++){var _4348=this.figures.get(i);if((_4348 instanceof draw2d.CompartmentFigure)&&_4348.isOver(x,y)==true&&_4348!=_4345){if(_4346==null){_4346=_4348;}else{if(_4346.getZOrder()<_4348.getZOrder()){_4346=_4348;}}}}return _4346;};draw2d.Workflow.prototype.getBestFigure=function(x,y,_434b){var _434c=null;for(var i=0;i<this.figures.getSize();i++){var _434e=this.figures.get(i);if(_434e.isOver(x,y)==true&&_434e!=_434b){if(_434c==null){_434c=_434e;}else{if(_434c.getZOrder()<_434e.getZOrder()){_434c=_434e;}}}}return _434c;};draw2d.Workflow.prototype.getBestLine=function(x,y,_4351){var _4352=null;for(var i=0;i<this.lines.getSize();i++){var line=this.lines.get(i);if(line.containsPoint(x,y)==true&&line!=_4351){if(_4352==null){_4352=line;}else{if(_4352.getZOrder()<line.getZOrder()){_4352=line;}}}}return _4352;};draw2d.Workflow.prototype.getFigure=function(id){for(var i=0;i<this.figures.getSize();i++){var _4357=this.figures.get(i);if(_4357.id==id){return _4357;}}return null;};draw2d.Workflow.prototype.getFigures=function(){return this.figures;};draw2d.Workflow.prototype.getDocument=function(){return new draw2d.Document(this);};draw2d.Workflow.prototype.addSelectionListener=function(w){this.selectionListeners.add(w);};draw2d.Workflow.prototype.removeSelectionListener=function(w){this.selectionListeners.remove(w);};draw2d.Workflow.prototype.setCurrentSelection=function(_435a){if(_435a==null){this.hideResizeHandles();this.hideLineResizeHandles();}this.currentSelection=_435a;for(var i=0;i<this.selectionListeners.getSize();i++){var w=this.selectionListeners.get(i);if(w!=null&&w.onSelectionChanged){w.onSelectionChanged(this.currentSelection);}}};draw2d.Workflow.prototype.getCurrentSelection=function(){return this.currentSelection;};draw2d.Workflow.prototype.getLines=function(){return this.lines;};draw2d.Workflow.prototype.registerPort=function(port){this.commonPorts.add(port);port.draggable.targets=this.dropTargets;this.dropTargets.add(port.dropable);};draw2d.Workflow.prototype.unregisterPort=function(port){port.targets=null;this.commonPorts.remove(port);this.dropTargets.remove(port);};draw2d.Workflow.prototype.getCommandStack=function(){return this.commandStack;};draw2d.Workflow.prototype.showConnectionLine=function(x1,y1,x2,y2){this.connectionLine.setStartPoint(x1,y1);this.connectionLine.setEndPoint(x2,y2);if(this.connectionLine.canvas==null){draw2d.Canvas.prototype.addFigure.call(this,this.connectionLine);}};draw2d.Workflow.prototype.hideConnectionLine=function(){if(this.connectionLine.canvas!=null){draw2d.Canvas.prototype.removeFigure.call(this,this.connectionLine);}};draw2d.Workflow.prototype.showLineResizeHandles=function(_4363){var _4364=this.resizeHandleStart.getWidth()/2;var _4365=this.resizeHandleStart.getHeight()/2;draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandleStart,_4363.getStartX()-_4364,_4363.getStartY()-_4364);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandleEnd,_4363.getEndX()-_4364,_4363.getEndY()-_4364);this.resizeHandleStart.setCanDrag(_4363.isResizeable());this.resizeHandleEnd.setCanDrag(_4363.isResizeable());if(_4363.isResizeable()){var green=new draw2d.Color(0,255,0);this.resizeHandleStart.setBackgroundColor(green);this.resizeHandleEnd.setBackgroundColor(green);}else{this.resizeHandleStart.setBackgroundColor(null);this.resizeHandleEnd.setBackgroundColor(null);}};draw2d.Workflow.prototype.hideLineResizeHandles=function(){if(this.resizeHandleStart.canvas!=null){draw2d.Canvas.prototype.removeFigure.call(this,this.resizeHandleStart);}if(this.resizeHandleEnd.canvas!=null){draw2d.Canvas.prototype.removeFigure.call(this,this.resizeHandleEnd);}};draw2d.Workflow.prototype.showResizeHandles=function(_4367){this.hideLineResizeHandles();this.hideResizeHandles();if(this.getEnableSmoothFigureHandling()==true&&this.getCurrentSelection()!=_4367){this.resizeHandle1.setAlpha(0.01);this.resizeHandle2.setAlpha(0.01);this.resizeHandle3.setAlpha(0.01);this.resizeHandle4.setAlpha(0.01);this.resizeHandle5.setAlpha(0.01);this.resizeHandle6.setAlpha(0.01);this.resizeHandle7.setAlpha(0.01);this.resizeHandle8.setAlpha(0.01);}var _4368=this.resizeHandle1.getWidth();var _4369=this.resizeHandle1.getHeight();var _436a=_4367.getHeight();var _436b=_4367.getWidth();var xPos=_4367.getX();var yPos=_4367.getY();draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle1,xPos-_4368,yPos-_4369);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle3,xPos+_436b,yPos-_4369);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle5,xPos+_436b,yPos+_436a);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle7,xPos-_4368,yPos+_436a);this.moveFront(this.resizeHandle1);this.moveFront(this.resizeHandle3);this.moveFront(this.resizeHandle5);this.moveFront(this.resizeHandle7);this.resizeHandle1.setCanDrag(_4367.isResizeable());this.resizeHandle3.setCanDrag(_4367.isResizeable());this.resizeHandle5.setCanDrag(_4367.isResizeable());this.resizeHandle7.setCanDrag(_4367.isResizeable());if(_4367.isResizeable()){var green=new draw2d.Color(0,255,0);this.resizeHandle1.setBackgroundColor(green);this.resizeHandle3.setBackgroundColor(green);this.resizeHandle5.setBackgroundColor(green);this.resizeHandle7.setBackgroundColor(green);}else{this.resizeHandle1.setBackgroundColor(null);this.resizeHandle3.setBackgroundColor(null);this.resizeHandle5.setBackgroundColor(null);this.resizeHandle7.setBackgroundColor(null);}if(_4367.isStrechable()&&_4367.isResizeable()){this.resizeHandle2.setCanDrag(_4367.isResizeable());this.resizeHandle4.setCanDrag(_4367.isResizeable());this.resizeHandle6.setCanDrag(_4367.isResizeable());this.resizeHandle8.setCanDrag(_4367.isResizeable());draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle2,xPos+(_436b/2)-this.resizeHandleHalfWidth,yPos-_4369);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle4,xPos+_436b,yPos+(_436a/2)-(_4369/2));draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle6,xPos+(_436b/2)-this.resizeHandleHalfWidth,yPos+_436a);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle8,xPos-_4368,yPos+(_436a/2)-(_4369/2));this.moveFront(this.resizeHandle2);this.moveFront(this.resizeHandle4);this.moveFront(this.resizeHandle6);this.moveFront(this.resizeHandle8);}};draw2d.Workflow.prototype.hideResizeHandles=function(){if(this.resizeHandle1.canvas!=null){draw2d.Canvas.prototype.removeFigure.call(this,this.resizeHandle1);}if(this.resizeHandle2.canvas!=null){draw2d.Canvas.prototype.removeFigure.call(this,this.resizeHandle2);}if(this.resizeHandle3.canvas!=null){draw2d.Canvas.prototype.removeFigure.call(this,this.resizeHandle3);}if(this.resizeHandle4.canvas!=null){draw2d.Canvas.prototype.removeFigure.call(this,this.resizeHandle4);}if(this.resizeHandle5.canvas!=null){draw2d.Canvas.prototype.removeFigure.call(this,this.resizeHandle5);}if(this.resizeHandle6.canvas!=null){draw2d.Canvas.prototype.removeFigure.call(this,this.resizeHandle6);}if(this.resizeHandle7.canvas!=null){draw2d.Canvas.prototype.removeFigure.call(this,this.resizeHandle7);}if(this.resizeHandle8.canvas!=null){draw2d.Canvas.prototype.removeFigure.call(this,this.resizeHandle8);}};draw2d.Workflow.prototype.moveResizeHandles=function(_436f){var _4370=this.resizeHandle1.getWidth();var _4371=this.resizeHandle1.getHeight();var _4372=_436f.getHeight();var _4373=_436f.getWidth();var xPos=_436f.getX();var yPos=_436f.getY();this.resizeHandle1.setPosition(xPos-_4370,yPos-_4371);this.resizeHandle3.setPosition(xPos+_4373,yPos-_4371);this.resizeHandle5.setPosition(xPos+_4373,yPos+_4372);this.resizeHandle7.setPosition(xPos-_4370,yPos+_4372);if(_436f.isStrechable()){this.resizeHandle2.setPosition(xPos+(_4373/2)-this.resizeHandleHalfWidth,yPos-_4371);this.resizeHandle4.setPosition(xPos+_4373,yPos+(_4372/2)-(_4371/2));this.resizeHandle6.setPosition(xPos+(_4373/2)-this.resizeHandleHalfWidth,yPos+_4372);this.resizeHandle8.setPosition(xPos-_4370,yPos+(_4372/2)-(_4371/2));}};draw2d.Workflow.prototype.onMouseDown=function(x,y){this.dragging=true;this.mouseDownPosX=x;this.mouseDownPosY=y;if(this.toolPalette!=null&&this.toolPalette.getActiveTool()!=null){this.toolPalette.getActiveTool().execute(x,y);}this.setCurrentSelection(null);this.showMenu(null);for(var i=0;i<this.getLines().getSize();i++){var line=this.lines.get(i);if(line.containsPoint(x,y)&&line.isSelectable()){this.hideResizeHandles();this.setCurrentSelection(line);this.showLineResizeHandles(this.currentSelection);if(line instanceof draw2d.Line&&!(line instanceof draw2d.Connection)){this.draggingLine=line;}break;}}};draw2d.Workflow.prototype.onMouseUp=function(x,y){this.dragging=false;this.draggingLine=null;};draw2d.Workflow.prototype.onMouseMove=function(x,y){if(this.dragging==true&&this.draggingLine!=null){var diffX=x-this.mouseDownPosX;var diffY=y-this.mouseDownPosY;this.draggingLine.startX=this.draggingLine.getStartX()+diffX;this.draggingLine.startY=this.draggingLine.getStartY()+diffY;this.draggingLine.setEndPoint(this.draggingLine.getEndX()+diffX,this.draggingLine.getEndY()+diffY);this.mouseDownPosX=x;this.mouseDownPosY=y;this.showLineResizeHandles(this.currentSelection);}else{if(this.dragging==true&&this.panning==true){var diffX=x-this.mouseDownPosX;var diffY=y-this.mouseDownPosY;this.scrollTo(this.getScrollLeft()-diffX,this.getScrollTop()-diffY,true);this.onScroll();}}};draw2d.Workflow.prototype.onKeyDown=function(_4380,ctrl){if(_4380==46&&this.currentSelection!=null&&this.currentSelection.isDeleteable()){this.commandStack.execute(new draw2d.CommandDelete(this.currentSelection));}else{if(_4380==90&&ctrl){this.commandStack.undo();}else{if(_4380==89&&ctrl){this.commandStack.redo();}}}};draw2d.Workflow.prototype.setDocumentDirty=function(){for(var i=0;i<this.dialogs.getSize();i++){var d=this.dialogs.get(i);if(d!=null&&d.onSetDocumentDirty){d.onSetDocumentDirty();}}if(this.snapToGeometryHelper!=null){this.snapToGeometryHelper.onSetDocumentDirty();}if(this.snapToGridHelper!=null){this.snapToGridHelper.onSetDocumentDirty();}};draw2d.Workflow.prototype.snapToHelper=function(_4384,pos){if(this.snapToGeometryHelper!=null){if(_4384 instanceof draw2d.ResizeHandle){var _4386=_4384.getSnapToGridAnchor();pos.x+=_4386.x;pos.y+=_4386.y;var _4387=new draw2d.Point(pos.x,pos.y);var _4388=_4384.getSnapToDirection();var _4389=this.snapToGeometryHelper.snapPoint(_4388,pos,_4387);if((_4388&draw2d.SnapToHelper.EAST_WEST)&&!(_4389&draw2d.SnapToHelper.EAST_WEST)){this.showSnapToHelperLineVertical(_4387.x);}else{this.hideSnapToHelperLineVertical();}if((_4388&draw2d.SnapToHelper.NORTH_SOUTH)&&!(_4389&draw2d.SnapToHelper.NORTH_SOUTH)){this.showSnapToHelperLineHorizontal(_4387.y);}else{this.hideSnapToHelperLineHorizontal();}_4387.x-=_4386.x;_4387.y-=_4386.y;return _4387;}else{var _438a=new draw2d.Dimension(pos.x,pos.y,_4384.getWidth(),_4384.getHeight());var _4387=new draw2d.Dimension(pos.x,pos.y,_4384.getWidth(),_4384.getHeight());var _4388=draw2d.SnapToHelper.NSEW;var _4389=this.snapToGeometryHelper.snapRectangle(_438a,_4387);if((_4388&draw2d.SnapToHelper.WEST)&&!(_4389&draw2d.SnapToHelper.WEST)){this.showSnapToHelperLineVertical(_4387.x);}else{if((_4388&draw2d.SnapToHelper.EAST)&&!(_4389&draw2d.SnapToHelper.EAST)){this.showSnapToHelperLineVertical(_4387.getX()+_4387.getWidth());}else{this.hideSnapToHelperLineVertical();}}if((_4388&draw2d.SnapToHelper.NORTH)&&!(_4389&draw2d.SnapToHelper.NORTH)){this.showSnapToHelperLineHorizontal(_4387.y);}else{if((_4388&draw2d.SnapToHelper.SOUTH)&&!(_4389&draw2d.SnapToHelper.SOUTH)){this.showSnapToHelperLineHorizontal(_4387.getY()+_4387.getHeight());}else{this.hideSnapToHelperLineHorizontal();}}return _4387.getTopLeft();}}else{if(this.snapToGridHelper!=null){var _4386=_4384.getSnapToGridAnchor();pos.x=pos.x+_4386.x;pos.y=pos.y+_4386.y;var _4387=new draw2d.Point(pos.x,pos.y);this.snapToGridHelper.snapPoint(0,pos,_4387);_4387.x=_4387.x-_4386.x;_4387.y=_4387.y-_4386.y;return _4387;}}return pos;};draw2d.Workflow.prototype.showSnapToHelperLineHorizontal=function(_438b){if(this.horizontalSnapToHelperLine==null){this.horizontalSnapToHelperLine=new draw2d.Line();this.horizontalSnapToHelperLine.setColor(new draw2d.Color(175,175,255));this.addFigure(this.horizontalSnapToHelperLine);}this.horizontalSnapToHelperLine.setStartPoint(0,_438b);this.horizontalSnapToHelperLine.setEndPoint(this.getWidth(),_438b);};draw2d.Workflow.prototype.showSnapToHelperLineVertical=function(_438c){if(this.verticalSnapToHelperLine==null){this.verticalSnapToHelperLine=new draw2d.Line();this.verticalSnapToHelperLine.setColor(new draw2d.Color(175,175,255));this.addFigure(this.verticalSnapToHelperLine);}this.verticalSnapToHelperLine.setStartPoint(_438c,0);this.verticalSnapToHelperLine.setEndPoint(_438c,this.getHeight());};draw2d.Workflow.prototype.hideSnapToHelperLines=function(){this.hideSnapToHelperLineHorizontal();this.hideSnapToHelperLineVertical();};draw2d.Workflow.prototype.hideSnapToHelperLineHorizontal=function(){if(this.horizontalSnapToHelperLine!=null){this.removeFigure(this.horizontalSnapToHelperLine);this.horizontalSnapToHelperLine=null;}};draw2d.Workflow.prototype.hideSnapToHelperLineVertical=function(){if(this.verticalSnapToHelperLine!=null){this.removeFigure(this.verticalSnapToHelperLine);this.verticalSnapToHelperLine=null;}};draw2d.Window=function(title){this.title=title;this.titlebar=null;draw2d.Figure.call(this);this.setDeleteable(false);this.setCanSnapToHelper(false);this.setZOrder(draw2d.Window.ZOrderIndex);};draw2d.Window.prototype=new draw2d.Figure;draw2d.Window.prototype.type="Window";draw2d.Window.ZOrderIndex=5000;draw2d.Window.setZOrderBaseIndex=function(index){draw2d.Window.ZOrderBaseIndex=index;};draw2d.Window.prototype.hasFixedPosition=function(){return true;};draw2d.Window.prototype.hasTitleBar=function(){return true;};draw2d.Window.prototype.createHTMLElement=function(){var item=draw2d.Figure.prototype.createHTMLElement.call(this);item.style.margin="0px";item.style.padding="0px";item.style.border="1px solid black";item.style.backgroundImage="url(window_bg.png)";item.style.zIndex=draw2d.Window.ZOrderBaseIndex;item.style.cursor=null;if(this.hasTitleBar()){this.titlebar=document.createElement("div");this.titlebar.style.position="absolute";this.titlebar.style.left="0px";this.titlebar.style.top="0px";this.titlebar.style.width=this.getWidth()+"px";this.titlebar.style.height="15px";this.titlebar.style.margin="0px";this.titlebar.style.padding="0px";this.titlebar.style.font="normal 10px verdana";this.titlebar.style.backgroundColor="blue";this.titlebar.style.borderBottom="2px solid gray";this.titlebar.style.whiteSpace="nowrap";this.titlebar.style.textAlign="center";this.titlebar.style.backgroundImage="url(window_toolbar.png)";this.textNode=document.createTextNode(this.title);this.titlebar.appendChild(this.textNode);this.disableTextSelection(this.titlebar);item.appendChild(this.titlebar);}return item;};draw2d.Window.prototype.setDocumentDirty=function(_42d4){};draw2d.Window.prototype.onDragend=function(){};draw2d.Window.prototype.onDragstart=function(x,y){if(this.titlebar==null){return false;}if(this.canDrag==true&&x<parseInt(this.titlebar.style.width)&&y<parseInt(this.titlebar.style.height)){return true;}return false;};draw2d.Window.prototype.isSelectable=function(){return false;};draw2d.Window.prototype.setCanDrag=function(flag){draw2d.Figure.prototype.setCanDrag.call(this,flag);this.html.style.cursor="";if(this.titlebar==null){return;}if(flag){this.titlebar.style.cursor="move";}else{this.titlebar.style.cursor="";}};draw2d.Window.prototype.setWorkflow=function(_42d8){var _42d9=this.workflow;draw2d.Figure.prototype.setWorkflow.call(this,_42d8);if(_42d9!=null){_42d9.removeSelectionListener(this);}if(this.workflow!=null){this.workflow.addSelectionListener(this);}};draw2d.Window.prototype.setDimension=function(w,h){draw2d.Figure.prototype.setDimension.call(this,w,h);if(this.titlebar!=null){this.titlebar.style.width=this.getWidth()+"px";}};draw2d.Window.prototype.setTitle=function(title){this.title=title;};draw2d.Window.prototype.getMinWidth=function(){return 50;};draw2d.Window.prototype.getMinHeight=function(){return 50;};draw2d.Window.prototype.isResizeable=function(){return false;};draw2d.Window.prototype.setAlpha=function(_42dd){};draw2d.Window.prototype.setBackgroundColor=function(color){this.bgColor=color;if(this.bgColor!=null){this.html.style.backgroundColor=this.bgColor.getHTMLStyle();}else{this.html.style.backgroundColor="transparent";this.html.style.backgroundImage="";}};draw2d.Window.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="0px";}};draw2d.Window.prototype.setLineWidth=function(w){this.lineStroke=w;this.html.style.border=this.lineStroke+"px solid black";};draw2d.Window.prototype.onSelectionChanged=function(_42e1){};draw2d.Button=function(_5241,width,_5243){this.x=0;this.y=0;this.id=this.generateUId();this.enabled=true;this.active=false;this.palette=_5241;if(width&&_5243){this.setDimension(width,_5243);}else{this.setDimension(24,24);}this.html=this.createHTMLElement();};draw2d.Button.prototype.type="Button";draw2d.Button.prototype.dispose=function(){};draw2d.Button.prototype.getImageUrl=function(){if(this.enabled){return this.type+".png";}else{return this.type+"_disabled.png";}};draw2d.Button.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";if(this.getImageUrl()!=null){item.style.backgroundImage="url("+this.getImageUrl()+")";}else{item.style.backgroundImage="";}var oThis=this;this.omousedown=function(event){if(oThis.enabled){oThis.setActive(true);}event.cancelBubble=true;event.returnValue=false;};this.omouseup=function(event){if(oThis.enabled){oThis.setActive(false);oThis.execute();}event.cancelBubble=true;event.returnValue=false;};if(item.addEventListener){item.addEventListener("mousedown",this.omousedown,false);item.addEventListener("mouseup",this.omouseup,false);}else{if(item.attachEvent){item.attachEvent("onmousedown",this.omousedown);item.attachEvent("onmouseup",this.omouseup);}}return item;};draw2d.Button.prototype.getHTMLElement=function(){if(this.html==null){this.html=this.createHTMLElement();}return this.html;};draw2d.Button.prototype.execute=function(){};draw2d.Button.prototype.setTooltip=function(_5248){this.tooltip=_5248;if(this.tooltip!=null){this.html.title=this.tooltip;}else{this.html.title="";}};draw2d.Button.prototype.setActive=function(flag){if(!this.enabled){return;}this.active=flag;if(flag==true){this.html.style.border="2px inset";}else{this.html.style.border="0px";}};draw2d.Button.prototype.isActive=function(){return this.active;};draw2d.Button.prototype.setEnabled=function(flag){this.enabled=flag;if(this.getImageUrl()!=null){this.html.style.backgroundImage="url("+this.getImageUrl()+")";}else{this.html.style.backgroundImage="";}};draw2d.Button.prototype.setDimension=function(w,h){this.width=w;this.height=h;if(this.html==null){return;}this.html.style.width=this.width+"px";this.html.style.height=this.height+"px";};draw2d.Button.prototype.setPosition=function(xPos,yPos){this.x=Math.max(0,xPos);this.y=Math.max(0,yPos);if(this.html==null){return;}this.html.style.left=this.x+"px";this.html.style.top=this.y+"px";};draw2d.Button.prototype.getWidth=function(){return this.width;};draw2d.Button.prototype.getHeight=function(){return this.height;};draw2d.Button.prototype.getY=function(){return this.y;};draw2d.Button.prototype.getX=function(){return this.x;};draw2d.Button.prototype.getPosition=function(){return new draw2d.Point(this.x,this.y);};draw2d.Button.prototype.getToolPalette=function(){return this.palette;};draw2d.Button.prototype.generateUId=function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var _5250=10;var _5251=10;nbTry=0;while(nbTry<1000){var id="";for(var i=0;i<_5250;i++){var rnum=Math.floor(Math.random()*chars.length);id+=chars.substring(rnum,rnum+1);}elem=document.getElementById(id);if(!elem){return id;}nbTry+=1;}return null;};draw2d.ToggleButton=function(_4e82){draw2d.Button.call(this,_4e82);this.isDownFlag=false;};draw2d.ToggleButton.prototype=new draw2d.Button;draw2d.ToggleButton.prototype.type="ToggleButton";draw2d.ToggleButton.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="24px";item.style.width="24px";item.style.margin="0px";item.style.padding="0px";if(this.getImageUrl()!=null){item.style.backgroundImage="url("+this.getImageUrl()+")";}else{item.style.backgroundImage="";}var oThis=this;this.omousedown=function(event){if(oThis.enabled){if(!oThis.isDown()){draw2d.Button.prototype.setActive.call(oThis,true);}}event.cancelBubble=true;event.returnValue=false;};this.omouseup=function(event){if(oThis.enabled){if(oThis.isDown()){draw2d.Button.prototype.setActive.call(oThis,false);}oThis.isDownFlag=!oThis.isDownFlag;oThis.execute();}event.cancelBubble=true;event.returnValue=false;};if(item.addEventListener){item.addEventListener("mousedown",this.omousedown,false);item.addEventListener("mouseup",this.omouseup,false);}else{if(item.attachEvent){item.attachEvent("onmousedown",this.omousedown);item.attachEvent("onmouseup",this.omouseup);}}return item;};draw2d.ToggleButton.prototype.isDown=function(){return this.isDownFlag;};draw2d.ToggleButton.prototype.setActive=function(flag){draw2d.Button.prototype.setActive.call(this,flag);this.isDownFlag=flag;};draw2d.ToggleButton.prototype.execute=function(){};draw2d.ToolGeneric=function(_409f){this.x=0;this.y=0;this.enabled=true;this.tooltip=null;this.palette=_409f;this.setDimension(10,10);this.html=this.createHTMLElement();};draw2d.ToolGeneric.prototype.type="ToolGeneric";draw2d.ToolGeneric.prototype.dispose=function(){};draw2d.ToolGeneric.prototype.getImageUrl=function(){if(this.enabled){return this.type+".png";}else{return this.type+"_disabled.png";}};draw2d.ToolGeneric.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="24px";item.style.width="24px";item.style.margin="0px";item.style.padding="0px";if(this.getImageUrl()!=null){item.style.backgroundImage="url("+this.getImageUrl()+")";}else{item.style.backgroundImage="";}var oThis=this;this.click=function(event){if(oThis.enabled){oThis.palette.setActiveTool(oThis);}event.cancelBubble=true;event.returnValue=false;};if(item.addEventListener){item.addEventListener("click",this.click,false);}else{if(item.attachEvent){item.attachEvent("onclick",this.click);}}return item;};draw2d.ToolGeneric.prototype.getHTMLElement=function(){if(this.html==null){this.html=this.createHTMLElement();}return this.html;};draw2d.ToolGeneric.prototype.execute=function(x,y){if(this.enabled){this.palette.setActiveTool(null);}};draw2d.ToolGeneric.prototype.setTooltip=function(_40a5){this.tooltip=_40a5;if(this.tooltip!=null){this.html.title=this.tooltip;}else{this.html.title="";}};draw2d.ToolGeneric.prototype.setActive=function(flag){if(!this.enabled){return;}if(flag==true){this.html.style.border="2px inset";}else{this.html.style.border="0px";}};draw2d.ToolGeneric.prototype.setEnabled=function(flag){this.enabled=flag;if(this.getImageUrl()!=null){this.html.style.backgroundImage="url("+this.getImageUrl()+")";}else{this.html.style.backgroundImage="";}};draw2d.ToolGeneric.prototype.setDimension=function(w,h){this.width=w;this.height=h;if(this.html==null){return;}this.html.style.width=this.width+"px";this.html.style.height=this.height+"px";};draw2d.ToolGeneric.prototype.setPosition=function(xPos,yPos){this.x=Math.max(0,xPos);this.y=Math.max(0,yPos);if(this.html==null){return;}this.html.style.left=this.x+"px";this.html.style.top=this.y+"px";};draw2d.ToolGeneric.prototype.getWidth=function(){return this.width;};draw2d.ToolGeneric.prototype.getHeight=function(){return this.height;};draw2d.ToolGeneric.prototype.getY=function(){return this.y;};draw2d.ToolGeneric.prototype.getX=function(){return this.x;};draw2d.ToolGeneric.prototype.getPosition=function(){return new draw2d.Point(this.x,this.y);};draw2d.ToolPalette=function(title){draw2d.Window.call(this,title);this.setDimension(75,400);this.activeTool=null;this.children=new Object();};draw2d.ToolPalette.prototype=new draw2d.Window;draw2d.ToolPalette.prototype.type="ToolPalette";draw2d.ToolPalette.prototype.dispose=function(){draw2d.Window.prototype.dispose.call(this);};draw2d.ToolPalette.prototype.createHTMLElement=function(){var item=draw2d.Window.prototype.createHTMLElement.call(this);this.scrollarea=document.createElement("div");this.scrollarea.style.position="absolute";this.scrollarea.style.left="0px";if(this.hasTitleBar()){this.scrollarea.style.top="15px";}else{this.scrollarea.style.top="0px";}this.scrollarea.style.width=this.getWidth()+"px";this.scrollarea.style.height="15px";this.scrollarea.style.margin="0px";this.scrollarea.style.padding="0px";this.scrollarea.style.font="normal 10px verdana";this.scrollarea.style.borderBottom="2px solid gray";this.scrollarea.style.whiteSpace="nowrap";this.scrollarea.style.textAlign="center";this.scrollarea.style.overflowX="auto";this.scrollarea.style.overflowY="auto";this.scrollarea.style.overflow="auto";item.appendChild(this.scrollarea);return item;};draw2d.ToolPalette.prototype.setDimension=function(w,h){draw2d.Window.prototype.setDimension.call(this,w,h);if(this.scrollarea!=null){this.scrollarea.style.width=this.getWidth()+"px";if(this.hasTitleBar()){this.scrollarea.style.height=(this.getHeight()-15)+"px";}else{this.scrollarea.style.height=this.getHeight()+"px";}}};draw2d.ToolPalette.prototype.addChild=function(item){this.children[item.id]=item;this.scrollarea.appendChild(item.getHTMLElement());};draw2d.ToolPalette.prototype.getChild=function(id){return this.children[id];};draw2d.ToolPalette.prototype.getActiveTool=function(){return this.activeTool;};draw2d.ToolPalette.prototype.setActiveTool=function(tool){if(this.activeTool!=tool&&this.activeTool!=null){this.activeTool.setActive(false);}if(tool!=null){tool.setActive(true);}this.activeTool=tool;};draw2d.Dialog=function(title){this.buttonbar=null;if(title){draw2d.Window.call(this,title);}else{draw2d.Window.call(this,"Dialog");}this.setDimension(400,300);};draw2d.Dialog.prototype=new draw2d.Window;draw2d.Dialog.prototype.type="Dialog";draw2d.Dialog.prototype.createHTMLElement=function(){var item=draw2d.Window.prototype.createHTMLElement.call(this);var oThis=this;this.buttonbar=document.createElement("div");this.buttonbar.style.position="absolute";this.buttonbar.style.left="0px";this.buttonbar.style.bottom="0px";this.buttonbar.style.width=this.getWidth()+"px";this.buttonbar.style.height="30px";this.buttonbar.style.margin="0px";this.buttonbar.style.padding="0px";this.buttonbar.style.font="normal 10px verdana";this.buttonbar.style.backgroundColor="#c0c0c0";this.buttonbar.style.borderBottom="2px solid gray";this.buttonbar.style.whiteSpace="nowrap";this.buttonbar.style.textAlign="center";this.okbutton=document.createElement("button");this.okbutton.style.border="1px solid gray";this.okbutton.style.font="normal 10px verdana";this.okbutton.style.width="80px";this.okbutton.style.margin="5px";this.okbutton.innerHTML="Ok";this.okbutton.onclick=function(){oThis.onOk();};this.buttonbar.appendChild(this.okbutton);this.cancelbutton=document.createElement("button");this.cancelbutton.innerHTML="Cancel";this.cancelbutton.style.font="normal 10px verdana";this.cancelbutton.style.border="1px solid gray";this.cancelbutton.style.width="80px";this.cancelbutton.style.margin="5px";this.cancelbutton.onclick=function(){oThis.onCancel();};this.buttonbar.appendChild(this.cancelbutton);item.appendChild(this.buttonbar);return item;};draw2d.Dialog.prototype.onOk=function(){this.workflow.removeFigure(this);};draw2d.Dialog.prototype.onCancel=function(){this.workflow.removeFigure(this);};draw2d.Dialog.prototype.setDimension=function(w,h){draw2d.Window.prototype.setDimension.call(this,w,h);if(this.buttonbar!=null){this.buttonbar.style.width=this.getWidth()+"px";}};draw2d.Dialog.prototype.setWorkflow=function(_45a0){draw2d.Window.prototype.setWorkflow.call(this,_45a0);this.setFocus();};draw2d.Dialog.prototype.setFocus=function(){};draw2d.Dialog.prototype.onSetDocumentDirty=function(){};draw2d.InputDialog=function(){draw2d.Dialog.call(this);this.setDimension(400,100);};draw2d.InputDialog.prototype=new draw2d.Dialog;draw2d.InputDialog.prototype.type="InputDialog";draw2d.InputDialog.prototype.createHTMLElement=function(){var item=draw2d.Dialog.prototype.createHTMLElement.call(this);return item;};draw2d.InputDialog.prototype.onOk=function(){this.workflow.removeFigure(this);};draw2d.InputDialog.prototype.onCancel=function(){this.workflow.removeFigure(this);};draw2d.PropertyDialog=function(_4e6e,_4e6f,label){this.figure=_4e6e;this.propertyName=_4e6f;this.label=label;draw2d.Dialog.call(this);this.setDimension(400,120);};draw2d.PropertyDialog.prototype=new draw2d.Dialog;draw2d.PropertyDialog.prototype.type="PropertyDialog";draw2d.PropertyDialog.prototype.createHTMLElement=function(){var item=draw2d.Dialog.prototype.createHTMLElement.call(this);var _4e72=document.createElement("form");_4e72.style.position="absolute";_4e72.style.left="10px";_4e72.style.top="30px";_4e72.style.width="375px";_4e72.style.font="normal 10px verdana";item.appendChild(_4e72);this.labelDiv=document.createElement("div");this.labelDiv.innerHTML=this.label;this.disableTextSelection(this.labelDiv);_4e72.appendChild(this.labelDiv);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.getProperty(this.propertyName);if(value){this.input.value=value;}else{this.input.value="";}this.input.style.width="100%";_4e72.appendChild(this.input);this.input.focus();return item;};draw2d.PropertyDialog.prototype.onOk=function(){draw2d.Dialog.prototype.onOk.call(this);this.figure.setProperty(this.propertyName,this.input.value);};draw2d.AnnotationDialog=function(_406e){this.figure=_406e;draw2d.Dialog.call(this);this.setDimension(400,100);};draw2d.AnnotationDialog.prototype=new draw2d.Dialog;draw2d.AnnotationDialog.prototype.type="AnnotationDialog";draw2d.AnnotationDialog.prototype.createHTMLElement=function(){var item=draw2d.Dialog.prototype.createHTMLElement.call(this);var _4070=document.createElement("form");_4070.style.position="absolute";_4070.style.left="10px";_4070.style.top="30px";_4070.style.width="375px";_4070.style.font="normal 10px verdana";item.appendChild(_4070);this.label=document.createTextNode("Text");_4070.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%";_4070.appendChild(this.input);this.input.focus();return item;};draw2d.AnnotationDialog.prototype.onOk=function(){this.workflow.getCommandStack().execute(new draw2d.CommandSetText(this.figure,this.input.value));this.workflow.removeFigure(this);};draw2d.PropertyWindow=function(){this.currentSelection=null;draw2d.Window.call(this,"Property Window");this.setDimension(200,100);};draw2d.PropertyWindow.prototype=new draw2d.Window;draw2d.PropertyWindow.prototype.type="PropertyWindow";draw2d.PropertyWindow.prototype.dispose=function(){draw2d.Window.prototype.dispose.call(this);};draw2d.PropertyWindow.prototype.createHTMLElement=function(){var item=draw2d.Window.prototype.createHTMLElement.call(this);item.appendChild(this.createLabel("Type:",15,25));item.appendChild(this.createLabel("X :",15,50));item.appendChild(this.createLabel("Y :",15,70));item.appendChild(this.createLabel("Width :",85,50));item.appendChild(this.createLabel("Height :",85,70));this.labelType=this.createLabel("",50,25);this.labelX=this.createLabel("",40,50);this.labelY=this.createLabel("",40,70);this.labelWidth=this.createLabel("",135,50);this.labelHeight=this.createLabel("",135,70);this.labelType.style.fontWeight="normal";this.labelX.style.fontWeight="normal";this.labelY.style.fontWeight="normal";this.labelWidth.style.fontWeight="normal";this.labelHeight.style.fontWeight="normal";item.appendChild(this.labelType);item.appendChild(this.labelX);item.appendChild(this.labelY);item.appendChild(this.labelWidth);item.appendChild(this.labelHeight);return item;};draw2d.PropertyWindow.prototype.onSelectionChanged=function(_4d82){draw2d.Window.prototype.onSelectionChanged.call(this,_4d82);if(this.currentSelection!=null){this.currentSelection.detachMoveListener(this);}this.currentSelection=_4d82;if(_4d82!=null&&_4d82!=this){this.labelType.innerHTML=_4d82.type;if(_4d82.getX){this.labelX.innerHTML=_4d82.getX();this.labelY.innerHTML=_4d82.getY();this.labelWidth.innerHTML=_4d82.getWidth();this.labelHeight.innerHTML=_4d82.getHeight();this.currentSelection=_4d82;this.currentSelection.attachMoveListener(this);}else{this.labelX.innerHTML="";this.labelY.innerHTML="";this.labelWidth.innerHTML="";this.labelHeight.innerHTML="";}}else{this.labelType.innerHTML="&lt;none&gt;";this.labelX.innerHTML="";this.labelY.innerHTML="";this.labelWidth.innerHTML="";this.labelHeight.innerHTML="";}};draw2d.PropertyWindow.prototype.getCurrentSelection=function(){return this.currentSelection;};draw2d.PropertyWindow.prototype.onOtherFigureMoved=function(_4d83){if(_4d83==this.currentSelection){this.onSelectionChanged(_4d83);}};draw2d.PropertyWindow.prototype.createLabel=function(text,x,y){var l=document.createElement("div");l.style.position="absolute";l.style.left=x+"px";l.style.top=y+"px";l.style.font="normal 10px verdana";l.style.whiteSpace="nowrap";l.style.fontWeight="bold";l.innerHTML=text;return l;};draw2d.ColorDialog=function(){this.maxValue={"h":"359","s":"100","v":"100"};this.HSV={0:359,1:100,2:100};this.slideHSV={0:359,1:100,2:100};this.SVHeight=165;this.wSV=162;this.wH=162;draw2d.Dialog.call(this,"Color Chooser");this.loadSV();this.setColor(new draw2d.Color(255,0,0));this.setDimension(219,244);};draw2d.ColorDialog.prototype=new draw2d.Dialog;draw2d.ColorDialog.prototype.type="ColorDialog";draw2d.ColorDialog.prototype.createHTMLElement=function(){var oThis=this;var item=draw2d.Dialog.prototype.createHTMLElement.call(this);this.outerDiv=document.createElement("div");this.outerDiv.id="plugin";this.outerDiv.style.top="15px";this.outerDiv.style.left="0px";this.outerDiv.style.width="201px";this.outerDiv.style.position="absolute";this.outerDiv.style.padding="9px";this.outerDiv.display="block";this.outerDiv.style.background="#0d0d0d";this.plugHEX=document.createElement("div");this.plugHEX.id="plugHEX";this.plugHEX.innerHTML="F1FFCC";this.plugHEX.style.color="white";this.plugHEX.style.font="normal 10px verdana";this.outerDiv.appendChild(this.plugHEX);this.SV=document.createElement("div");this.SV.onmousedown=function(event){oThis.mouseDownSV(oThis.SVslide,event);};this.SV.id="SV";this.SV.style.cursor="crosshair";this.SV.style.background="#FF0000 url(SatVal.png)";this.SV.style.position="absolute";this.SV.style.height="166px";this.SV.style.width="167px";this.SV.style.marginRight="10px";this.SV.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='SatVal.png', sizingMethod='scale')";this.SV.style["float"]="left";this.outerDiv.appendChild(this.SV);this.SVslide=document.createElement("div");this.SVslide.onmousedown=function(event){oThis.mouseDownSV(event);};this.SVslide.style.top="40px";this.SVslide.style.left="40px";this.SVslide.style.position="absolute";this.SVslide.style.cursor="crosshair";this.SVslide.style.background="url(slide.gif)";this.SVslide.style.height="9px";this.SVslide.style.width="9px";this.SVslide.style.lineHeight="1px";this.outerDiv.appendChild(this.SVslide);this.H=document.createElement("form");this.H.id="H";this.H.onmousedown=function(event){oThis.mouseDownH(event);};this.H.style.border="1px solid #000000";this.H.style.cursor="crosshair";this.H.style.position="absolute";this.H.style.width="19px";this.H.style.top="28px";this.H.style.left="191px";this.outerDiv.appendChild(this.H);this.Hslide=document.createElement("div");this.Hslide.style.top="-7px";this.Hslide.style.left="-8px";this.Hslide.style.background="url(slideHue.gif)";this.Hslide.style.height="5px";this.Hslide.style.width="33px";this.Hslide.style.position="absolute";this.Hslide.style.lineHeight="1px";this.H.appendChild(this.Hslide);this.Hmodel=document.createElement("div");this.Hmodel.style.height="1px";this.Hmodel.style.width="19px";this.Hmodel.style.lineHeight="1px";this.Hmodel.style.margin="0px";this.Hmodel.style.padding="0px";this.Hmodel.style.fontSize="1px";this.H.appendChild(this.Hmodel);item.appendChild(this.outerDiv);return item;};draw2d.ColorDialog.prototype.onOk=function(){draw2d.Dialog.prototype.onOk.call(this);};draw2d.browser=function(v){return (Math.max(navigator.userAgent.toLowerCase().indexOf(v),0));};draw2d.ColorDialog.prototype.showColor=function(c){this.plugHEX.style.background="#"+c;this.plugHEX.innerHTML=c;};draw2d.ColorDialog.prototype.getSelectedColor=function(){var rgb=this.hex2rgb(this.plugHEX.innerHTML);return new draw2d.Color(rgb[0],rgb[1],rgb[2]);};draw2d.ColorDialog.prototype.setColor=function(color){if(color==null){color=new draw2d.Color(100,100,100);}var hex=this.rgb2hex(Array(color.getRed(),color.getGreen(),color.getBlue()));this.updateH(hex);};draw2d.ColorDialog.prototype.XY=function(e,v){var z=draw2d.browser("msie")?Array(event.clientX+document.body.scrollLeft,event.clientY+document.body.scrollTop):Array(e.pageX,e.pageY);return z[v];};draw2d.ColorDialog.prototype.mkHSV=function(a,b,c){return (Math.min(a,Math.max(0,Math.ceil((parseInt(c)/b)*a))));};draw2d.ColorDialog.prototype.ckHSV=function(a,b){if(a>=0&&a<=b){return (a);}else{if(a>b){return (b);}else{if(a<0){return ("-"+oo);}}}};draw2d.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);};draw2d.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));};draw2d.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);};draw2d.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();};draw2d.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)));};draw2d.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;};draw2d.ColorDialog.prototype.loadSV=function(){var z="";for(var i=this.SVHeight;i>=0;i--){z+="<div style=\"background:#"+this.hsv2hex(Array(Math.round((359/this.SVHeight)*i),100,100))+";\"><br/></div>";}this.Hmodel.innerHTML=z;};draw2d.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";};draw2d.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));};draw2d.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)});};draw2d.ColorDialog.prototype.rgb2hex=function(r){return (this.toHex(r[0])+this.toHex(r[1])+this.toHex(r[2]));};draw2d.ColorDialog.prototype.hsv2hex=function(h){return (this.rgb2hex(this.hsv2rgb(h)));};draw2d.ColorDialog.prototype.hex2hsv=function(v){return (this.rgb2hsv(this.hex2rgb(v)));};draw2d.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)});};draw2d.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});}};draw2d.LineColorDialog=function(_5255){draw2d.ColorDialog.call(this);this.figure=_5255;var color=_5255.getColor();this.updateH(this.rgb2hex(color.getRed(),color.getGreen(),color.getBlue()));};draw2d.LineColorDialog.prototype=new draw2d.ColorDialog;draw2d.LineColorDialog.prototype.type="LineColorDialog";draw2d.LineColorDialog.prototype.onOk=function(){var _5257=this.workflow;draw2d.ColorDialog.prototype.onOk.call(this);if(typeof this.figure.setColor=="function"){_5257.getCommandStack().execute(new draw2d.CommandSetColor(this.figure,this.getSelectedColor()));if(_5257.getCurrentSelection()==this.figure){_5257.setCurrentSelection(this.figure);}}};draw2d.BackgroundColorDialog=function(_4396){draw2d.ColorDialog.call(this);this.figure=_4396;var color=_4396.getBackgroundColor();if(color!=null){this.updateH(this.rgb2hex(color.getRed(),color.getGreen(),color.getBlue()));}};draw2d.BackgroundColorDialog.prototype=new draw2d.ColorDialog;draw2d.BackgroundColorDialog.prototype.type="BackgroundColorDialog";draw2d.BackgroundColorDialog.prototype.onOk=function(){var _4398=this.workflow;draw2d.ColorDialog.prototype.onOk.call(this);if(typeof this.figure.setBackgroundColor=="function"){_4398.getCommandStack().execute(new draw2d.CommandSetBackgroundColor(this.figure,this.getSelectedColor()));if(_4398.getCurrentSelection()==this.figure){_4398.setCurrentSelection(this.figure);}}};draw2d.AnnotationDialog=function(_406e){this.figure=_406e;draw2d.Dialog.call(this);this.setDimension(400,100);};draw2d.AnnotationDialog.prototype=new draw2d.Dialog;draw2d.AnnotationDialog.prototype.type="AnnotationDialog";draw2d.AnnotationDialog.prototype.createHTMLElement=function(){var item=draw2d.Dialog.prototype.createHTMLElement.call(this);var _4070=document.createElement("form");_4070.style.position="absolute";_4070.style.left="10px";_4070.style.top="30px";_4070.style.width="375px";_4070.style.font="normal 10px verdana";item.appendChild(_4070);this.label=document.createTextNode("Text");_4070.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%";_4070.appendChild(this.input);this.input.focus();return item;};draw2d.AnnotationDialog.prototype.onOk=function(){this.workflow.getCommandStack().execute(new draw2d.CommandSetText(this.figure,this.input.value));this.workflow.removeFigure(this);};draw2d.Command=function(label){this.label=label;};draw2d.Command.prototype.type="Command";draw2d.Command.prototype.getLabel=function(){};draw2d.Command.prototype.canExecute=function(){return true;};draw2d.Command.prototype.execute=function(){};draw2d.Command.prototype.undo=function(){};draw2d.Command.prototype.redo=function(){};draw2d.CommandStack=function(){this.undostack=new Array();this.redostack=new Array();this.maxundo=50;};draw2d.CommandStack.prototype.type="CommandStack";draw2d.CommandStack.prototype.setUndoLimit=function(count){this.maxundo=count;};draw2d.CommandStack.prototype.markSaveLocation=function(){this.undostack=new Array();this.redostack=new Array();};draw2d.CommandStack.prototype.execute=function(_42b1){if(_42b1.canExecute()==false){return;}this.undostack.push(_42b1);_42b1.execute();this.redostack=new Array();if(this.undostack.length>this.maxundo){this.undostack=this.undostack.slice(this.undostack.length-this.maxundo);}};draw2d.CommandStack.prototype.undo=function(){var _42b2=this.undostack.pop();if(_42b2){this.redostack.push(_42b2);_42b2.undo();}};draw2d.CommandStack.prototype.redo=function(){var _42b3=this.redostack.pop();if(_42b3){this.undostack.push(_42b3);_42b3.redo();}};draw2d.CommandStack.prototype.canRedo=function(){return this.redostack.length>0;};draw2d.CommandStack.prototype.canUndo=function(){return this.undostack.length>0;};draw2d.CommandAdd=function(_4db3,_4db4,x,y,_4db7){draw2d.Command.call(this,"add figure");this.parent=_4db7;this.figure=_4db4;this.x=x;this.y=y;this.workflow=_4db3;};draw2d.CommandAdd.prototype=new draw2d.Command;draw2d.CommandAdd.prototype.type="CommandAdd";draw2d.CommandAdd.prototype.execute=function(){this.redo();};draw2d.CommandAdd.prototype.redo=function(){if(this.x&&this.y){this.workflow.addFigure(this.figure,this.x,this.y);}else{this.workflow.addFigure(this.figure);}this.workflow.setCurrentSelection(this.figure);if(this.parent!=null){this.parent.addChild(this.figure);}};draw2d.CommandAdd.prototype.undo=function(){this.workflow.removeFigure(this.figure);this.workflow.setCurrentSelection(null);if(this.parent!=null){this.parent.removeChild(this.figure);}};draw2d.CommandDelete=function(_42bb){draw2d.Command.call(this,"delete figure");this.parent=_42bb.parent;this.figure=_42bb;this.workflow=_42bb.workflow;this.connections=null;};draw2d.CommandDelete.prototype=new draw2d.Command;draw2d.CommandDelete.prototype.type="CommandDelete";draw2d.CommandDelete.prototype.execute=function(){this.redo();};draw2d.CommandDelete.prototype.undo=function(){this.workflow.addFigure(this.figure);if(this.figure instanceof draw2d.Connection){this.figure.reconnect();}this.workflow.setCurrentSelection(this.figure);if(this.parent!=null){this.parent.addChild(this.figure);}for(var i=0;i<this.connections.length;++i){this.workflow.addFigure(this.connections[i]);this.connections[i].reconnect();}};draw2d.CommandDelete.prototype.redo=function(){this.workflow.removeFigure(this.figure);this.workflow.setCurrentSelection(null);if(this.figure.getPorts&&this.connections==null){this.connections=new Array();var ports=this.figure.getPorts();for(var i=0;i<ports.length;i++){if(ports[i].getConnections){this.connections=this.connections.concat(ports[i].getConnections());}}}if(this.connections==null){this.connections=new Array();}if(this.parent!=null){this.parent.removeChild(this.figure);}for(var i=0;i<this.connections.length;++i){this.workflow.removeFigure(this.connections[i]);}};draw2d.CommandMove=function(_4e7b,x,y){draw2d.Command.call(this,"move figure");this.figure=_4e7b;this.oldX=x;this.oldY=y;this.oldCompartment=_4e7b.getParent();};draw2d.CommandMove.prototype=new draw2d.Command;draw2d.CommandMove.prototype.type="CommandMove";draw2d.CommandMove.prototype.setPosition=function(x,y){this.newX=x;this.newY=y;this.newCompartment=this.figure.workflow.getBestCompartmentFigure(x,y,this.figure);};draw2d.CommandMove.prototype.canExecute=function(){return this.newX!=this.oldX||this.newY!=this.oldY;};draw2d.CommandMove.prototype.execute=function(){this.redo();};draw2d.CommandMove.prototype.undo=function(){this.figure.setPosition(this.oldX,this.oldY);if(this.newCompartment!=null){this.newCompartment.removeChild(this.figure);}if(this.oldCompartment!=null){this.oldCompartment.addChild(this.figure);}this.figure.workflow.moveResizeHandles(this.figure);};draw2d.CommandMove.prototype.redo=function(){this.figure.setPosition(this.newX,this.newY);if(this.oldCompartment!=null){this.oldCompartment.removeChild(this.figure);}if(this.newCompartment!=null){this.newCompartment.addChild(this.figure);}this.figure.workflow.moveResizeHandles(this.figure);};draw2d.CommandResize=function(_429f,width,_42a1){draw2d.Command.call(this,"resize figure");this.figure=_429f;this.oldWidth=width;this.oldHeight=_42a1;};draw2d.CommandResize.prototype=new draw2d.Command;draw2d.CommandResize.prototype.type="CommandResize";draw2d.CommandResize.prototype.setDimension=function(width,_42a3){this.newWidth=width;this.newHeight=_42a3;};draw2d.CommandResize.prototype.canExecute=function(){return this.newWidth!=this.oldWidth||this.newHeight!=this.oldHeight;};draw2d.CommandResize.prototype.execute=function(){this.redo();};draw2d.CommandResize.prototype.undo=function(){this.figure.setDimension(this.oldWidth,this.oldHeight);this.figure.workflow.moveResizeHandles(this.figure);};draw2d.CommandResize.prototype.redo=function(){this.figure.setDimension(this.newWidth,this.newHeight);this.figure.workflow.moveResizeHandles(this.figure);};draw2d.CommandSetText=function(text){draw2d.Command.call(this,"set text");this.figure=figure;this.newText=text;this.oldText=figure.getText();};draw2d.CommandSetText.prototype=new draw2d.Command;draw2d.CommandSetText.prototype.type="CommandSetText";draw2d.CommandSetText.prototype.execute=function(){this.redo();};draw2d.CommandSetText.prototype.redo=function(){this.figure.setText(this.newText);};draw2d.CommandSetText.prototype.undo=function(){this.figure.setText(this.oldText);};draw2d.CommandSetColor=function(_4251,color){draw2d.Command.call(this,"set color");this.figure=_4251;this.newColor=color;this.oldColor=_4251.getColor();};draw2d.CommandSetColor.prototype=new draw2d.Command;draw2d.CommandSetColor.prototype.type="CommandSetColor";draw2d.CommandSetColor.prototype.execute=function(){this.redo();};draw2d.CommandSetColor.prototype.undo=function(){this.figure.setColor(this.oldColor);};draw2d.CommandSetColor.prototype.redo=function(){this.figure.setColor(this.newColor);};draw2d.CommandSetBackgroundColor=function(_5261,color){draw2d.Command.call(this,"set background color");this.figure=_5261;this.newColor=color;this.oldColor=_5261.getBackgroundColor();};draw2d.CommandSetBackgroundColor.prototype=new draw2d.Command;draw2d.CommandSetBackgroundColor.prototype.type="CommandSetBackgroundColor";draw2d.CommandSetBackgroundColor.prototype.execute=function(){this.redo();};draw2d.CommandSetBackgroundColor.prototype.undo=function(){this.figure.setBackgroundColor(this.oldColor);};draw2d.CommandSetBackgroundColor.prototype.redo=function(){this.figure.setBackgroundColor(this.newColor);};draw2d.CommandConnect=function(_44a9,_44aa,_44ab){draw2d.Command.call(this,"create connection");this.workflow=_44a9;this.source=_44aa;this.target=_44ab;this.connection=null;};draw2d.CommandConnect.prototype=new draw2d.Command;draw2d.CommandConnect.prototype.type="CommandConnect";draw2d.CommandConnect.prototype.setConnection=function(_44ac){this.connection=_44ac;};draw2d.CommandConnect.prototype.execute=function(){if(this.connection==null){this.connection=new draw2d.Connection();}this.connection.setSource(this.source);this.connection.setTarget(this.target);this.workflow.addFigure(this.connection);};draw2d.CommandConnect.prototype.redo=function(){this.workflow.addFigure(this.connection);this.connection.reconnect();};draw2d.CommandConnect.prototype.undo=function(){this.workflow.removeFigure(this.connection);};draw2d.CommandMoveLine=function(line,_5264,_5265,endX,endY){draw2d.Command.call(this,"move line");this.line=line;this.startX1=_5264;this.startY1=_5265;this.endX1=endX;this.endY1=endY;};draw2d.CommandMoveLine.prototype=new draw2d.Command;draw2d.CommandMoveLine.prototype.type="CommandMoveLine";draw2d.CommandMoveLine.prototype.canExecute=function(){return this.startX1!=this.startX2||this.startY1!=this.startY2||this.endX1!=this.endX2||this.endY1!=this.endY2;};draw2d.CommandMoveLine.prototype.setEndPoints=function(_5268,_5269,endX,endY){this.startX2=_5268;this.startY2=_5269;this.endX2=endX;this.endY2=endY;};draw2d.CommandMoveLine.prototype.execute=function(){this.redo();};draw2d.CommandMoveLine.prototype.undo=function(){this.line.setStartPoint(this.startX1,this.startY1);this.line.setEndPoint(this.endX1,this.endY1);if(this.line.workflow.getCurrentSelection()==this.line){this.line.workflow.showLineResizeHandles(this.line);}};draw2d.CommandMoveLine.prototype.redo=function(){this.line.setStartPoint(this.startX2,this.startY2);this.line.setEndPoint(this.endX2,this.endY2);if(this.line.workflow.getCurrentSelection()==this.line){this.line.workflow.showLineResizeHandles(this.line);}};draw2d.Menu=function(){this.menuItems=new Array();draw2d.Figure.call(this);this.setSelectable(false);this.setDeleteable(false);this.setCanDrag(false);this.setResizeable(false);this.setSelectable(false);this.setZOrder(10000);this.dirty=false;};draw2d.Menu.prototype=new draw2d.Figure;draw2d.Menu.prototype.type="Menu";draw2d.Menu.prototype.createHTMLElement=function(){var item=document.createElement("div");item.style.position="absolute";item.style.left=this.x+"px";item.style.top=this.y+"px";item.style.margin="0px";item.style.padding="0px";item.style.zIndex=""+draw2d.Figure.ZOrderBaseIndex;item.style.border="1px solid gray";item.style.background="lavender";item.style.cursor="pointer";return item;};draw2d.Menu.prototype.setWorkflow=function(_40b7){this.workflow=_40b7;};draw2d.Menu.prototype.appendMenuItem=function(item){this.menuItems.push(item);item.parentMenu=this;this.dirty=true;};draw2d.Menu.prototype.getHTMLElement=function(){var html=draw2d.Figure.prototype.getHTMLElement.call(this);if(this.dirty){this.createList();}return html;};draw2d.Menu.prototype.createList=function(){this.dirty=false;this.html.innerHTML="";var oThis=this;for(var i=0;i<this.menuItems.length;i++){var item=this.menuItems[i];var li=document.createElement("a");li.innerHTML=item.getLabel();li.style.display="block";li.style.fontFamily="Verdana, Arial, Helvetica, sans-serif";li.style.fontSize="9pt";li.style.color="dimgray";li.style.borderBottom="1px solid silver";li.style.paddingLeft="5px";li.style.paddingRight="5px";li.style.cursor="pointer";this.html.appendChild(li);li.menuItem=item;if(li.addEventListener){li.addEventListener("click",function(event){var _40bf=arguments[0]||window.event;_40bf.cancelBubble=true;_40bf.returnValue=false;var diffX=_40bf.clientX;var diffY=_40bf.clientY;var _40c2=document.body.parentNode.scrollLeft;var _40c3=document.body.parentNode.scrollTop;this.menuItem.execute(diffX+_40c2,diffY+_40c3);},false);li.addEventListener("mouseup",function(event){event.cancelBubble=true;event.returnValue=false;},false);li.addEventListener("mousedown",function(event){event.cancelBubble=true;event.returnValue=false;},false);li.addEventListener("mouseover",function(event){this.style.backgroundColor="silver";},false);li.addEventListener("mouseout",function(event){this.style.backgroundColor="transparent";},false);}else{if(li.attachEvent){li.attachEvent("onclick",function(event){var _40c9=arguments[0]||window.event;_40c9.cancelBubble=true;_40c9.returnValue=false;var diffX=_40c9.clientX;var diffY=_40c9.clientY;var _40cc=document.body.parentNode.scrollLeft;var _40cd=document.body.parentNode.scrollTop;event.srcElement.menuItem.execute(diffX+_40cc,diffY+_40cd);});li.attachEvent("onmousedown",function(event){event.cancelBubble=true;event.returnValue=false;});li.attachEvent("onmouseup",function(event){event.cancelBubble=true;event.returnValue=false;});li.attachEvent("onmouseover",function(event){event.srcElement.style.backgroundColor="silver";});li.attachEvent("onmouseout",function(event){event.srcElement.style.backgroundColor="transparent";});}}}};draw2d.MenuItem=function(label,_4159,_415a){this.label=label;this.iconUrl=_4159;this.parentMenu=null;this.action=_415a;};draw2d.MenuItem.prototype.type="MenuItem";draw2d.MenuItem.prototype.isEnabled=function(){return true;};draw2d.MenuItem.prototype.getLabel=function(){return this.label;};draw2d.MenuItem.prototype.execute=function(x,y){this.parentMenu.workflow.showMenu(null);this.action(x,y);};draw2d.Locator=function(){};draw2d.Locator.prototype.type="Locator";draw2d.Locator.prototype.relocate=function(_5258){};draw2d.ConnectionLocator=function(_47b6){draw2d.Locator.call(this);this.connection=_47b6;};draw2d.ConnectionLocator.prototype=new draw2d.Locator;draw2d.ConnectionLocator.prototype.type="ConnectionLocator";draw2d.ConnectionLocator.prototype.getConnection=function(){return this.connection;};draw2d.ManhattenMidpointLocator=function(_3df8){draw2d.ConnectionLocator.call(this,_3df8);};draw2d.ManhattenMidpointLocator.prototype=new draw2d.ConnectionLocator;draw2d.ManhattenMidpointLocator.prototype.type="ManhattenMidpointLocator";draw2d.ManhattenMidpointLocator.prototype.relocate=function(_3df9){var conn=this.getConnection();var p=new draw2d.Point();var _3dfc=conn.getPoints();var index=Math.floor((_3dfc.getSize()-2)/2);var p1=_3dfc.get(index);var p2=_3dfc.get(index+1);p.x=(p2.x-p1.x)/2+p1.x+5;p.y=(p2.y-p1.y)/2+p1.y+5;_3df9.setPosition(p.x,p.y);};
