123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- {
- "types": {
- "$*": [],
- "Annotation": [
- {
- "name": "text",
- "type": "code",
- "default": "Your Annotation Text"
- },
- {
- "name": "position",
- "type": "list<int>",
- "default": "[0,0]"
- },
- {
- "name": "textStyle",
- "type": "map<string,string>",
- "default": {
- "stroke": "#000000",
- "stroke-dasharray": "",
- "fill": "#000000",
- "fill-opacity": 0,
- "font-size": "17px",
- "stroke-width": 1,
- "arrow-start": "none",
- "arrow-end": "none",
- "font-family": "Courier New"
- }
- }
- ],
- "annotates": [],
- "TextAnnotationBox": [
- {
- "name": "width",
- "type": "double",
- "default": 100
- },
- {
- "name": "height",
- "type": "double",
- "default": 100
- },
- {
- "name": "style",
- "type": "map<string, string>",
- "default": {
- "stroke": "#04B404",
- "stroke-dasharray": "",
- "fill": "#F2F2F2",
- "fill-opacity": 0.75,
- "font-size": "20px",
- "stroke-width": 2.5,
- "arrow-start": "none",
- "arrow-end": "none"
- }
- },
- {
- "name": "text",
- "type": "code",
- "default": "Your Annotation Text"
- },
- {
- "name": "position",
- "type": "list<int>",
- "default": "[0,0]"
- },
- {
- "name": "textStyle",
- "type": "map<string,string>",
- "default": {
- "stroke": "#000000",
- "stroke-dasharray": "",
- "fill": "#000000",
- "fill-opacity": 0,
- "font-size": "17px",
- "stroke-width": 1,
- "arrow-start": "none",
- "arrow-end": "none",
- "font-family": "Courier New"
- }
- }
- ],
- "TextAnnotationRound": [
- {
- "name": "r",
- "type": "double",
- "default": 50
- },
- {
- "name": "style",
- "type": "map<int,int>",
- "default": {
- "stroke": "#04B404",
- "stroke-dasharray": "",
- "fill": "#F2F2F2",
- "fill-opacity": 0.75,
- "font-size": "20px",
- "stroke-width": 2.5,
- "arrow-start": "none",
- "arrow-end": "none"
- }
- },
- {
- "name": "text",
- "type": "code",
- "default": "Your Annotation Text"
- },
- {
- "name": "position",
- "type": "list<int>",
- "default": "[0,0]"
- },
- {
- "name": "textStyle",
- "type": "map<string,string>",
- "default": {
- "stroke": "#000000",
- "stroke-dasharray": "",
- "fill": "#000000",
- "fill-opacity": 0,
- "font-size": "17px",
- "stroke-width": 1,
- "arrow-start": "none",
- "arrow-end": "none",
- "font-family": "Courier New"
- }
- }
- ],
- "TextAnnotationRoundedBox": [
- {
- "name": "width",
- "type": "double",
- "default": 100
- },
- {
- "name": "height",
- "type": "int",
- "default": 100
- },
- {
- "name": "style",
- "type": "map<int,int>",
- "default": {
- "stroke": "#04B404",
- "stroke-dasharray": "",
- "fill": "#F2F2F2",
- "fill-opacity": 0.75,
- "font-size": "20px",
- "stroke-width": 2.5,
- "arrow-start": "none",
- "arrow-end": "none"
- }
- },
- {
- "name": "text",
- "type": "code",
- "default": "Your Annotation Text"
- },
- {
- "name": "position",
- "type": "list<int>",
- "default": "[0,0]"
- },
- {
- "name": "textStyle",
- "type": "map<string,string>",
- "default": {
- "stroke": "#000000",
- "stroke-dasharray": "",
- "fill": "#000000",
- "fill-opacity": 0,
- "font-size": "17px",
- "stroke-width": 1,
- "arrow-start": "none",
- "arrow-end": "none",
- "font-family": "Courier New"
- }
- }
- ]
- },
- "constraints": [],
- "actions": [
- {
- "name": "resizeToText",
- "event": "post-edit",
- "code": "/*newline*/var text = getAttr('text').replace(/\\n/g, ' '), /*newline*/ strLen = text.length, /*newline*/ fontSize = getAttr('textStyle')['font-size'], /*newline*/ strPix = parseInt(fontSize.substring(0,fontSize.indexOf('p'))), /*newline*/ strWidth = strPix * strLen; /*newline*/if (strWidth > 0) { /*newline*/ var strLenSqrt = Math.ceil(Math.sqrt(strLen)), /*newline*/ i = strLenSqrt, /*newline*/ oldIdx = 0, /*newline*/ longestLine = strLenSqrt, /*newline*/ nrOfLines = 0; /*newline*/ while (i < strLen) { /*newline*/ var idx = text.indexOf(' ', i); /*newline*/ if (idx > -1) { /*newline*/ text = text.slice(0,idx) + '\\n' + text.slice(idx).replace(/^ /g, ''); /*newline*/ if (idx - oldIdx > longestLine) { /*newline*/ longestLine = idx - oldIdx /*newline*/ } /*newline*/ i = idx + strLenSqrt; /*newline*/ oldIdx = idx; /*newline*/ nrOfLines += 1; /*newline*/ } else { /*newline*/ i = strLen; /*newline*/ } /*newline*/ } /*newline*/ setAttr('text', text); /*newline*/ var width = longestLine * (strPix - 5) + 35; /*newline*/ setAttr('width', width); /*newline*/ setAttr('height', (nrOfLines * (strPix + 5)) + 40); /*newline*/}",
- "targetType": "TextAnnotationBox"
- },
- {
- "name": "",
- "event": "ENUM( pre-connect , pre-create , pre-disconnect , pre-delete , pre-edit , post-connect , post-create , post-disconnect , post-delete , post-edit )",
- "code": "",
- "targetType": "TextAnnotationBox"
- },
- {
- "name": "resizeToText",
- "event": "post-edit",
- "code": "/*newline*/var text = getAttr('text').replace(/\\n/g, ' '), /*newline*/ strLen = text.length, /*newline*/ fontSize = getAttr('textStyle')['font-size'], /*newline*/ strPix = parseInt(fontSize.substring(0,fontSize.indexOf('p'))), /*newline*/ strWidth = strPix * strLen; /*newline*/if (strWidth > 0) { /*newline*/ var strLenSqrt = Math.ceil(Math.sqrt(strLen)), /*newline*/ i = strLenSqrt; /*newline*/ while (i < strLen) { /*newline*/ var idx = text.indexOf(' ', i); /*newline*/ if (idx > -1) { /*newline*/ text = text.slice(0,idx) + '\\n' + text.slice(idx).replace(/^ /g, ''); /*newline*/ i = idx + strLenSqrt; /*newline*/ } else { /*newline*/ i = strLen; /*newline*/ } /*newline*/ } /*newline*/ setAttr('text', text); /*newline*/ var width = strLenSqrt * (strPix - 5) + 35; /*newline*/ setAttr('r', width / 2); /*newline*/}",
- "targetType": "TextAnnotationRound"
- },
- {
- "name": "resizeToText",
- "event": "post-edit",
- "code": "/*newline*/var text = getAttr('text').replace(/\\n/g, ' '), /*newline*/ strLen = text.length, /*newline*/ fontSize = getAttr('textStyle')['font-size'], /*newline*/ strPix = parseInt(fontSize.substring(0,fontSize.indexOf('p'))), /*newline*/ strWidth = strPix * strLen; /*newline*/if (strWidth > 0) { /*newline*/ var strLenSqrt = Math.ceil(Math.sqrt(strLen)), /*newline*/ i = strLenSqrt, /*newline*/ oldIdx = 0, /*newline*/ longestLine = strLenSqrt, /*newline*/ nrOfLines = 0; /*newline*/ while (i < strLen) { /*newline*/ var idx = text.indexOf(' ', i); /*newline*/ if (idx > -1) { /*newline*/ text = text.slice(0,idx) + '\\n' + text.slice(idx).replace(/^ /g, ''); /*newline*/ if (idx - oldIdx > longestLine) { /*newline*/ longestLine = idx - oldIdx /*newline*/ } /*newline*/ i = idx + strLenSqrt; /*newline*/ oldIdx = idx; /*newline*/ nrOfLines += 1; /*newline*/ } else { /*newline*/ i = strLen; /*newline*/ } /*newline*/ } /*newline*/ setAttr('text', text); /*newline*/ var width = longestLine * (strPix - 5) + 35; /*newline*/ setAttr('width', width); /*newline*/ setAttr('height', nrOfLines * (strPix + 5) + 40); /*newline*/}",
- "targetType": "TextAnnotationRoundedBox"
- }
- ],
- "cardinalities": {
- "$*": [
- {
- "dir": "in",
- "type": "annotates",
- "min": "0",
- "max": "Infinity"
- }
- ],
- "Annotation": [
- {
- "dir": "out",
- "type": "annotates",
- "min": "0",
- "max": "Infinity"
- }
- ],
- "annotates": [
- {
- "dir": "in",
- "type": "Annotation",
- "min": "0",
- "max": "1"
- },
- {
- "dir": "out",
- "type": "$*",
- "min": "0",
- "max": "1"
- },
- {
- "dir": "in",
- "type": "TextAnnotationBox",
- "min": "0",
- "max": "1"
- },
- {
- "dir": "in",
- "type": "TextAnnotationRound",
- "min": "0",
- "max": "1"
- },
- {
- "dir": "in",
- "type": "TextAnnotationRoundedBox",
- "min": "0",
- "max": "1"
- }
- ],
- "TextAnnotationBox": [
- {
- "dir": "out",
- "type": "annotates",
- "min": "0",
- "max": "Infinity"
- }
- ],
- "TextAnnotationRound": [
- {
- "dir": "out",
- "type": "annotates",
- "min": "0",
- "max": "Infinity"
- }
- ],
- "TextAnnotationRoundedBox": [
- {
- "dir": "out",
- "type": "annotates",
- "min": "0",
- "max": "Infinity"
- }
- ]
- },
- "legalConnections": {
- "Annotation": {
- "$*": [
- "annotates"
- ]
- },
- "TextAnnotationBox": {
- "$*": [
- "annotates"
- ]
- },
- "TextAnnotationRound": {
- "$*": [
- "annotates"
- ]
- },
- "TextAnnotationRoundedBox": {
- "$*": [
- "annotates"
- ]
- }
- },
- "connectorTypes": {
- "annotates": "visual"
- },
- "types2parentTypes": {
- "$*": [],
- "Annotation": [],
- "annotates": [],
- "TextAnnotationBox": [
- "Annotation"
- ],
- "TextAnnotationRound": [
- "Annotation"
- ],
- "TextAnnotationRoundedBox": [
- "Annotation"
- ]
- }
- }
|