
/**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,_50fe){this.type=sType;this.cancelable=_50fe;this.timeStamp=(new Date()).getTime();};draw2d.Event.prototype.preventDefault=function(){if(this.cancelable){this.returnValue=false;}};draw2d.Event.fireDOMEvent=function(_50ff,_5100){if(document.createEvent){var evt=document.createEvent("Events");evt.initEvent(_50ff,true,true);_5100.dispatchEvent(evt);}else{if(document.createEventObject){var evt=document.createEventObject();_5100.fireEvent("on"+_50ff,evt);}}};draw2d.EventTarget=function(){this.eventhandlers=new Object();};draw2d.EventTarget.prototype.addEventListener=function(sType,_5103){if(typeof this.eventhandlers[sType]=="undefined"){this.eventhandlers[sType]=new Array;}this.eventhandlers[sType][this.eventhandlers[sType].length]=_5103;};draw2d.EventTarget.prototype.dispatchEvent=function(_5104){_5104.target=this;if(typeof this.eventhandlers[_5104.type]!="undefined"){for(var i=0;i<this.eventhandlers[_5104.type].length;i++){this.eventhandlers[_5104.type][i](_5104);}}return _5104.returnValue;};draw2d.EventTarget.prototype.removeEventListener=function(sType,_5107){if(typeof this.eventhandlers[sType]!="undefined"){var _5108=new Array;for(var i=0;i<this.eventhandlers[sType].length;i++){if(this.eventhandlers[sType][i]!=_5107){_5108[_5108.length]=this.eventhandlers[sType][i];}}this.eventhandlers[sType]=_5108;}};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 _4c99=new Array(this.size);for(var i=0;i<this.size;i++){_4c99[i]=this.data[this.size-i-1];}this.data=_4c99;};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 _4ca3=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 _4ca3;};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 _4caf;var _4cb0;var _4cb1;var _4cb2;for(i=1;i<this.getSize();i++){_4cb0=this.data[i];_4caf=_4cb0[f];j=i-1;_4cb1=this.data[j];_4cb2=_4cb1[f];while(j>=0&&_4cb2>_4caf){this.data[j+1]=this.data[j];j--;if(j>=0){_4cb1=this.data[j];_4cb2=_4cb1[f];}}this.data[j+1]=_4cb0;}};draw2d.ArrayList.prototype.clone=function(){var _4cb3=new draw2d.ArrayList(this.size);for(var i=0;i<this.size;i++){_4cb3.add(this.data[i]);}return _4cb3;};draw2d.ArrayList.prototype.overwriteElementAt=function(obj,index){this.data[index]=obj;};function trace(_4f51){var _4f52=openwindow("about:blank",700,400);_4f52.document.writeln("<pre>"+_4f51+"</pre>");}function openwindow(url,width,_4f55){var left=(screen.width-width)/2;var top=(screen.height-_4f55)/2;property="left="+left+", top="+top+", toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,alwaysRaised,width="+width+",height="+_4f55;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(_3fb7){this.current=_3fb7;this.dragging=true;};draw2d.Drag.getCurrent=function(){return this.current;};draw2d.Drag.clearCurrent=function(){this.current=null;this.dragging=false;};draw2d.Draggable=function(_3fb8,_3fb9){draw2d.EventTarget.call(this);this.construct(_3fb8,_3fb9);this.diffX=0;this.diffY=0;this.targets=new draw2d.ArrayList();};draw2d.Draggable.prototype=new draw2d.EventTarget;draw2d.Draggable.prototype.addDropTarget=function(_3fba){this.targets.add(_3fba);};draw2d.Draggable.prototype.construct=function(_3fbb,_3fbc){this.element=_3fbb;this.constraints=_3fbc;var oThis=this;var _3fbe=function(){var _3fbf=new draw2d.DragDropEvent();_3fbf.initDragDropEvent("dblclick",true);oThis.dispatchEvent(_3fbf);var _3fc0=arguments[0]||window.event;_3fc0.cancelBubble=true;_3fc0.returnValue=false;};var _3fc1=function(){var _3fc2=arguments[0]||window.event;var _3fc3=new draw2d.DragDropEvent();var _3fc4=oThis.node.workflow.getAbsoluteX();var _3fc5=oThis.node.workflow.getAbsoluteY();var _3fc6=oThis.node.workflow.getScrollLeft();var _3fc7=oThis.node.workflow.getScrollTop();_3fc3.x=_3fc2.clientX-oThis.element.offsetLeft+_3fc6-_3fc4;_3fc3.y=_3fc2.clientY-oThis.element.offsetTop+_3fc7-_3fc5;if(_3fc2.button==2){_3fc3.initDragDropEvent("contextmenu",true);oThis.dispatchEvent(_3fc3);}else{_3fc3.initDragDropEvent("dragstart",true);if(oThis.dispatchEvent(_3fc3)){oThis.diffX=_3fc2.clientX-oThis.element.offsetLeft;oThis.diffY=_3fc2.clientY-oThis.element.offsetTop;draw2d.Drag.setCurrent(oThis);if(oThis.isAttached==true){oThis.detachEventHandlers();}oThis.attachEventHandlers();}}_3fc2.cancelBubble=true;_3fc2.returnValue=false;};var _3fc8=function(){if(draw2d.Drag.getCurrent()==null){var _3fc9=arguments[0]||window.event;if(draw2d.Drag.currentHover!=null&&oThis!=draw2d.Drag.currentHover){var _3fca=new draw2d.DragDropEvent();_3fca.initDragDropEvent("mouseleave",false,oThis);draw2d.Drag.currentHover.dispatchEvent(_3fca);}if(oThis!=null&&oThis!=draw2d.Drag.currentHover){var _3fca=new draw2d.DragDropEvent();_3fca.initDragDropEvent("mouseenter",false,oThis);oThis.dispatchEvent(_3fca);}draw2d.Drag.currentHover=oThis;}else{}};if(this.element.addEventListener){this.element.addEventListener("mousemove",_3fc8,false);this.element.addEventListener("mousedown",_3fc1,false);this.element.addEventListener("dblclick",_3fbe,false);}else{if(this.element.attachEvent){this.element.attachEvent("onmousemove",_3fc8);this.element.attachEvent("onmousedown",_3fc1);this.element.attachEvent("ondblclick",_3fbe);}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 _3fcc=arguments[0]||window.event;var _3fcd=new draw2d.Point(_3fcc.clientX-oThis.diffX,_3fcc.clientY-oThis.diffY);if(oThis.node.getCanSnapToHelper()){_3fcd=oThis.node.getWorkflow().snapToHelper(oThis.node,_3fcd);}oThis.element.style.left=_3fcd.x+"px";oThis.element.style.top=_3fcd.y+"px";var _3fce=oThis.node.workflow.getScrollLeft();var _3fcf=oThis.node.workflow.getScrollTop();var _3fd0=oThis.node.workflow.getAbsoluteX();var _3fd1=oThis.node.workflow.getAbsoluteY();var _3fd2=oThis.getDropTarget(_3fcc.clientX+_3fce-_3fd0,_3fcc.clientY+_3fcf-_3fd1);var _3fd3=oThis.getCompartment(_3fcc.clientX+_3fce-_3fd0,_3fcc.clientY+_3fcf-_3fd1);if(draw2d.Drag.currentTarget!=null&&_3fd2!=draw2d.Drag.currentTarget){var _3fd4=new draw2d.DragDropEvent();_3fd4.initDragDropEvent("dragleave",false,oThis);draw2d.Drag.currentTarget.dispatchEvent(_3fd4);}if(_3fd2!=null&&_3fd2!=draw2d.Drag.currentTarget){var _3fd4=new draw2d.DragDropEvent();_3fd4.initDragDropEvent("dragenter",false,oThis);_3fd2.dispatchEvent(_3fd4);}draw2d.Drag.currentTarget=_3fd2;if(draw2d.Drag.currentCompartment!=null&&_3fd3!=draw2d.Drag.currentCompartment){var _3fd4=new draw2d.DragDropEvent();_3fd4.initDragDropEvent("figureleave",false,oThis);draw2d.Drag.currentCompartment.dispatchEvent(_3fd4);}if(_3fd3!=null&&_3fd3.node!=oThis.node&&_3fd3!=draw2d.Drag.currentCompartment){var _3fd4=new draw2d.DragDropEvent();_3fd4.initDragDropEvent("figureenter",false,oThis);_3fd3.dispatchEvent(_3fd4);}draw2d.Drag.currentCompartment=_3fd3;var _3fd5=new draw2d.DragDropEvent();_3fd5.initDragDropEvent("drag",false);oThis.dispatchEvent(_3fd5);};oThis.tempMouseUp=function(){oThis.detachEventHandlers();var _3fd6=arguments[0]||window.event;var _3fd7=new draw2d.DragDropEvent();_3fd7.initDragDropEvent("dragend",false);oThis.dispatchEvent(_3fd7);var _3fd8=oThis.node.workflow.getScrollLeft();var _3fd9=oThis.node.workflow.getScrollTop();var _3fda=oThis.node.workflow.getAbsoluteX();var _3fdb=oThis.node.workflow.getAbsoluteY();var _3fdc=oThis.getDropTarget(_3fd6.clientX+_3fd8-_3fda,_3fd6.clientY+_3fd9-_3fdb);var _3fdd=oThis.getCompartment(_3fd6.clientX+_3fd8-_3fda,_3fd6.clientY+_3fd9-_3fdb);if(_3fdc!=null){var _3fde=new draw2d.DragDropEvent();_3fde.initDragDropEvent("drop",false,oThis);_3fdc.dispatchEvent(_3fde);}if(_3fdd!=null&&_3fdd.node!=oThis.node){var _3fde=new draw2d.DragDropEvent();_3fde.initDragDropEvent("figuredrop",false,oThis);_3fdd.dispatchEvent(_3fde);}if(draw2d.Drag.currentTarget!=null){var _3fde=new draw2d.DragDropEvent();_3fde.initDragDropEvent("dragleave",false,oThis);draw2d.Drag.currentTarget.dispatchEvent(_3fde);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 _3fe2=this.targets.get(i);if(_3fe2.node.isOver(x,y)&&_3fe2.node!=this.node){return _3fe2;}}return null;};draw2d.Draggable.prototype.getCompartment=function(x,y){var _3fe5=null;for(var i=0;i<this.node.workflow.compartments.getSize();i++){var _3fe7=this.node.workflow.compartments.get(i);if(_3fe7.isOver(x,y)&&_3fe7!=this.node){if(_3fe5==null){_3fe5=_3fe7;}else{if(_3fe5.getZOrder()<_3fe7.getZOrder()){_3fe5=_3fe7;}}}}return _3fe5==null?null:_3fe5.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,_3fe9,_3fea){this.initEvent(sType,_3fe9);this.relatedTarget=_3fea;};draw2d.DropTarget=function(_3feb){draw2d.EventTarget.call(this);this.construct(_3feb);};draw2d.DropTarget.prototype=new draw2d.EventTarget;draw2d.DropTarget.prototype.construct=function(_3fec){this.element=_3fec;};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 _419e=105;var _419f=(this.red*0.299)+(this.green*0.587)+(this.blue*0.114);return (255-_419f<_419e)?new draw2d.Color(0,0,0):new draw2d.Color(255,255,255);};draw2d.Color.prototype.hex2rgb=function(_41a0){_41a0=_41a0.replace("#","");return ({0:parseInt(_41a0.substr(0,2),16),1:parseInt(_41a0.substr(2,2),16),2:parseInt(_41a0.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.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.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(_434f){this.workflow=_434f;};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(_4350,_4351,_4352){return _4351;};draw2d.SnapToHelper.prototype.snapRectangle=function(_4353,_4354){return _4353;};draw2d.SnapToHelper.prototype.onSetDocumentDirty=function(){};draw2d.SnapToGrid=function(_43c8){draw2d.SnapToHelper.call(this,_43c8);};draw2d.SnapToGrid.prototype=new draw2d.SnapToHelper;draw2d.SnapToGrid.prototype.snapPoint=function(_43c9,_43ca,_43cb){_43cb.x=this.workflow.gridWidthX*Math.floor(((_43ca.x+this.workflow.gridWidthX/2)/this.workflow.gridWidthX));_43cb.y=this.workflow.gridWidthY*Math.floor(((_43ca.y+this.workflow.gridWidthY/2)/this.workflow.gridWidthY));return 0;};draw2d.SnapToGrid.prototype.snapRectangle=function(_43cc,_43cd){_43cd.x=_43cc.x;_43cd.y=_43cc.y;_43cd.w=_43cc.w;_43cd.h=_43cc.h;return 0;};draw2d.SnapToGeometryEntry=function(type,_4cd5){this.type=type;this.location=_4cd5;};draw2d.SnapToGeometryEntry.prototype.getLocation=function(){return this.location;};draw2d.SnapToGeometryEntry.prototype.getType=function(){return this.type;};draw2d.SnapToGeometry=function(_415b){draw2d.SnapToHelper.call(this,_415b);};draw2d.SnapToGeometry.prototype=new draw2d.SnapToHelper;draw2d.SnapToGeometry.THRESHOLD=5;draw2d.SnapToGeometry.prototype.snapPoint=function(_415c,_415d,_415e){if(this.rows==null||this.cols==null){this.populateRowsAndCols();}if((_415c&draw2d.SnapToHelper.EAST)!=0){var _415f=this.getCorrectionFor(this.cols,_415d.getX()-1,1);if(_415f!=draw2d.SnapToGeometry.THRESHOLD){_415c&=~draw2d.SnapToHelper.EAST;_415e.x+=_415f;}}if((_415c&draw2d.SnapToHelper.WEST)!=0){var _4160=this.getCorrectionFor(this.cols,_415d.getX(),-1);if(_4160!=draw2d.SnapToGeometry.THRESHOLD){_415c&=~draw2d.SnapToHelper.WEST;_415e.x+=_4160;}}if((_415c&draw2d.SnapToHelper.SOUTH)!=0){var _4161=this.getCorrectionFor(this.rows,_415d.getY()-1,1);if(_4161!=draw2d.SnapToGeometry.THRESHOLD){_415c&=~draw2d.SnapToHelper.SOUTH;_415e.y+=_4161;}}if((_415c&draw2d.SnapToHelper.NORTH)!=0){var _4162=this.getCorrectionFor(this.rows,_415d.getY(),-1);if(_4162!=draw2d.SnapToGeometry.THRESHOLD){_415c&=~draw2d.SnapToHelper.NORTH;_415e.y+=_4162;}}return _415c;};draw2d.SnapToGeometry.prototype.snapRectangle=function(_4163,_4164){var _4165=_4163.getTopLeft();var _4166=_4163.getBottomRight();var _4167=this.snapPoint(draw2d.SnapToHelper.NORTH_WEST,_4163.getTopLeft(),_4165);_4164.x=_4165.x;_4164.y=_4165.y;var _4168=this.snapPoint(draw2d.SnapToHelper.SOUTH_EAST,_4163.getBottomRight(),_4166);if(_4167&draw2d.SnapToHelper.WEST){_4164.x=_4166.x-_4163.getWidth();}if(_4167&draw2d.SnapToHelper.NORTH){_4164.y=_4166.y-_4163.getHeight();}return _4167|_4168;};draw2d.SnapToGeometry.prototype.populateRowsAndCols=function(){this.rows=new Array();this.cols=new Array();var _4169=this.workflow.getDocument().getFigures();var index=0;for(var i=0;i<_4169.length;i++){var _416c=_4169[i];if(_416c!=this.workflow.getCurrentSelection()){var _416d=_416c.getBounds();this.cols[index*3]=new draw2d.SnapToGeometryEntry(-1,_416d.getX());this.rows[index*3]=new draw2d.SnapToGeometryEntry(-1,_416d.getY());this.cols[index*3+1]=new draw2d.SnapToGeometryEntry(0,_416d.x+(_416d.getWidth()-1)/2);this.rows[index*3+1]=new draw2d.SnapToGeometryEntry(0,_416d.y+(_416d.getHeight()-1)/2);this.cols[index*3+2]=new draw2d.SnapToGeometryEntry(1,_416d.getRight()-1);this.rows[index*3+2]=new draw2d.SnapToGeometryEntry(1,_416d.getBottom()-1);index++;}}};draw2d.SnapToGeometry.prototype.getCorrectionFor=function(_416e,value,side){var _4171=draw2d.SnapToGeometry.THRESHOLD;var _4172=draw2d.SnapToGeometry.THRESHOLD;for(var i=0;i<_416e.length;i++){var entry=_416e[i];var _4175;if(entry.type==-1&&side!=0){_4175=Math.abs(value-entry.location);if(_4175<_4171){_4171=_4175;_4172=entry.location-value;}}else{if(entry.type==0&&side==0){_4175=Math.abs(value-entry.location);if(_4175<_4171){_4171=_4175;_4172=entry.location-value;}}else{if(entry.type==1&&side!=0){_4175=Math.abs(value-entry.location);if(_4175<_4171){_4171=_4175;_4172=entry.location-value;}}}}}return _4172;};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(_4c63){this.canvas=_4c63;};draw2d.Figure.prototype.getWorkflow=function(){return this.workflow;};draw2d.Figure.prototype.setWorkflow=function(_4c64){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(_4c67){oThis.onContextMenu(oThis.x+_4c67.x,_4c67.y+oThis.y);};this.tmpMouseEnter=function(_4c68){oThis.onMouseEnter();};this.tmpMouseLeave=function(_4c69){oThis.onMouseLeave();};this.tmpDragend=function(_4c6a){oThis.onDragend();};this.tmpDragstart=function(_4c6b){var w=oThis.workflow;w.showMenu(null);if(oThis.workflow.toolPalette&&oThis.workflow.toolPalette.activeTool){_4c6b.returnValue=false;oThis.workflow.onMouseDown(oThis.x+_4c6b.x,_4c6b.y+oThis.y);oThis.workflow.onMouseUp(oThis.x+_4c6b.x,_4c6b.y+oThis.y);return;}_4c6b.returnValue=oThis.onDragstart(_4c6b.x,_4c6b.y);};this.tmpDrag=function(_4c6d){oThis.onDrag();};this.tmpDoubleClick=function(_4c6e){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=_4c64;};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(_4c70){this.parent=_4c70;};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(_4c72){if(this.border!=null){this.border.figure=null;}this.border=_4c72;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 _4c76=this;var _4c77=function(){if(_4c76.alpha<1){_4c76.setAlpha(Math.min(1,_4c76.alpha+0.05));}else{window.clearInterval(_4c76.timer);_4c76.timer=-1;}};if(_4c76.timer>0){window.clearInterval(_4c76.timer);}_4c76.timer=window.setInterval(_4c77,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(_4c7b){if(this.alpha==_4c7b){return;}try{this.html.style.MozOpacity=_4c7b;}catch(exc){}try{this.html.style.opacity=_4c7b;}catch(exc){}try{var _4c7c=Math.round(_4c7b*100);if(_4c7c>=99){this.html.style.filter="";}else{this.html.style.filter="alpha(opacity="+_4c7c+")";}}catch(exc){}this.alpha=_4c7b;};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(_4c86,ctrl){if(_4c86==46&&this.isDeleteable()==true){this.workflow.commandStack.execute(new draw2d.CommandDelete(this));}if(ctrl){this.workflow.onKeyDown(_4c86,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(_4c8e){if(_4c8e==null||this.moveListener==null){return;}this.moveListener[_4c8e.id]=_4c8e;};draw2d.Figure.prototype.detachMoveListener=function(_4c8f){if(_4c8f==null||this.moveListener==null){return;}this.moveListener[_4c8f.id]=null;};draw2d.Figure.prototype.fireMoveEvent=function(){this.setDocumentDirty();for(key in this.moveListener){var _4c90=this.moveListener[key];if(_4c90!=null){_4c90.onOtherFigureMoved(this);}}};draw2d.Figure.prototype.onOtherFigureMoved=function(_4c91){};draw2d.Figure.prototype.setDocumentDirty=function(){if(this.workflow!=null){this.workflow.setDocumentDirty();}};draw2d.Figure.prototype.generateUId=function(){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var _4c93=10;var _4c94=10;nbTry=0;while(nbTry<1000){var id="";for(var i=0;i<_4c93;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 _3ccd=new Array();for(var i=0;i<this.ports.getSize();i++){_3ccd.push(this.ports.get(i));}return _3ccd;};draw2d.Node.prototype.getPort=function(_3ccf){if(this.ports==null){return null;}for(var i=0;i<this.ports.getSize();i++){var port=this.ports.get(i);if(port.getName()==_3ccf){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(_3cd6){var _3cd7=this.workflow;draw2d.Figure.prototype.setWorkflow.call(this,_3cd6);if(_3cd7!=null){for(var i=0;i<this.ports.getSize();i++){_3cd7.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.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(_4f5d){draw2d.Node.prototype.setWorkflow.call(this,_4f5d);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(_4927){draw2d.Oval.call(this);if(_4927){this.setDimension(_4927,_4927);}};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,_4cf1){this.bgColor=null;this.lineColor=new draw2d.Color(0,0,0);this.lineStroke=1;draw2d.Figure.call(this);if(width&&_4cf1){this.setDimension(width,_4cf1);}};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(_438e,_438f){Corona=function(){};Corona.prototype=new draw2d.Circle;Corona.prototype.setAlpha=function(_4390){draw2d.Circle.prototype.setAlpha.call(this,Math.min(0.3,_4390));};if(_438e==null){this.currentUIRepresentation=new draw2d.Circle();}else{this.currentUIRepresentation=_438e;}if(_438f==null){this.connectedUIRepresentation=new draw2d.Circle();this.connectedUIRepresentation.setColor(null);}else{this.connectedUIRepresentation=_438f;}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(_4391){_4391.target.node.onDragEnter(_4391.relatedTarget.node);});this.dropable.addEventListener("dragleave",function(_4392){_4392.target.node.onDragLeave(_4392.relatedTarget.node);});this.dropable.addEventListener("drop",function(_4393){_4393.relatedTarget.node.onDrop(_4393.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 _4396=this.moveListener[key];if(_4396!=null){this.parentNode.workflow.removeFigure(_4396);_4396.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(_4398){if(_4398==null){_4398=new draw2d.Figure();}if(this.uiRepresentationAdded){this.html.removeChild(this.currentUIRepresentation.getHTMLElement());}this.html.appendChild(_4398.getHTMLElement());_4398.paint();this.currentUIRepresentation=_4398;};draw2d.Port.prototype.onMouseEnter=function(){this.setLineWidth(2);};draw2d.Port.prototype.onMouseLeave=function(){this.setLineWidth(0);};draw2d.Port.prototype.setDimension=function(width,_439a){draw2d.Rectangle.prototype.setDimension.call(this,width,_439a);this.connectedUIRepresentation.setDimension(width,_439a);this.disconnectedUIRepresentation.setDimension(width,_439a);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 _439c=new Array();for(key in this.moveListener){var _439d=this.moveListener[key];if(_439d instanceof draw2d.Connection){_439c.push(_439d);}}return _439c;};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(_43a2){if(this.parentNode!=null){this.parentNode.detachMoveListener(this);}this.parentNode=_43a2;if(this.parentNode!=null){this.parentNode.attachMoveListener(this);}};draw2d.Port.prototype.attachMoveListener=function(_43a3){draw2d.Rectangle.prototype.attachMoveListener.call(this,_43a3);if(this.hideIfConnected==true){this.setUiRepresentation(this.connectedUIRepresentation);}};draw2d.Port.prototype.detachMoveListener=function(_43a4){draw2d.Rectangle.prototype.detachMoveListener.call(this,_43a4);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 _43ab=new draw2d.CommandConnect(this.parentNode.workflow,port,this);this.parentNode.workflow.getCommandStack().execute(_43ab);}};draw2d.Port.prototype.getAbsolutePosition=function(){return new draw2d.Point(this.getAbsoluteX(),this.getAbsoluteY());};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(_43ac){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,_43b5){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(_4467){draw2d.Port.call(this,_4467);};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 _4469=new draw2d.CommandConnect(this.parentNode.workflow,port,this);this.parentNode.workflow.getCommandStack().execute(_4469);}}};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(_3ce2){draw2d.Port.call(this,_3ce2);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 _3ce4=new draw2d.CommandConnect(this.parentNode.workflow,this,port);this.parentNode.workflow.getCommandStack().execute(_3ce4);}}};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(_4002){this.canvas=_4002;if(this.graphics!=null){this.graphics.clear();}this.graphics=null;};draw2d.Line.prototype.setWorkflow=function(_4003){this.workflow=_4003;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(_4004){this.moveListener[_4004.id]=_4004;};draw2d.Line.prototype.detachMoveListener=function(_4005){this.moveListener[_4005.id]=null;};draw2d.Line.prototype.fireMoveEvent=function(){for(key in this.moveListener){var _4006=this.moveListener[key];if(_4006!=null){_4006.onOtherFigureMoved(this);}}};draw2d.Line.prototype.onOtherFigureMoved=function(_4007){};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(_400a){if(_400a==this.alpha){return;}try{this.html.style.MozOpacity=_400a;}catch(exc){}try{this.html.style.opacity=_400a;}catch(exc){}try{var _400b=Math.round(_400a*100);if(_400b>=99){this.html.style.filter="";}else{this.html.style.filter="alpha(opacity="+_400b+")";}}catch(exc){}this.alpha=_400a;};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 _4012=this.getLength();var angle=-(180/Math.PI)*Math.asin((this.startY-this.endY)/_4012);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 _4018=10;var _4019=10;nbTry=0;while(nbTry<1000){var id="";for(var i=0;i<_4018;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 _4025=5;X2-=X1;Y2-=Y1;px-=X1;py-=Y1;var _4026=px*X2+py*Y2;var _4027;if(_4026<=0){_4027=0;}else{px=X2-px;py=Y2-py;_4026=px*X2+py*Y2;if(_4026<=0){_4027=0;}else{_4027=_4026*_4026/(X2*X2+Y2*Y2);}}var lenSq=px*px+py*py-_4027;if(lenSq<0){lenSq=0;}return Math.sqrt(lenSq)<_4025;};draw2d.ConnectionRouter=function(){};draw2d.ConnectionRouter.prototype.type="ConnectionRouter";draw2d.ConnectionRouter.prototype.getDirection=function(r,p){var _4051=Math.abs(r.x-p.x);var _4052=3;var i=Math.abs(r.y-p.y);if(i<=_4051){_4051=i;_4052=0;}i=Math.abs(r.getBottom()-p.y);if(i<=_4051){_4051=i;_4052=2;}i=Math.abs(r.getRight()-p.x);if(i<_4051){_4051=i;_4052=1;}return _4052;};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(_405a){};draw2d.NullConnectionRouter=function(){};draw2d.NullConnectionRouter.prototype=new draw2d.ConnectionRouter;draw2d.NullConnectionRouter.prototype.type="NullConnectionRouter";draw2d.NullConnectionRouter.prototype.invalidate=function(){};draw2d.NullConnectionRouter.prototype.route=function(_4f50){_4f50.addPoint(_4f50.getStartPoint());_4f50.addPoint(_4f50.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 _4c09=conn.getStartPoint();var _4c0a=this.getStartDirection(conn);var toPt=conn.getEndPoint();var toDir=this.getEndDirection(conn);this._route(conn,toPt,toDir,_4c09,_4c0a);};draw2d.ManhattanConnectionRouter.prototype._route=function(conn,_4c0e,_4c0f,toPt,toDir){var TOL=0.1;var _4c13=0.01;var UP=0;var RIGHT=1;var DOWN=2;var LEFT=3;var xDiff=_4c0e.x-toPt.x;var yDiff=_4c0e.y-toPt.y;var point;var dir;if(((xDiff*xDiff)<(_4c13))&&((yDiff*yDiff)<(_4c13))){conn.addPoint(new draw2d.Point(toPt.x,toPt.y));return;}if(_4c0f==LEFT){if((xDiff>0)&&((yDiff*yDiff)<TOL)&&(toDir==RIGHT)){point=toPt;dir=toDir;}else{if(xDiff<0){point=new draw2d.Point(_4c0e.x-this.MINDIST,_4c0e.y);}else{if(((yDiff>0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){point=new draw2d.Point(toPt.x,_4c0e.y);}else{if(_4c0f==toDir){var pos=Math.min(_4c0e.x,toPt.x)-this.MINDIST;point=new draw2d.Point(pos,_4c0e.y);}else{point=new draw2d.Point(_4c0e.x-(xDiff/2),_4c0e.y);}}}if(yDiff>0){dir=UP;}else{dir=DOWN;}}}else{if(_4c0f==RIGHT){if((xDiff<0)&&((yDiff*yDiff)<TOL)&&(toDir==LEFT)){point=toPt;dir=toDir;}else{if(xDiff>0){point=new draw2d.Point(_4c0e.x+this.MINDIST,_4c0e.y);}else{if(((yDiff>0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){point=new draw2d.Point(toPt.x,_4c0e.y);}else{if(_4c0f==toDir){var pos=Math.max(_4c0e.x,toPt.x)+this.MINDIST;point=new draw2d.Point(pos,_4c0e.y);}else{point=new draw2d.Point(_4c0e.x-(xDiff/2),_4c0e.y);}}}if(yDiff>0){dir=UP;}else{dir=DOWN;}}}else{if(_4c0f==DOWN){if(((xDiff*xDiff)<TOL)&&(yDiff<0)&&(toDir==UP)){point=toPt;dir=toDir;}else{if(yDiff>0){point=new draw2d.Point(_4c0e.x,_4c0e.y+this.MINDIST);}else{if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){point=new draw2d.Point(_4c0e.x,toPt.y);}else{if(_4c0f==toDir){var pos=Math.max(_4c0e.y,toPt.y)+this.MINDIST;point=new draw2d.Point(_4c0e.x,pos);}else{point=new draw2d.Point(_4c0e.x,_4c0e.y-(yDiff/2));}}}if(xDiff>0){dir=LEFT;}else{dir=RIGHT;}}}else{if(_4c0f==UP){if(((xDiff*xDiff)<TOL)&&(yDiff>0)&&(toDir==DOWN)){point=toPt;dir=toDir;}else{if(yDiff<0){point=new draw2d.Point(_4c0e.x,_4c0e.y-this.MINDIST);}else{if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){point=new draw2d.Point(_4c0e.x,toPt.y);}else{if(_4c0f==toDir){var pos=Math.min(_4c0e.y,toPt.y)-this.MINDIST;point=new draw2d.Point(_4c0e.x,pos);}else{point=new draw2d.Point(_4c0e.x,_4c0e.y-(yDiff/2));}}}if(xDiff>0){dir=LEFT;}else{dir=RIGHT;}}}}}}this._route(conn,point,dir,toPt,toDir);conn.addPoint(_4c0e);};draw2d.BezierConnectionRouter=function(_4c31){if(!_4c31){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(_4c32,_4c33,t,iter){var n=_4c32.length-1;var q=new Array();for(var i=0;i<n+1;i++){q[i]=new Array();q[i][0]=_4c32[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,_4c33,t,--iter);this.drawBezier(c2,_4c33,t,--iter);}else{for(var i=0;i<n;i++){_4c33.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 _4c3d=new Array();var _4c3e=conn.getStartPoint();var toPt=conn.getEndPoint();this._route(_4c3d,conn,toPt,this.getEndDirection(conn),_4c3e,this.getStartDirection(conn));var _4c40=new Array();this.drawBezier(_4c3d,_4c40,0.5,this.iteration);for(var i=0;i<_4c40.length;i++){conn.addPoint(_4c40[i]);}conn.addPoint(toPt);};draw2d.BezierConnectionRouter.prototype._route=function(_4c42,conn,_4c44,_4c45,toPt,toDir){var TOL=0.1;var _4c49=0.01;var _4c4a=90;var UP=0;var RIGHT=1;var DOWN=2;var LEFT=3;var xDiff=_4c44.x-toPt.x;var yDiff=_4c44.y-toPt.y;var point;var dir;if(((xDiff*xDiff)<(_4c49))&&((yDiff*yDiff)<(_4c49))){_4c42.push(new draw2d.Point(toPt.x,toPt.y));return;}if(_4c45==LEFT){if((xDiff>0)&&((yDiff*yDiff)<TOL)&&(toDir==RIGHT)){point=toPt;dir=toDir;}else{if(xDiff<0){point=new draw2d.Point(_4c44.x-_4c4a,_4c44.y);}else{if(((yDiff>0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){point=new draw2d.Point(toPt.x,_4c44.y);}else{if(_4c45==toDir){var pos=Math.min(_4c44.x,toPt.x)-_4c4a;point=new draw2d.Point(pos,_4c44.y);}else{point=new draw2d.Point(_4c44.x-(xDiff/2),_4c44.y);}}}if(yDiff>0){dir=UP;}else{dir=DOWN;}}}else{if(_4c45==RIGHT){if((xDiff<0)&&((yDiff*yDiff)<TOL)&&(toDir==LEFT)){point=toPt;dir=toDir;}else{if(xDiff>0){point=new draw2d.Point(_4c44.x+_4c4a,_4c44.y);}else{if(((yDiff>0)&&(toDir==DOWN))||((yDiff<0)&&(toDir==UP))){point=new draw2d.Point(toPt.x,_4c44.y);}else{if(_4c45==toDir){var pos=Math.max(_4c44.x,toPt.x)+_4c4a;point=new draw2d.Point(pos,_4c44.y);}else{point=new draw2d.Point(_4c44.x-(xDiff/2),_4c44.y);}}}if(yDiff>0){dir=UP;}else{dir=DOWN;}}}else{if(_4c45==DOWN){if(((xDiff*xDiff)<TOL)&&(yDiff<0)&&(toDir==UP)){point=toPt;dir=toDir;}else{if(yDiff>0){point=new draw2d.Point(_4c44.x,_4c44.y+_4c4a);}else{if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){point=new draw2d.Point(_4c44.x,toPt.y);}else{if(_4c45==toDir){var pos=Math.max(_4c44.y,toPt.y)+_4c4a;point=new draw2d.Point(_4c44.x,pos);}else{point=new draw2d.Point(_4c44.x,_4c44.y-(yDiff/2));}}}if(xDiff>0){dir=LEFT;}else{dir=RIGHT;}}}else{if(_4c45==UP){if(((xDiff*xDiff)<TOL)&&(yDiff>0)&&(toDir==DOWN)){point=toPt;dir=toDir;}else{if(yDiff<0){point=new draw2d.Point(_4c44.x,_4c44.y-_4c4a);}else{if(((xDiff>0)&&(toDir==RIGHT))||((xDiff<0)&&(toDir==LEFT))){point=new draw2d.Point(_4c44.x,toPt.y);}else{if(_4c45==toDir){var pos=Math.min(_4c44.y,toPt.y)-_4c4a;point=new draw2d.Point(_4c44.x,pos);}else{point=new draw2d.Point(_4c44.x,_4c44.y-(yDiff/2));}}}if(xDiff>0){dir=LEFT;}else{dir=RIGHT;}}}}}}this._route(_4c42,conn,point,dir,toPt,toDir);_4c42.push(_4c44);};draw2d.FanConnectionRouter=function(){};draw2d.FanConnectionRouter.prototype=new draw2d.NullConnectionRouter;draw2d.FanConnectionRouter.prototype.type="FanConnectionRouter";draw2d.FanConnectionRouter.prototype.route=function(conn){var _4cd8=conn.getStartPoint();var toPt=conn.getEndPoint();var lines=conn.getSource().getConnections();var _4cdb=new draw2d.ArrayList();var index=0;for(var i=0;i<lines.length;i++){var _4cde=lines[i];if(_4cde.getTarget()==conn.getTarget()||_4cde.getSource()==conn.getTarget()){_4cdb.add(_4cde);if(conn==_4cde){index=_4cdb.getSize();}}}if(_4cdb.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 _4ce4=10;var _4ce5=new draw2d.Point((end.x+start.x)/2,(end.y+start.y)/2);var _4ce6=end.getPosition(start);var ray;if(_4ce6==draw2d.PositionConstants.SOUTH||_4ce6==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 _4ce8=Math.sqrt(ray.x*ray.x+ray.y*ray.y);var _4ce9=_4ce4*ray.x/_4ce8;var _4cea=_4ce4*ray.y/_4ce8;var _4ceb;if(index%2==0){_4ceb=new draw2d.Point(_4ce5.x+(index/2)*(-1*_4cea),_4ce5.y+(index/2)*_4ce9);}else{_4ceb=new draw2d.Point(_4ce5.x+(index/2)*_4cea,_4ce5.y+(index/2)*(-1*_4ce9));}conn.addPoint(_4ceb);conn.addPoint(end);};draw2d.Graphics=function(_3f54,_3f55,_3f56){this.jsGraphics=_3f54;this.xt=_3f56.x;this.yt=_3f56.y;this.radian=_3f55*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(_3f6c,_3f6d){var rotX=new Array();var rotY=new Array();for(var i=0;i<_3f6c.length;i++){rotX[i]=this.xt+_3f6c[i]*this.cosRadian-_3f6d[i]*this.sinRadian;rotY[i]=this.yt+_3f6c[i]*this.sinRadian+_3f6d[i]*this.cosRadian;}this.jsGraphics.fillPolygon(rotX,rotY);};draw2d.Graphics.prototype.setColor=function(color){this.jsGraphics.setColor(color.getHTMLStyle());};draw2d.Graphics.prototype.drawPolygon=function(_3f72,_3f73){var rotX=new Array();var rotY=new Array();for(var i=0;i<_3f72.length;i++){rotX[i]=this.xt+_3f72[i]*this.cosRadian-_3f73[i]*this.sinRadian;rotY[i]=this.yt+_3f72[i]*this.sinRadian+_3f73[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.router=draw2d.Connection.defaultRouter;this.lineSegments=new Array();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(_47ed){draw2d.Connection.defaultRouter=_47ed;};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.setSourceDecorator=function(_47ee){this.sourceDecorator=_47ee;if(this.graphics!=null){this.paint();}};draw2d.Connection.prototype.setTargetDecorator=function(_47ef){this.targetDecorator=_47ef;if(this.graphics!=null){this.paint();}};draw2d.Connection.prototype.setRouter=function(_47f0){if(_47f0!=null){this.router=_47f0;}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();};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.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.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.fireTargetPortRouteEvent();this.targetPort.attachMoveListener(this);this.setEndPoint(port.getAbsoluteX(),port.getAbsoluteY());};draw2d.Connection.prototype.getTarget=function(){return this.targetPort;};draw2d.Connection.prototype.onOtherFigureMoved=function(_47f5){if(_47f5==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 _47fc=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)/_47fc);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 _4800=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)/_4800);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 _4802=this.sourcePort.getConnections();for(var i=0;i<_4802.length;i++){_4802[i].paint();}};draw2d.Connection.prototype.fireTargetPortRouteEvent=function(){var _4804=this.targetPort.getConnections();for(var i=0;i<_4804.length;i++){_4804[i].paint();}};draw2d.ConnectionDecorator=function(){};draw2d.ConnectionDecorator.prototype.type="ConnectionDecorator";draw2d.ConnectionDecorator.prototype.paint=function(g){};draw2d.ArrowConnectionDecorator=function(){};draw2d.ArrowConnectionDecorator.prototype=new draw2d.ConnectionDecorator;draw2d.ArrowConnectionDecorator.prototype.type="ArrowConnectionDecorator";draw2d.ArrowConnectionDecorator.prototype.paint=function(g){g.setColor(new draw2d.Color(255,128,128));g.fillPolygon([3,20,20,3],[0,5,-5,0]);g.setColor(new draw2d.Color(128,128,255));g.setStroke(1);g.drawPolygon([3,20,20,3],[0,5,-5,0]);};draw2d.CompartmentFigure=function(){draw2d.Figure.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(_3cf9){_3cf9.target.node.onFigureEnter(_3cf9.relatedTarget.node);});this.dropable.addEventListener("figureleave",function(_3cfa){_3cfa.target.node.onFigureLeave(_3cfa.relatedTarget.node);});this.dropable.addEventListener("figuredrop",function(_3cfb){_3cfb.target.node.onFigureDrop(_3cfb.relatedTarget.node);});};draw2d.CompartmentFigure.prototype=new draw2d.Figure;draw2d.CompartmentFigure.prototype.type="CompartmentFigure";draw2d.CompartmentFigure.prototype.onFigureEnter=function(_3cfc){};draw2d.CompartmentFigure.prototype.onFigureLeave=function(_3cfd){};draw2d.CompartmentFigure.prototype.onFigureDrop=function(_3cfe){};draw2d.CompartmentFigure.prototype.getChildren=function(){var _3cff=new Array();for(var i=0;i<this.children.getSize();i++){_3cff.push(this.children.get(i));}return _3cff;};draw2d.CompartmentFigure.prototype.addChild=function(_3d01){_3d01.setZOrder(this.getZOrder()+1);_3d01.setParent(this);if(this.children.indexOf(_3d01)!=-1){alert("error");}this.children.add(_3d01);};draw2d.CompartmentFigure.prototype.removeChild=function(_3d02){_3d02.setParent(null);this.children.remove(_3d02);};draw2d.CompartmentFigure.prototype.setZOrder=function(index){draw2d.Figure.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.Figure.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.Figure.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(_414d){this.canvas=_414d;};draw2d.Document.prototype.getFigures=function(){var _414e=new Array();var _414f=this.canvas.figures;var _4150=this.canvas.dialogs;for(var i=0;i<_414f.getSize();i++){var _4152=_414f.get(i);if(_4150.indexOf(_4152)==-1&&_4152.getParent()==null&&!(_4152 instanceof draw2d.Window)){_414e.push(_4152);}}return _414e;};draw2d.Document.prototype.getLines=function(){var _4153=new Array();var lines=this.canvas.getLines();for(var i=0;i<lines.getSize();i++){_4153.push(lines.get(i));}return _4153;};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 _4cce=new draw2d.AnnotationDialog(this);this.workflow.showDialog(_4cce);};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(_4131,type){draw2d.Rectangle.call(this,5,5);this.type=type;var _4133=this.getWidth();var _4134=_4133/2;switch(this.type){case 1:this.setSnapToGridAnchor(new draw2d.Point(_4133,_4133));break;case 2:this.setSnapToGridAnchor(new draw2d.Point(_4134,_4133));break;case 3:this.setSnapToGridAnchor(new draw2d.Point(0,_4133));break;case 4:this.setSnapToGridAnchor(new draw2d.Point(0,_4134));break;case 5:this.setSnapToGridAnchor(new draw2d.Point(0,0));break;case 6:this.setSnapToGridAnchor(new draw2d.Point(_4134,0));break;case 7:this.setSnapToGridAnchor(new draw2d.Point(_4133,0));break;case 8:this.setSnapToGridAnchor(new draw2d.Point(_4133,_4134));break;}this.setBackgroundColor(new draw2d.Color(0,255,0));this.setWorkflow(_4131);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 _4135=this.workflow.currentSelection;this.commandMove.setPosition(_4135.getX(),_4135.getY());this.commandResize.setDimension(_4135.getWidth(),_4135.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 _413a=this.workflow.currentSelection;this.commandMove=new draw2d.CommandMove(_413a,_413a.getX(),_413a.getY());this.commandResize=new draw2d.CommandResize(_413a,_413a.getWidth(),_413a.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 _413f=this.workflow.currentSelection.getX();var _4140=this.workflow.currentSelection.getY();var _4141=this.workflow.currentSelection.getWidth();var _4142=this.workflow.currentSelection.getHeight();switch(this.type){case 1:this.workflow.currentSelection.setPosition(_413f-diffX,_4140-diffY);this.workflow.currentSelection.setDimension(_4141+diffX,_4142+diffY);break;case 2:this.workflow.currentSelection.setPosition(_413f,_4140-diffY);this.workflow.currentSelection.setDimension(_4141,_4142+diffY);break;case 3:this.workflow.currentSelection.setPosition(_413f,_4140-diffY);this.workflow.currentSelection.setDimension(_4141-diffX,_4142+diffY);break;case 4:this.workflow.currentSelection.setPosition(_413f,_4140);this.workflow.currentSelection.setDimension(_4141-diffX,_4142);break;case 5:this.workflow.currentSelection.setPosition(_413f,_4140);this.workflow.currentSelection.setDimension(_4141-diffX,_4142-diffY);break;case 6:this.workflow.currentSelection.setPosition(_413f,_4140);this.workflow.currentSelection.setDimension(_4141,_4142-diffY);break;case 7:this.workflow.currentSelection.setPosition(_413f-diffX,_4140);this.workflow.currentSelection.setDimension(_4141+diffX,_4142-diffY);break;case 8:this.workflow.currentSelection.setPosition(_413f-diffX,_4140);this.workflow.currentSelection.setDimension(_4141+diffX,_4142);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="n-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="nw-resize";break;case 6:this.html.style.cursor="n-resize";break;case 7:this.html.style.cursor="ne-resize";break;case 8:this.html.style.cursor="w-resize";break;}};draw2d.ResizeHandle.prototype.onKeyDown=function(_4144,ctrl){this.workflow.onKeyDown(_4144,ctrl);};draw2d.ResizeHandle.prototype.fireMoveEvent=function(){};draw2d.LineStartResizeHandle=function(_490e){draw2d.Rectangle.call(this);this.setDimension(5,5);this.setBackgroundColor(new draw2d.Color(0,255,0));this.setWorkflow(_490e);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 _491f=this.workflow.currentSelection.getStartX();var _4920=this.workflow.currentSelection.getStartY();this.workflow.currentSelection.setStartPoint(_491f-diffX,_4920-diffY);};draw2d.LineStartResizeHandle.prototype.onKeyDown=function(_4921,ctrl){if(this.workflow!=null){this.workflow.onKeyDown(_4921,ctrl);}};draw2d.LineStartResizeHandle.prototype.fireMoveEvent=function(){};draw2d.LineEndResizeHandle=function(_4370){draw2d.Rectangle.call(this);this.setDimension(5,5);this.setBackgroundColor(new draw2d.Color(0,255,0));this.setWorkflow(_4370);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 _4381=this.workflow.currentSelection.getEndX();var _4382=this.workflow.currentSelection.getEndY();this.workflow.currentSelection.setEndPoint(_4381-diffX,_4382-diffY);};draw2d.LineEndResizeHandle.prototype.onKeyDown=function(_4383){if(this.workflow!=null){this.workflow.onKeyDown(_4383);}};draw2d.LineEndResizeHandle.prototype.fireMoveEvent=function(){};draw2d.Canvas=function(_4bf4){if(_4bf4){this.construct(_4bf4);}this.enableSmoothFigureHandling=false;};draw2d.Canvas.prototype.type="Canvas";draw2d.Canvas.prototype.construct=function(_4bf5){this.canvasId=_4bf5;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(_4bf7,xPos,yPos,_4bfa){if(this.enableSmoothFigureHandling==true){if(_4bf7.timer<=0){_4bf7.setAlpha(0.001);}var _4bfb=_4bf7;var _4bfc=function(){if(_4bfb.alpha<1){_4bfb.setAlpha(Math.min(1,_4bfb.alpha+0.05));}else{window.clearInterval(_4bfb.timer);_4bfb.timer=-1;}};if(_4bfb.timer>0){window.clearInterval(_4bfb.timer);}_4bfb.timer=window.setInterval(_4bfc,30);}_4bf7.setCanvas(this);if(xPos&&yPos){_4bf7.setPosition(xPos,yPos);}this.html.appendChild(_4bf7.getHTMLElement());if(!_4bfa){_4bf7.paint();}};draw2d.Canvas.prototype.removeFigure=function(_4bfd){if(this.enableSmoothFigureHandling==true){var oThis=this;var _4bff=_4bfd;var _4c00=function(){if(_4bff.alpha>0){_4bff.setAlpha(Math.max(0,_4bff.alpha-0.05));}else{window.clearInterval(_4bff.timer);_4bff.timer=-1;oThis.html.removeChild(_4bff.html);_4bff.setCanvas(null);}};if(_4bff.timer>0){window.clearInterval(_4bff.timer);}_4bff.timer=window.setInterval(_4c00,20);}else{this.html.removeChild(_4bfd.html);_4bfd.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(_4c02,_4c03){if(_4c02!=null){if(_4c03){this.html.style.background="transparent url("+_4c02+") ";}else{this.html.style.background="transparent url("+_4c02+") 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 _41b4=function(){var _41b5=arguments[0]||window.event;var diffX=_41b5.clientX;var diffY=_41b5.clientY;var _41b8=oThis.getScrollLeft();var _41b9=oThis.getScrollTop();var _41ba=oThis.getAbsoluteX();var _41bb=oThis.getAbsoluteY();if(oThis.getBestFigure(diffX+_41b8-_41ba,diffY+_41b9-_41bb)!=null){return;}var line=oThis.getBestLine(diffX+_41b8-_41ba,diffY+_41b9-_41bb,null);if(line!=null){line.onContextMenu(diffX+_41b8-_41ba,diffY+_41b9-_41bb);}else{oThis.onContextMenu(diffX+_41b8-_41ba,diffY+_41b9-_41bb);}};this.html.oncontextmenu=function(){return false;};var oThis=this;var _41be=function(event){var ctrl=event.ctrlKey;oThis.onKeyDown(event.keyCode,ctrl);};var _41c1=function(){var _41c2=arguments[0]||window.event;var diffX=_41c2.clientX;var diffY=_41c2.clientY;var _41c5=oThis.getScrollLeft();var _41c6=oThis.getScrollTop();var _41c7=oThis.getAbsoluteX();var _41c8=oThis.getAbsoluteY();oThis.onMouseDown(diffX+_41c5-_41c7,diffY+_41c6-_41c8);};var _41c9=function(){var _41ca=arguments[0]||window.event;if(oThis.currentMenu!=null){oThis.removeFigure(oThis.currentMenu);oThis.currentMenu=null;}if(_41ca.button==2){return;}var diffX=_41ca.clientX;var diffY=_41ca.clientY;var _41cd=oThis.getScrollLeft();var _41ce=oThis.getScrollTop();var _41cf=oThis.getAbsoluteX();var _41d0=oThis.getAbsoluteY();oThis.onMouseUp(diffX+_41cd-_41cf,diffY+_41ce-_41d0);};var _41d1=function(){var _41d2=arguments[0]||window.event;var diffX=_41d2.clientX;var diffY=_41d2.clientY;var _41d5=oThis.getScrollLeft();var _41d6=oThis.getScrollTop();var _41d7=oThis.getAbsoluteX();var _41d8=oThis.getAbsoluteY();oThis.currentMouseX=diffX+_41d5-_41d7;oThis.currentMouseY=diffY+_41d6-_41d8;var obj=oThis.getBestFigure(oThis.currentMouseX,oThis.currentMouseY);if(draw2d.Drag.currentHover!=null&&obj==null){var _41da=new draw2d.DragDropEvent();_41da.initDragDropEvent("mouseleave",false,oThis);draw2d.Drag.currentHover.dispatchEvent(_41da);}else{var diffX=_41d2.clientX;var diffY=_41d2.clientY;var _41d5=oThis.getScrollLeft();var _41d6=oThis.getScrollTop();var _41d7=oThis.getAbsoluteX();var _41d8=oThis.getAbsoluteY();oThis.onMouseMove(diffX+_41d5-_41d7,diffY+_41d6-_41d8);}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 _41db=function(_41dc){var _41dc=arguments[0]||window.event;var diffX=_41dc.clientX;var diffY=_41dc.clientY;var _41df=oThis.getScrollLeft();var _41e0=oThis.getScrollTop();var _41e1=oThis.getAbsoluteX();var _41e2=oThis.getAbsoluteY();var line=oThis.getBestLine(diffX+_41df-_41e1,diffY+_41e0-_41e2,null);if(line!=null){line.onDoubleClick();}};if(this.html.addEventListener){this.html.addEventListener("contextmenu",_41b4,false);this.html.addEventListener("mousemove",_41d1,false);this.html.addEventListener("mouseup",_41c9,false);this.html.addEventListener("mousedown",_41c1,false);this.html.addEventListener("keydown",_41be,false);this.html.addEventListener("dblclick",_41db,false);}else{if(this.html.attachEvent){this.html.attachEvent("oncontextmenu",_41b4);this.html.attachEvent("onmousemove",_41d1);this.html.attachEvent("onmousedown",_41c1);this.html.attachEvent("onmouseup",_41c9);this.html.attachEvent("onkeydown",_41be);this.html.attachEvent("ondblclick",_41db);}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 _41e4=this.getScrollLeft();var _41e5=this.getScrollTop();var _41e6=_41e4-this.oldScrollPosLeft;var _41e7=_41e5-this.oldScrollPosTop;for(var i=0;i<this.figures.getSize();i++){var _41e9=this.figures.get(i);if(_41e9.hasFixedPosition&&_41e9.hasFixedPosition()==true){_41e9.setPosition(_41e9.getX()+_41e6,_41e9.getY()+_41e7);}}this.oldScrollPosLeft=_41e4;this.oldScrollPosTop=_41e5;};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(_41f4,_41f5){if(this.tooltip!=null){this.removeFigure(this.tooltip);this.tooltip=null;if(this.tooltipTimer>=0){window.clearTimeout(this.tooltipTimer);this.tooltipTimer=-1;}}this.tooltip=_41f4;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 _41f7=function(){oThis.tooltipTimer=-1;oThis.showTooltip(null);};if(_41f5==true){this.tooltipTimer=window.setTimeout(_41f7,5000);}}};draw2d.Workflow.prototype.showDialog=function(_41f8,xPos,yPos){if(xPos){this.addFigure(_41f8,xPos,yPos);}else{this.addFigure(_41f8,200,100);}this.dialogs.add(_41f8);};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(_4201,x,y){this.toolPalette=_4201;if(y){this.addFigure(_4201,x,y);}else{this.addFigure(_4201,20,20);}this.dialogs.add(_4201);};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(_4208,xPos,yPos){_4208.setWorkflow(this);draw2d.Canvas.prototype.addFigure.call(this,_4208,xPos,yPos,true);var _420b=this;if(_4208 instanceof draw2d.CompartmentFigure){this.compartments.add(_4208);}if(_4208 instanceof draw2d.Line){this.lines.add(_4208);}else{this.figures.add(_4208);_4208.draggable.addEventListener("dragend",function(_420c){});_4208.draggable.addEventListener("dragstart",function(_420d){var _420e=_420b.getFigure(_420d.target.element.id);if(_420e==null){return;}if(_420e.isSelectable()==false){return;}_420b.showResizeHandles(_420e);_420b.setCurrentSelection(_420e);});_4208.draggable.addEventListener("drag",function(_420f){var _4210=_420b.getFigure(_420f.target.element.id);if(_4210==null){return;}if(_4210.isSelectable()==false){return;}_420b.moveResizeHandles(_4210);});}_4208.paint();this.setDocumentDirty();};draw2d.Workflow.prototype.removeFigure=function(_4211){draw2d.Canvas.prototype.removeFigure.call(this,_4211);this.figures.remove(_4211);this.lines.remove(_4211);this.dialogs.remove(_4211);_4211.setWorkflow(null);if(_4211 instanceof draw2d.CompartmentFigure){this.compartments.remove(_4211);}if(_4211 instanceof draw2d.Connection){_4211.disconnect();}if(this.currentSelection==_4211){this.setCurrentSelection(null);}this.setDocumentDirty();};draw2d.Workflow.prototype.moveFront=function(_4212){this.html.removeChild(_4212.getHTMLElement());this.html.appendChild(_4212.getHTMLElement());};draw2d.Workflow.prototype.moveBack=function(_4213){this.html.removeChild(_4213.getHTMLElement());this.html.insertBefore(_4213.getHTMLElement(),this.html.firstChild);};draw2d.Workflow.prototype.getBestCompartmentFigure=function(x,y,_4216){var _4217=null;for(var i=0;i<this.figures.getSize();i++){var _4219=this.figures.get(i);if((_4219 instanceof draw2d.CompartmentFigure)&&_4219.isOver(x,y)==true&&_4219!=_4216){if(_4217==null){_4217=_4219;}else{if(_4217.getZOrder()<_4219.getZOrder()){_4217=_4219;}}}}return _4217;};draw2d.Workflow.prototype.getBestFigure=function(x,y,_421c){var _421d=null;for(var i=0;i<this.figures.getSize();i++){var _421f=this.figures.get(i);if(_421f.isOver(x,y)==true&&_421f!=_421c){if(_421d==null){_421d=_421f;}else{if(_421d.getZOrder()<_421f.getZOrder()){_421d=_421f;}}}}return _421d;};draw2d.Workflow.prototype.getBestLine=function(x,y,_4222){var _4223=null;for(var i=0;i<this.lines.getSize();i++){var line=this.lines.get(i);if(line.containsPoint(x,y)==true&&line!=_4222){if(_4223==null){_4223=line;}else{if(_4223.getZOrder()<line.getZOrder()){_4223=line;}}}}return _4223;};draw2d.Workflow.prototype.getFigure=function(id){for(var i=0;i<this.figures.getSize();i++){var _4228=this.figures.get(i);if(_4228.id==id){return _4228;}}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(_422b){if(_422b==null){this.hideResizeHandles();this.hideLineResizeHandles();}this.currentSelection=_422b;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(_4234){var _4235=this.resizeHandleStart.getWidth()/2;var _4236=this.resizeHandleStart.getHeight()/2;draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandleStart,_4234.getStartX()-_4235,_4234.getStartY()-_4235);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandleEnd,_4234.getEndX()-_4235,_4234.getEndY()-_4235);this.resizeHandleStart.setCanDrag(_4234.isResizeable());this.resizeHandleEnd.setCanDrag(_4234.isResizeable());if(_4234.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(_4238){this.hideLineResizeHandles();this.hideResizeHandles();if(this.getEnableSmoothFigureHandling()==true&&this.getCurrentSelection()!=_4238){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 _4239=this.resizeHandle1.getWidth();var _423a=this.resizeHandle1.getHeight();var _423b=_4238.getHeight();var _423c=_4238.getWidth();var xPos=_4238.getX();var yPos=_4238.getY();draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle1,xPos-_4239,yPos-_423a);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle3,xPos+_423c,yPos-_423a);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle5,xPos+_423c,yPos+_423b);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle7,xPos-_4239,yPos+_423b);this.resizeHandle1.setCanDrag(_4238.isResizeable());this.resizeHandle3.setCanDrag(_4238.isResizeable());this.resizeHandle5.setCanDrag(_4238.isResizeable());this.resizeHandle7.setCanDrag(_4238.isResizeable());if(_4238.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(_4238.isStrechable()&&_4238.isResizeable()){draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle2,xPos+(_423c/2)-this.resizeHandleHalfWidth,yPos-_423a);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle4,xPos+_423c,yPos+(_423b/2)-(_423a/2));draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle6,xPos+(_423c/2)-this.resizeHandleHalfWidth,yPos+_423b);draw2d.Canvas.prototype.addFigure.call(this,this.resizeHandle8,xPos-_4239,yPos+(_423b/2)-(_423a/2));}};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(_4240){var _4241=this.resizeHandle1.getWidth();var _4242=this.resizeHandle1.getHeight();var _4243=_4240.getHeight();var _4244=_4240.getWidth();var xPos=_4240.getX();var yPos=_4240.getY();this.resizeHandle1.setPosition(xPos-_4241,yPos-_4242);this.resizeHandle3.setPosition(xPos+_4244,yPos-_4242);this.resizeHandle5.setPosition(xPos+_4244,yPos+_4243);this.resizeHandle7.setPosition(xPos-_4241,yPos+_4243);if(_4240.isStrechable()){this.resizeHandle2.setPosition(xPos+(_4244/2)-this.resizeHandleHalfWidth,yPos-_4242);this.resizeHandle4.setPosition(xPos+_4244,yPos+(_4243/2)-(_4242/2));this.resizeHandle6.setPosition(xPos+(_4244/2)-this.resizeHandleHalfWidth,yPos+_4243);this.resizeHandle8.setPosition(xPos-_4241,yPos+(_4243/2)-(_4242/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(_4251,ctrl){if(_4251==46&&this.currentSelection!=null&&this.currentSelection.isDeleteable()){this.commandStack.execute(new draw2d.CommandDelete(this.currentSelection));}else{if(_4251==90&&ctrl){this.commandStack.undo();}else{if(_4251==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(_4255,pos){if(this.snapToGeometryHelper!=null){if(_4255 instanceof draw2d.ResizeHandle){var _4257=_4255.getSnapToGridAnchor();pos.x+=_4257.x;pos.y+=_4257.y;var _4258=new draw2d.Point(pos.x,pos.y);var _4259=_4255.getSnapToDirection();var _425a=this.snapToGeometryHelper.snapPoint(_4259,pos,_4258);if((_4259&draw2d.SnapToHelper.EAST_WEST)&&!(_425a&draw2d.SnapToHelper.EAST_WEST)){this.showSnapToHelperLineVertical(_4258.x);}else{this.hideSnapToHelperLineVertical();}if((_4259&draw2d.SnapToHelper.NORTH_SOUTH)&&!(_425a&draw2d.SnapToHelper.NORTH_SOUTH)){this.showSnapToHelperLineHorizontal(_4258.y);}else{this.hideSnapToHelperLineHorizontal();}_4258.x-=_4257.x;_4258.y-=_4257.y;return _4258;}else{var _425b=new draw2d.Dimension(pos.x,pos.y,_4255.getWidth(),_4255.getHeight());var _4258=new draw2d.Dimension(pos.x,pos.y,_4255.getWidth(),_4255.getHeight());var _4259=draw2d.SnapToHelper.NSEW;var _425a=this.snapToGeometryHelper.snapRectangle(_425b,_4258);if((_4259&draw2d.SnapToHelper.WEST)&&!(_425a&draw2d.SnapToHelper.WEST)){this.showSnapToHelperLineVertical(_4258.x);}else{if((_4259&draw2d.SnapToHelper.EAST)&&!(_425a&draw2d.SnapToHelper.EAST)){this.showSnapToHelperLineVertical(_4258.getX()+_4258.getWidth());}else{this.hideSnapToHelperLineVertical();}}if((_4259&draw2d.SnapToHelper.NORTH)&&!(_425a&draw2d.SnapToHelper.NORTH)){this.showSnapToHelperLineHorizontal(_4258.y);}else{if((_4259&draw2d.SnapToHelper.SOUTH)&&!(_425a&draw2d.SnapToHelper.SOUTH)){this.showSnapToHelperLineHorizontal(_4258.getY()+_4258.getHeight());}else{this.hideSnapToHelperLineHorizontal();}}return _4258.getTopLeft();}}else{if(this.snapToGridHelper!=null){var _4257=_4255.getSnapToGridAnchor();pos.x=pos.x+_4257.x;pos.y=pos.y+_4257.y;var _4258=new draw2d.Point(pos.x,pos.y);this.snapToGridHelper.snapPoint(0,pos,_4258);_4258.x=_4258.x-_4257.x;_4258.y=_4258.y-_4257.y;return _4258;}}return pos;};draw2d.Workflow.prototype.showSnapToHelperLineHorizontal=function(_425c){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,_425c);this.horizontalSnapToHelperLine.setEndPoint(this.getWidth(),_425c);};draw2d.Workflow.prototype.showSnapToHelperLineVertical=function(_425d){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(_425d,0);this.verticalSnapToHelperLine.setEndPoint(_425d,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(_41a5){};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(_41a9){var _41aa=this.workflow;draw2d.Figure.prototype.setWorkflow.call(this,_41a9);if(_41aa!=null){_41aa.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(_41ae){};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(_41b2){};draw2d.Button=function(_50ce,width,_50d0){this.x=0;this.y=0;this.id=this.generateUId();this.enabled=true;this.active=false;this.palette=_50ce;if(width&&_50d0){this.setDimension(width,_50d0);}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(_50d5){this.tooltip=_50d5;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 _50dd=10;var _50de=10;nbTry=0;while(nbTry<1000){var id="";for(var i=0;i<_50dd;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(_4d12){draw2d.Button.call(this,_4d12);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(_3f7a){this.x=0;this.y=0;this.enabled=true;this.tooltip=null;this.palette=_3f7a;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(_3f80){this.tooltip=_3f80;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(_445b){draw2d.Window.prototype.setWorkflow.call(this,_445b);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(_4cfe,_4cff,label){this.figure=_4cfe;this.propertyName=_4cff;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 _4d02=document.createElement("form");_4d02.style.position="absolute";_4d02.style.left="10px";_4d02.style.top="30px";_4d02.style.width="375px";_4d02.style.font="normal 10px verdana";item.appendChild(_4d02);this.label=document.createTextNode(this.label);this.disableTextSelection(this.label);_4d02.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.getProperty(this.propertyName);if(value){this.input.value=value;}else{this.input.value="";}this.input.style.width="100%";_4d02.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(_3f4f){this.figure=_3f4f;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 _3f51=document.createElement("form");_3f51.style.position="absolute";_3f51.style.left="10px";_3f51.style.top="30px";_3f51.style.width="375px";_3f51.style.font="normal 10px verdana";item.appendChild(_3f51);this.label=document.createTextNode("Text");_3f51.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%";_3f51.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(_4c2b){draw2d.Window.prototype.onSelectionChanged.call(this,_4c2b);if(this.currentSelection!=null){this.currentSelection.detachMoveListener(this);}this.currentSelection=_4c2b;if(_4c2b!=null&&_4c2b!=this){this.labelType.innerHTML=_4c2b.type;if(_4c2b.getX){this.labelX.innerHTML=_4c2b.getX();this.labelY.innerHTML=_4c2b.getY();this.labelWidth.innerHTML=_4c2b.getWidth();this.labelHeight.innerHTML=_4c2b.getHeight();this.currentSelection=_4c2b;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(_4c2c){if(_4c2c==this.currentSelection){this.onSelectionChanged(_4c2c);}};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(_50e2){draw2d.ColorDialog.call(this);this.figure=_50e2;var color=_50e2.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 _50e4=this.workflow;draw2d.ColorDialog.prototype.onOk.call(this);if(typeof this.figure.setColor=="function"){_50e4.getCommandStack().execute(new draw2d.CommandSetColor(this.figure,this.getSelectedColor()));if(_50e4.getCurrentSelection()==this.figure){_50e4.setCurrentSelection(this.figure);}}};draw2d.BackgroundColorDialog=function(_4264){draw2d.ColorDialog.call(this);this.figure=_4264;var color=_4264.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 _4266=this.workflow;draw2d.ColorDialog.prototype.onOk.call(this);if(typeof this.figure.setBackgroundColor=="function"){_4266.getCommandStack().execute(new draw2d.CommandSetBackgroundColor(this.figure,this.getSelectedColor()));if(_4266.getCurrentSelection()==this.figure){_4266.setCurrentSelection(this.figure);}}};draw2d.AnnotationDialog=function(_3f4f){this.figure=_3f4f;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 _3f51=document.createElement("form");_3f51.style.position="absolute";_3f51.style.left="10px";_3f51.style.top="30px";_3f51.style.width="375px";_3f51.style.font="normal 10px verdana";item.appendChild(_3f51);this.label=document.createTextNode("Text");_3f51.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%";_3f51.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(_418c){if(_418c.canExecute()==false){return;}this.undostack.push(_418c);_418c.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 _418d=this.undostack.pop();if(_418d){this.redostack.push(_418d);_418d.undo();}};draw2d.CommandStack.prototype.redo=function(){var _418e=this.redostack.pop();if(_418e){this.undostack.push(_418e);_418e.redo();}};draw2d.CommandStack.prototype.canRedo=function(){return this.redostack.length>0;};draw2d.CommandStack.prototype.canUndo=function(){return this.undostack.length>0;};draw2d.CommandAdd=function(_4c59,_4c5a,x,y,_4c5d){draw2d.Command.call(this,"add figure");this.parent=_4c5d;this.figure=_4c5a;this.x=x;this.y=y;this.workflow=_4c59;};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(_4196){draw2d.Command.call(this,"delete figure");this.parent=_4196.parent;this.figure=_4196;this.workflow=_4196.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(_4d0b,x,y){draw2d.Command.call(this,"move figure");this.figure=_4d0b;this.oldX=x;this.oldY=y;this.oldCompartment=_4d0b.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(_417a,width,_417c){draw2d.Command.call(this,"resize figure");this.figure=_417a;this.oldWidth=width;this.oldHeight=_417c;};draw2d.CommandResize.prototype=new draw2d.Command;draw2d.CommandResize.prototype.type="CommandResize";draw2d.CommandResize.prototype.setDimension=function(width,_417e){this.newWidth=width;this.newHeight=_417e;};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(_412c,color){draw2d.Command.call(this,"set color");this.figure=_412c;this.newColor=color;this.oldColor=_412c.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(_50ed,color){draw2d.Command.call(this,"set background color");this.figure=_50ed;this.newColor=color;this.oldColor=_50ed.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(_436a,_436b,_436c){draw2d.Command.call(this,"create connection");this.workflow=_436a;this.source=_436b;this.target=_436c;this.connection=null;};draw2d.CommandConnect.prototype=new draw2d.Command;draw2d.CommandConnect.prototype.type="CommandConnect";draw2d.CommandConnect.prototype.setConnection=function(_436d){this.connection=_436d;};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,_50f0,_50f1,endX,endY){draw2d.Command.call(this,"move line");this.line=line;this.startX1=_50f0;this.startY1=_50f1;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(_50f4,_50f5,endX,endY){this.startX2=_50f4;this.startY2=_50f5;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(_3f92){this.workflow=_3f92;};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 _3f9a=arguments[0]||window.event;_3f9a.cancelBubble=true;_3f9a.returnValue=false;var diffX=_3f9a.clientX;var diffY=_3f9a.clientY;var _3f9d=document.body.parentNode.scrollLeft;var _3f9e=document.body.parentNode.scrollTop;this.menuItem.execute(diffX+_3f9d,diffY+_3f9e);},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 _3fa4=arguments[0]||window.event;_3fa4.cancelBubble=true;_3fa4.returnValue=false;var diffX=_3fa4.clientX;var diffY=_3fa4.clientY;var _3fa7=document.body.parentNode.scrollLeft;var _3fa8=document.body.parentNode.scrollTop;event.srcElement.menuItem.execute(diffX+_3fa7,diffY+_3fa8);});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,_4034,_4035){this.label=label;this.iconUrl=_4034;this.parentMenu=null;this.action=_4035;};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);};