diff --git a/mindplot/src/test/javascript/lib/core.js b/mindplot/src/test/javascript/lib/core.js new file mode 120000 index 00000000..b52f4cba --- /dev/null +++ b/mindplot/src/test/javascript/lib/core.js @@ -0,0 +1 @@ +../../../../../core-js/target/classes/core.js \ No newline at end of file diff --git a/mindplot/src/test/javascript/jquery-1.8.2.js b/mindplot/src/test/javascript/lib/jquery-1.8.2.js similarity index 100% rename from mindplot/src/test/javascript/jquery-1.8.2.js rename to mindplot/src/test/javascript/lib/jquery-1.8.2.js diff --git a/mindplot/src/test/javascript/lib/web2d.svg-min.js b/mindplot/src/test/javascript/lib/web2d.svg-min.js new file mode 100644 index 00000000..e292dbd8 --- /dev/null +++ b/mindplot/src/test/javascript/lib/web2d.svg-min.js @@ -0,0 +1,762 @@ +var web2d={}; +web2d.peer={svg:{}}; +web2d.peer.utils={};web2d.peer.utils.EventUtils={broadcastChangeEvent:function(elementPeer,type){var listeners=elementPeer.getChangeEventListeners(type); +if($defined(listeners)){for(var i=0; +i"+element +}this._peer.removeChild(element._peer) +},append:function(element){if(!$defined(element)){throw"Child element can not be null" +}if(element==this){throw"It's not posible to add the group as a child of itself" +}var elementType=element.getType(); +if(elementType==null){throw"It seems not to be an element ->"+element +}if(elementType=="Workspace"){throw"A group can not have a workspace as a child" +}this._peer.append(element._peer) +},getType:function(){return"Group" +},setCoordSize:function(width,height){this._peer.setCoordSize(width,height) +},setCoordOrigin:function(x,y){this._peer.setCoordOrigin(x,y) +},getCoordOrigin:function(){return this._peer.getCoordOrigin() +},getSize:function(){return this._peer.getSize() +},setFill:function(color,opacity){throw"Unsupported operation. Fill can not be set to a group" +},setStroke:function(width,style,color,opacity){throw"Unsupported operation. Stroke can not be set to a group" +},getCoordSize:function(){return this._peer.getCoordSize() +},appendDomChild:function(DomElement){if(!$defined(DomElement)){throw"Child element can not be null" +}if(DomElement==this){throw"It's not possible to add the group as a child of itself" +}this._peer._native.append(DomElement) +},setOpacity:function(value){this._peer.setOpacity(value) +}});web2d.Image=new Class({Extends:web2d.Element,initialize:function(attributes){var peer=web2d.peer.Toolkit.createImage(); +this.parent(peer,attributes) +},getType:function(){return"Image" +},setHref:function(href){this._peer.setHref(href) +},getHref:function(){return this._peer.getHref() +},getSize:function(){return this._peer.getSize() +}});web2d.Line=new Class({Extends:web2d.Element,initialize:function(attributes){var peer=web2d.peer.Toolkit.createLine(); +var defaultAttributes={strokeColor:"#495879",strokeWidth:1,strokeOpacity:1}; +for(var key in attributes){defaultAttributes[key]=attributes[key] +}this.parent(peer,defaultAttributes) +},getType:function(){return"Line" +},setFrom:function(x,y){this._peer.setFrom(x,y) +},setTo:function(x,y){this._peer.setTo(x,y) +},getFrom:function(){return this._peer.getFrom() +},getTo:function(){return this._peer.getTo() +},setArrowStyle:function(startStyle,endStyle){this._peer.setArrowStyle(startStyle,endStyle) +},setPosition:function(cx,cy){throw"Unsupported operation" +},setSize:function(width,height){throw"Unsupported operation" +},setFill:function(color,opacity){throw"Unsupported operation" +}});web2d.PolyLine=new Class({Extends:web2d.Element,initialize:function(attributes){var peer=web2d.peer.Toolkit.createPolyLine(); +var defaultAttributes={strokeColor:"blue",strokeWidth:1,strokeStyle:"solid",strokeOpacity:1}; +for(var key in attributes){defaultAttributes[key]=attributes[key] +}this.parent(peer,defaultAttributes) +},getType:function(){return"PolyLine" +},setFrom:function(x,y){this._peer.setFrom(x,y) +},setTo:function(x,y){this._peer.setTo(x,y) +},setStyle:function(style){this._peer.setStyle(style) +},getStyle:function(){return this._peer.getStyle() +},buildCurvedPath:function(dist,x1,y1,x2,y2){var signx=1; +var signy=1; +if(x22){var middlex=x1+((x2-x1>0)?dist:-dist); +path=x1.toFixed(1)+", "+y1.toFixed(1)+" "+middlex.toFixed(1)+", "+y1.toFixed(1)+" "+middlex.toFixed(1)+", "+(y2-5*signy).toFixed(1)+" "+(middlex+5*signx).toFixed(1)+", "+y2.toFixed(1)+" "+x2.toFixed(1)+", "+y2.toFixed(1) +}else{path=x1.toFixed(1)+", "+y1.toFixed(1)+" "+x2.toFixed(1)+", "+y2.toFixed(1) +}return path +},buildStraightPath:function(dist,x1,y1,x2,y2){var middlex=x1+((x2-x1>0)?dist:-dist); +return x1+", "+y1+" "+middlex+", "+y1+" "+middlex+", "+y2+" "+x2+", "+y2 +}});web2d.CurvedLine=new Class({Extends:web2d.Element,initialize:function(attributes){var peer=web2d.peer.Toolkit.createCurvedLine(); +var defaultAttributes={strokeColor:"blue",strokeWidth:1,strokeStyle:"solid",strokeOpacity:1}; +for(var key in attributes){defaultAttributes[key]=attributes[key] +}this.parent(peer,defaultAttributes) +},getType:function(){return"CurvedLine" +},setFrom:function(x,y){$assert(!isNaN(x),"x must be defined"); +$assert(!isNaN(y),"y must be defined"); +this._peer.setFrom(x,y) +},setTo:function(x,y){$assert(!isNaN(x),"x must be defined"); +$assert(!isNaN(y),"y must be defined"); +this._peer.setTo(x,y) +},getFrom:function(){return this._peer.getFrom() +},getTo:function(){return this._peer.getTo() +},setShowEndArrow:function(visible){this._peer.setShowEndArrow(visible) +},isShowEndArrow:function(){return this._peer.isShowEndArrow() +},setShowStartArrow:function(visible){this._peer.setShowStartArrow(visible) +},isShowStartArrow:function(){return this._peer.isShowStartArrow() +},setSrcControlPoint:function(control){this._peer.setSrcControlPoint(control) +},setDestControlPoint:function(control){this._peer.setDestControlPoint(control) +},getControlPoints:function(){return this._peer.getControlPoints() +},isSrcControlPointCustom:function(){return this._peer.isSrcControlPointCustom() +},isDestControlPointCustom:function(){return this._peer.isDestControlPointCustom() +},setIsSrcControlPointCustom:function(isCustom){this._peer.setIsSrcControlPointCustom(isCustom) +},setIsDestControlPointCustom:function(isCustom){this._peer.setIsDestControlPointCustom(isCustom) +},updateLine:function(avoidControlPointFix){return this._peer.updateLine(avoidControlPointFix) +},setStyle:function(style){this._peer.setLineStyle(style) +},getStyle:function(){return this._peer.getLineStyle() +},setDashed:function(length,spacing){this._peer.setDashed(length,spacing) +}}); +web2d.CurvedLine.SIMPLE_LINE=false; +web2d.CurvedLine.NICE_LINE=true;web2d.Arrow=new Class({Extends:web2d.Element,initialize:function(attributes){var peer=web2d.peer.Toolkit.createArrow(); +var defaultAttributes={strokeColor:"black",strokeWidth:1,strokeStyle:"solid",strokeOpacity:1}; +for(var key in attributes){defaultAttributes[key]=attributes[key] +}this.parent(peer,defaultAttributes) +},getType:function(){return"Arrow" +},setFrom:function(x,y){this._peer.setFrom(x,y) +},setControlPoint:function(point){this._peer.setControlPoint(point) +},setStrokeColor:function(color){this._peer.setStrokeColor(color) +},setStrokeWidth:function(width){this._peer.setStrokeWidth(width) +},setDashed:function(isDashed,length,spacing){this._peer.setDashed(isDashed,length,spacing) +}});web2d.Rect=new Class({Extends:web2d.Element,initialize:function(arc,attributes){if(arc&&arc>1){throw"Arc must be 0<=arc<=1" +}if(arguments.length<=0){var rx=0; +var ry=0 +}var peer=web2d.peer.Toolkit.createRect(arc); +var defaultAttributes={width:40,height:40,x:5,y:5,stroke:"1 solid black",fillColor:"green"}; +for(var key in attributes){defaultAttributes[key]=attributes[key] +}this.parent(peer,defaultAttributes) +},getType:function(){return"Rect" +},getSize:function(){return this._peer.getSize() +}});web2d.Text=new Class({Extends:web2d.Element,initialize:function(attributes){var peer=web2d.peer.Toolkit.createText(); +this.parent(peer,attributes) +},getType:function(){return"Text" +},setText:function(text){this._peer.setText(text) +},setTextAlignment:function(align){$assert(align,"align can not be null"); +this._peer.setTextAlignment(align) +},setTextSize:function(width,height){this._peer.setContentSize(width,height) +},getText:function(){return this._peer.getText() +},setFont:function(font,size,style,weight){this._peer.setFont(font,size,style,weight) +},setColor:function(color){this._peer.setColor(color) +},getColor:function(){return this._peer.getColor() +},setStyle:function(style){this._peer.setStyle(style) +},setWeight:function(weight){this._peer.setWeight(weight) +},setFontFamily:function(family){this._peer.setFontFamily(family) +},getFont:function(){return this._peer.getFont() +},setSize:function(size){this._peer.setSize(size) +},getHtmlFontSize:function(){return this._peer.getHtmlFontSize() +},getWidth:function(){return this._peer.getWidth() +},getHeight:function(){return parseInt(this._peer.getHeight()) +},getFontHeight:function(){var lines=this._peer.getText().split("\n").length; +return Math.round(this.getHeight()/lines) +}});web2d.peer.ToolkitSVG={init:function(){},createWorkspace:function(element){return new web2d.peer.svg.WorkspacePeer(element) +},createGroup:function(element){return new web2d.peer.svg.GroupPeer() +},createElipse:function(){return new web2d.peer.svg.ElipsePeer() +},createLine:function(){return new web2d.peer.svg.LinePeer() +},createPolyLine:function(){return new web2d.peer.svg.PolyLinePeer() +},createCurvedLine:function(){return new web2d.peer.svg.CurvedLinePeer() +},createArrow:function(){return new web2d.peer.svg.ArrowPeer() +},createText:function(){return new web2d.peer.svg.TextPeer() +},createImage:function(){return new web2d.peer.svg.ImagePeer() +},createRect:function(arc){return new web2d.peer.svg.RectPeer(arc) +},createArialFont:function(){return new web2d.peer.svg.ArialFont() +},createTimesFont:function(){return new web2d.peer.svg.TimesFont() +},createVerdanaFont:function(){return new web2d.peer.svg.VerdanaFont() +},createTahomaFont:function(){return new web2d.peer.svg.TahomaFont() +}}; +web2d.peer.Toolkit=web2d.peer.ToolkitSVG;web2d.Workspace=new Class({Extends:web2d.Element,initialize:function(attributes){this._htmlContainer=this._createDivContainer(); +var peer=web2d.peer.Toolkit.createWorkspace(this._htmlContainer); +var defaultAttributes={width:"200px",height:"200px",stroke:"1px solid #edf1be",fillColor:"white",coordOrigin:"0 0",coordSize:"200 200"}; +for(var key in attributes){defaultAttributes[key]=attributes[key] +}this.parent(peer,defaultAttributes); +this._htmlContainer.append(this._peer._native) +},getType:function(){return"Workspace" +},append:function(element){if(!$defined(element)){throw"Child element can not be null" +}var elementType=element.getType(); +if(elementType==null){throw"It seems not to be an element ->"+element +}if(elementType=="Workspace"){throw"A workspace can not have a workspace as a child" +}this._peer.append(element._peer) +},addItAsChildTo:function(element){if(!$defined(element)){throw"Workspace div container can not be null" +}element.append(this._htmlContainer) +},_createDivContainer:function(){var container=window.document.createElement("div"); +container.id="workspaceContainer"; +container.style.position="relative"; +container.style.top="0px"; +container.style.left="0px"; +container.style.height="688px"; +container.style.border="1px solid red"; +return $(container) +},setSize:function(width,height){if($defined(width)){this._htmlContainer.css("width",width) +}if($defined(height)){this._htmlContainer.css("height",height) +}this._peer.setSize(width,height) +},setCoordSize:function(width,height){this._peer.setCoordSize(width,height) +},setCoordOrigin:function(x,y){this._peer.setCoordOrigin(x,y) +},getCoordOrigin:function(){return this._peer.getCoordOrigin() +},_getHtmlContainer:function(){return this._htmlContainer +},setFill:function(color,opacity){this._htmlContainer.css("background-color",color); +if(opacity||opacity===0){throw"Unsupported operation. Opacity not supported." +}},getFill:function(){var color=this._htmlContainer.css("background-color"); +return{color:color} +},getSize:function(){var width=this._htmlContainer.css("width"); +var height=this._htmlContainer.css("height"); +return{width:width,height:height} +},setStroke:function(width,style,color,opacity){if(style!="solid"){throw"Not supported style stroke style:"+style +}this._htmlContainer.css("border",width+" "+style+" "+color); +if(opacity||opacity===0){throw"Unsupported operation. Opacity not supported." +}},getCoordSize:function(){return this._peer.getCoordSize() +},removeChild:function(element){if(!$defined(element)){throw"Child element can not be null" +}if(element==this){throw"It's not possible to add the group as a child of itself" +}var elementType=element.getType(); +if(elementType==null){throw"It seems not to be an element ->"+element +}this._peer.removeChild(element._peer) +},dumpNativeChart:function(){var elem=this._htmlContainer; +return elem.innerHTML +}});core.Point=new Class({initialize:function(x,y){this.x=x; +this.y=y +},setValue:function(x,y){this.x=x; +this.y=y +},inspect:function(){return"{x:"+this.x+",y:"+this.y+"}" +},clone:function(){return new core.Point(this.x,this.y) +}}); +core.Point.fromString=function(point){var values=point.split(","); +return new core.Point(values[0],values[1]) +}; \ No newline at end of file