diagram.lib.diagram.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-base Show documentation
Show all versions of common-base Show documentation
DSL based modeling framework - facilities common base
var graph;function queryParameter(t){let e=window.location.search.substring(1).split("&");for(let n=0;n0&&t==e[n].substring(0,s))return e[n].substring(s+1).replace(/%22/g,"")}}function collectBases(t,e,n){let s=t.extends;if(void 0!==s)for(let t of e)if(t.name===s)return n.push(t),void collectBases(t,e,n)}function draw(t,e,n,s,o,a){let l,r,i={},S={},E=n.content;for(let t of E)S[t.name]=t;if(a)for(let t of E)t.name==a&&(l=t,(r=[]).push(t),collectBases(l,E,r));else r=E;let m=[];const T=l?t.insertVertex(e,null,"",0,0,10,10,"virtual"):e,C=l?t.insertVertex(e,null,"",0,0,1e3,1e3,"virtual"):e;for(let n of r){void 0===i[n.name]&&drawObject(t,e,T,C,n,S,i,"object","title",m,!0,void 0!==l,!1)}if(l){let n=null,l=[];for(let t of r){const e=i[t.name];e&&l.push(e),t.name==a&&(n=i[t.name])}s.execute(T),C.geometry.x=T.geometry.x+T.geometry.width+120;for(let n of m)t.insertEdge(e,null,"",n.fromObject,n.to,"virtual");o.execute(C);for(let n of m)t.insertEdge(e,null,"",n.from,n.to,n.style);T.geometry.width=0,T.geometry.height=0,C.geometry.width=0,C.geometry.height=0}else s.execute(e)}function drawObject(t,e,n,s,o,a,l,r,i,S,E,m,T){let C=void 0!==a[o.name];T&&(r="otherObject",i="otherTitle"),C||(r="exObject",i="exTitle");const x=o.name,u=""+x+"",c=mxUtils.getSizeForString(o.name).width;let R=80;c+22>R&&(R=c+22);let d=[];if(void 0!==o.fields)for(let t of o.fields){let e={},n=t.name;if(e.fieldName=n,t.key&&(n=""+n+""),t.composition&&(n=""+n+""),t.cardinality)if("*"==t.cardinality||"1..1"==t.cardinality.trim())e.namePart=n+'*';else{const s=t.cardinality.indexOf("..");if(s>0){const o=t.cardinality.substring(0,s);if(o.length>0&&!isNaN(o)&&Number(o)>0){const a=t.cardinality.substring(s);e.namePart=n+'['+o+""+a+"]"}else e.namePart=n+"["+t.cardinality+"]"}else e.namePart=n+"["+t.cardinality+"]"}else t.key?e.namePart=n+'*':e.namePart=n;t.type?e.typePart=t.type:t.composition?(e.typePart=""+t.composition+"",e.association=!0):t.aggregation&&(e.typePart=t.aggregation,e.association=!0,e.reference=!0),(m||!0!==e.association)&&(e.namePart=e.namePart+":"),e.nameWidth=mxUtils.getSizeForString(e.namePart).width,e.typeWidth=mxUtils.getSizeForString(e.typePart).width;let s=80;m||!0!==e.association?s=e.nameWidth+e.typeWidth+20:(e.nameWidth=e.nameWidth+5,s=e.nameWidth+e.typeWidth+40),d.push(e),R