All Downloads are FREE. Search and download functionalities are using the official Maven repository.

diagram.lib.diagram.min.js Maven / Gradle / Ivy

There is a newer version: 1.3.51
Show newest version
var graph;function queryParameter(e){var n=window.location.search.substring(1).split("&");for(let t=0;t"+u+"",R=mxUtils.getSizeForString(a.name).width;let c=80;R+22>c&&(c=R+22);var d=[];if(void 0!==a.fields)for(var _ of a.fields){var L,p,O={};let t=_.name,e=(O.fieldName=t,_.key&&(t=""+t+""),_.composition&&(t=""+t+""),_.cardinality?"*"==_.cardinality||"1..1"==_.cardinality.trim()?O.namePart=t+'*':0<(p=_.cardinality.indexOf(".."))&&0<(L=_.cardinality.substring(0,p)).length&&!isNaN(L)&&0'+L+""+p+"]"):O.namePart=t+"["+_.cardinality+"]":_.key?O.namePart=t+'*':O.namePart=t,_.type?O.typePart=_.type:_.composition?(O.typePart=_.composition,O.association=!0):_.aggregation&&(O.typePart=_.aggregation,O.association=!0,O.reference=!0),_.namespace&&(O.namespace=_.namespace),!m&&!0===O.association||(O.namePart=O.namePart+":"),O.nameWidth=mxUtils.getSizeForString(O.namePart).width,O.typeWidth=mxUtils.getSizeForString(O.typePart).width,80);e=m||!0!==O.association?O.nameWidth+O.typeWidth+20:(O.nameWidth=O.nameWidth+5,O.nameWidth+O.typeWidth+40),d.push(O),c"+Y.typePart+""):N.setAttribute("label",Y.typePart),m||!0!==Y.association||(N.setAttribute("queryParameter",Y.typePart),Y.namespace&&N.setAttribute("queryParameterNamespace",Y.namespace)),n.insertVertex(I,null,N,t,0,g-t,20,"propertyDetail"));f.push(N),m||!0!==Y.association||(!0===Y.reference?(Y=n.insertEdge(h,null,"",v,N,"reference"),f.push(Y)):(Y=n.insertEdge(h,null,"",v,N,"containment"),f.push(Y))),f.push(I),e++}l=n.insertVertex(h,null,"",0,28+20*e+14,0,0);f.push(l)}return h.geometry.size=new mxPoint(100,200),n.groupCells(h,0,f),drawBaseObject(n,t,e,s,a,r[a.name]=h,o,r,S,E,m,T),m&&void 0!==a.fields&&drawRelatedObjects(n,t,e,s,a,h,o,r,S,m,T),h}function drawBaseObject(n,s,a,o,r,t,l,i,S,E,m){if(void 0!==r.extends){let e=i[r.extends];if(void 0===e){let t=l[r.extends];void 0===t&&((t={}).name=r.extends),e=drawObject(n,s,a,o,t,l,i,"object","title",S,E,m)}void 0!==t&&void 0!==e&&(m?n.insertEdge(s,null,"",e,t,"otherSpecialize"):n.insertEdge(s,null,"",e,t,"specialize"))}}function drawRelatedObjects(n,s,a,o,t,e,r,l,i,S,E){var m,T,C,u=new Set;let x=0;for(m of t.fields){x+=1;let e=m.composition;if(void 0!==(e=void 0===e?m.aggregation:e)){let t=l[e];void 0!==(t=void 0===t&&void 0!==(T=r[e])?drawObject(n,s,a,o,T,r,l,"otherObject","otherTitle",i,!1,!0,!0):t)&&((T={}).vType=t,T.index=x,T.reference=void 0!==m.aggregation,T.isOther=E,u.add(T))}}for(C of u){var R=25+20*C.index,c=n.insertVertex(e,null,"",1,0,0,0);c.geometry.offset=new mxPoint(0,R),c.geometry.relative=!0;let t="composition";1==C.reference&&(t="aggregation"),E&&(t="other_"+t);R={};R.fromObject=e,R.from=c,R.to=C.vType,R.style=t,i.push(R)}}function downloadSVG(t,e){var n="#ffffff",s=new mxImageExport,a=t.getGraphBounds(),o=t.view.scale,r=mxUtils.createXmlDocument(),l=null!=r.createElementNS?r.createElementNS(mxConstants.NS_SVG,"svg"):r.createElement("svg"),n=(null!=l.style?l.style.backgroundColor=n:l.setAttribute("style","background-color:"+n),null==r.createElementNS?(l.setAttribute("xmlns",mxConstants.NS_SVG),l.setAttribute("xmlns:xlink",mxConstants.NS_XLINK)):l.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",mxConstants.NS_XLINK),l.setAttribute("width",Math.ceil(+a.width/o)+2+"px"),l.setAttribute("height",Math.ceil(+a.height/o)+2+"px"),l.setAttribute("version","1.1"),null!=r.createElementNS?r.createElementNS(mxConstants.NS_SVG,"g"):r.createElement("g")),r=(n.setAttribute("transform","translate(0.5,0.5)"),l.appendChild(n),r.appendChild(l),new mxSvgCanvas2D(n));r.translate(Math.floor((1-a.x)/o),Math.floor((1-a.y)/o)),r.scale(1/o),r.foAltText="[Not supported by viewer]",s.drawState(t.getView().getState(t.model.root),r),save(e,mxUtils.getPrettyXml(l))}function save(t,e){var n,e=new Blob([e],{type:"image/svg"});window.navigator.msSaveOrOpenBlob?window.navigator.msSaveBlob(e,t):((n=window.document.createElement("a")).href=window.URL.createObjectURL(e,{oneTimeOnly:!0}),n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n))}function main(t){if(mxClient.isBrowserSupported()){mxEvent.disableContextMenu(t),mxConstants.VERTEX_SELECTION_COLOR="#2e7570",mxConstants.VERTEX_SELECTION_STROKEWIDTH=3,mxConstants.VERTEX_SELECTION_DASHED=!1,mxGraph.prototype.isHtmlLabel=function(t){return!0},mxGraph.prototype.addListener(mxEvent.CLICK,function(t,e){var n=e.getProperty("cell");if(void 0!==n){var s=n.getAttribute("queryParameter");if(void 0!==s){var a,n=n.getAttribute("queryParameterNamespace");let t=location.protocol+"//"+location.host+location.pathname;n&&(a=t.lastIndexOf("/"))&&(t=t.substring(0,a+1)+n+"_cmn.html"),window.location.href=t+"?focused="+s,e.consume()}}}),mxGraph.prototype.getCursorForCell=function(t){if(void 0!==t&&null!=t.getAttribute("queryParameter"))return"pointer"};let s=function(t){t=t.parent;return null!=t?void 0!==t.getAttribute("isClass")?t:s(t):null},a=mxGraphHandler.prototype.getInitialCellForEvent,o=(mxGraphHandler.prototype.getInitialCellForEvent=function(t){let e=a.apply(this,arguments);var n=s(e);return e=null!=n?n:e},new mxGraph(t));o.foldingEnabled=!1;function r(t,e){e&&(t.style[mxConstants.STYLE_FONTCOLOR]="#529aba")}o.addMouseListener({currentState:null,previousStyle:null,mouseDown:function(t,e){null!=this.currentState&&(this.dragLeave(e.getEvent(),this.currentState),this.currentState=null)},mouseMove:function(t,e){if(null==this.currentState||e.getState()!=this.currentState){let t=o.view.getState(e.getCell());var n;(t=!o.isMouseDown&&(null==t||o.getModel().isVertex(t.cell)&&null!=(n=t.cell)&&null!=n.getAttribute("queryParameter"))?t:null)!=this.currentState&&(null!=this.currentState&&this.dragLeave(e.getEvent(),this.currentState),this.currentState=t,null!=this.currentState)&&this.dragEnter(e.getEvent(),this.currentState)}},mouseUp:function(t,e){},dragEnter:function(t,e){null!=e&&(this.previousStyle=e.style,e.style=mxUtils.clone(e.style),r(e,!0),e.shape.apply(e),e.shape.redraw(),null!=e.text)&&(e.text.apply(e),e.text.redraw())},dragLeave:function(t,e){null!=e&&(e.style=this.previousStyle,r(e,!1),e.shape.apply(e),e.shape.redraw(),null!=e.text)&&(e.text.apply(e),e.text.redraw())}}),o.isPart=function(t){return null!=s(t)},o.convertValueToString=function(t){var e=t.getAttribute("label");return void 0!==e?e:t.value},o.selectCellForEvent=function(t,e){var n=s(t);null!=n&&(t=n),mxGraph.prototype.selectCellForEvent.apply(this,arguments)},o.isCellMovable=function(t){return void 0!==t.getAttribute("isClass")},o.border=80,o.getView().translate=new mxPoint(o.border/2,o.border/2),new mxRubberband(o);var l=o.getStylesheet().getDefaultVertexStyle(),l=(l[mxConstants.STYLE_PERIMETER_SPACING]=6,l[mxConstants.STYLE_STROKEWIDTH]=0,l[mxConstants.STYLE_STROKECOLOR]="#497f81",l[mxConstants.STYLE_RESIZABLE]=0,l[mxConstants.STYLE_FILLCOLOR]="none",l[mxConstants.STYLE_FOLDABLE]=0,(l=[])[mxConstants.STYLE_STROKEWIDTH]=2,l[mxConstants.STYLE_ROUNDED]=!0,l[mxConstants.STYLE_ARCSIZE]=1,l[mxConstants.STYLE_STROKECOLOR]="#599a9d",o.getStylesheet().putCellStyle("object",l),(l=[])[mxConstants.STYLE_STROKEWIDTH]=1,l[mxConstants.STYLE_STROKECOLOR]="#717171",o.getStylesheet().putCellStyle("exObject",l),(l=[])[mxConstants.STYLE_STROKEWIDTH]=2,l[mxConstants.STYLE_STROKECOLOR]="#599a9d",l[mxConstants.STYLE_ROUNDED]=!0,l[mxConstants.STYLE_ARCSIZE]=1,o.getStylesheet().putCellStyle("otherObject",l),(l=[])[mxConstants.STYLE_FONTCOLOR]="#427375",l[mxConstants.STYLE_STROKEWIDTH]=0,l[mxConstants.STYLE_STROKECOLOR]="#599a9d",o.getStylesheet().putCellStyle("title",l),(l=[])[mxConstants.STYLE_FONTCOLOR]="#575757",l[mxConstants.STYLE_STROKE_OPACITY]=0,o.getStylesheet().putCellStyle("exTitle",l),(l=[])[mxConstants.STYLE_FONTCOLOR]="#427375",l[mxConstants.STYLE_STROKEWIDTH]=0,l[mxConstants.STYLE_STROKECOLOR]="#599a9d",o.getStylesheet().putCellStyle("otherTitle",l),(l=[])[mxConstants.STYLE_FONTCOLOR]="#575757",l[mxConstants.STYLE_STROKEWIDTH]=0,l[mxConstants.STYLE_STROKE_OPACITY]=0,l[mxConstants.STYLE_ALIGN]="left",l[mxConstants.STYLE_PERIMETER_SPACING]=1,o.getStylesheet().putCellStyle("property",l),(l=[])[mxConstants.STYLE_FONTCOLOR]="#575757",l[mxConstants.STYLE_STROKE_OPACITY]=0,l[mxConstants.STYLE_ALIGN]="left",l[mxConstants.STYLE_PERIMETER_SPACING]=1,o.getStylesheet().putCellStyle("propertyDetail",l),(l=o.getStylesheet().getDefaultEdgeStyle())[mxConstants.STYLE_STROKECOLOR]="rgb(81,108,180)",l[mxConstants.STYLE_ROUNDED]=!0,(l=[])[mxConstants.STYLE_STROKE_OPACITY]=100,l[mxConstants.STYLE_STROKEWIDTH]=1,l[mxConstants.STYLE_SOURCE_PERIMETER_SPACING]=-5,l[mxConstants.STYLE_STARTFILL]=0,l[mxConstants.STYLE_STARTSIZE]=9,l[mxConstants.STYLE_ROUNDED]=!0,l[mxConstants.STYLE_STARTARROW]=mxConstants.ARROW_BLOCK,l[mxConstants.STYLE_ENDARROW]=mxConstants.NONE,o.getStylesheet().putCellStyle("specialize",l),(l=[])[mxConstants.STYLE_STROKE_OPACITY]=100,l[mxConstants.STYLE_STROKEWIDTH]=1,l[mxConstants.STYLE_SOURCE_PERIMETER_SPACING]=-5,l[mxConstants.STYLE_STARTFILL]=0,l[mxConstants.STYLE_STARTSIZE]=9,l[mxConstants.STYLE_ROUNDED]=!0,l[mxConstants.STYLE_STARTARROW]=mxConstants.ARROW_BLOCK,l[mxConstants.STYLE_ENDARROW]=mxConstants.NONE,o.getStylesheet().putCellStyle("otherSpecialize",l),(l=[])[mxConstants.STYLE_ENDARROW]=mxConstants.ARROW_CLASSIC,l[mxConstants.STYLE_STARTFILL]=0,l[mxConstants.STYLE_STARTSIZE]=4,l[mxConstants.STYLE_ENDSIZE]=3,l[mxConstants.STYLE_TARGET_PERIMETER_SPACING]=2,l[mxConstants.STYLE_SOURCE_PERIMETER_SPACING]=0,l[mxConstants.STYLE_STARTARROW]=mxConstants.NONE,l[mxConstants.STYLE_STARTARROW]=mxConstants.ARROW_DIAMOND,o.getStylesheet().putCellStyle("reference",l),(l=[])[mxConstants.STYLE_ENDARROW]=mxConstants.ARROW_CLASSIC,l[mxConstants.STYLE_STARTFILL]=1,l[mxConstants.STYLE_STARTSIZE]=4,l[mxConstants.STYLE_ENDSIZE]=3,l[mxConstants.STYLE_TARGET_PERIMETER_SPACING]=2,l[mxConstants.STYLE_SOURCE_PERIMETER_SPACING]=0,l[mxConstants.STYLE_STARTARROW]=mxConstants.NONE,l[mxConstants.STYLE_STARTARROW]=mxConstants.ARROW_DIAMOND,o.getStylesheet().putCellStyle("containment",l),(l=[])[mxConstants.STYLE_ENDARROW]=mxConstants.ARROW_CLASSIC,l[mxConstants.STYLE_STARTFILL]=0,l[mxConstants.STYLE_STARTSIZE]=7,l[mxConstants.STYLE_ENDSIZE]=6,l[mxConstants.STYLE_TARGET_PERIMETER_SPACING]=0,l[mxConstants.STYLE_SOURCE_PERIMETER_SPACING]=-7,l[mxConstants.STYLE_STARTARROW]=mxConstants.ARROW_DIAMOND,l[mxConstants.STYLE_EDGE]=mxEdgeStyle.EntityRelation,o.getStylesheet().putCellStyle("aggregation",l),(l=[])[mxConstants.STYLE_STROKEWIDTH]=0,l[mxConstants.STYLE_STROKE_OPACITY]=0,l[mxConstants.STYLE_STARTARROW]=mxConstants.NONE,l[mxConstants.STYLE_ENDARROW]=mxConstants.NONE,l[mxConstants.STYLE_EDGE]=mxEdgeStyle.EntityRelation,o.getStylesheet().putCellStyle("virtual",l),(l=[])[mxConstants.STYLE_ENDARROW]=mxConstants.ARROW_CLASSIC,l[mxConstants.STYLE_STARTSIZE]=7,l[mxConstants.STYLE_ENDSIZE]=6,l[mxConstants.STYLE_TARGET_PERIMETER_SPACING]=0,l[mxConstants.STYLE_SOURCE_PERIMETER_SPACING]=-7,l[mxConstants.STYLE_STARTARROW]=mxConstants.ARROW_DIAMOND,l[mxConstants.STYLE_EDGE]=mxEdgeStyle.EntityRelation,o.getStylesheet().putCellStyle("composition",l),(l=[])[mxConstants.STYLE_ENDARROW]=mxConstants.ARROW_CLASSIC,l[mxConstants.STYLE_STARTFILL]=0,l[mxConstants.STYLE_STARTSIZE]=7,l[mxConstants.STYLE_ENDSIZE]=6,l[mxConstants.STYLE_TARGET_PERIMETER_SPACING]=0,l[mxConstants.STYLE_SOURCE_PERIMETER_SPACING]=-7,l[mxConstants.STYLE_STARTARROW]=mxConstants.ARROW_DIAMOND,l[mxConstants.STYLE_EDGE]=mxEdgeStyle.EntityRelation,o.getStylesheet().putCellStyle("other_aggregation",l),(l=[])[mxConstants.STYLE_ENDARROW]=mxConstants.ARROW_CLASSIC,l[mxConstants.STYLE_STARTSIZE]=7,l[mxConstants.STYLE_ENDSIZE]=6,l[mxConstants.STYLE_TARGET_PERIMETER_SPACING]=0,l[mxConstants.STYLE_SOURCE_PERIMETER_SPACING]=-7,l[mxConstants.STYLE_STARTARROW]=mxConstants.ARROW_DIAMOND,l[mxConstants.STYLE_EDGE]=mxEdgeStyle.EntityRelation,o.getStylesheet().putCellStyle("other_composition",l),o.getDefaultParent());let e=queryParameter("focused");var i=new mxHierarchicalLayout(o,mxConstants.DIRECTION_NORTH),S=(i.edgeStyle=4,i.intraCellSpacing=100,i.interHierarchySpacing=100,i.maintainParentLocation=!0,i.parent=l,new mxHierarchicalLayout(o,mxConstants.DIRECTION_WEST));S.forceConstant=230,S.maintainParentLocation=!1,S.edgeRouting=!0,e&&(S.isVertexMoveable=function(t){t=t.getAttribute("rootOfFocus");return t&&"false"==t});let n=createDiagramData();var E=document.getElementById("titleLink"),E=(E&&(E.onclick=function(){let t=n.namespace.toLowerCase();e&&(t+="-"+e),downloadSVG(o,t+".svg")}),document.getElementById("processesLink")),E=(E&&(E.onclick=function(){window.location.href=n.applicationNamespace+"_"+n.applicationName.toLowerCase()+".html"}),document.getElementById("componentsLink"));E&&(E.onclick=function(){window.location.href=n.applicationNamespace+"_"+n.applicationName.toLowerCase()+"_components.html"}),o.border=30,o.getModel().beginUpdate();try{draw(o,l,n,i,S,e)}finally{o.getModel().endUpdate()}mxClient.IS_QUIRKS&&(document.body.style.overflow="hidden",new mxDivResizer(t))}else mxUtils.error("Browser is not supported!",200,!1)}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy