mxBpmnShape2.js 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603
  1. /**
  2. * Copyright (c) 2006-2010, JGraph Holdings Ltd
  3. */
  4. /**
  5. * Class: mxBpmnShape (DEPRECATED)
  6. *
  7. * Extends <mxShape> to implement an cylinder shape. If a
  8. * custom shape with one filled area and an overlay path is
  9. * needed, then this shape's <redrawPath> should be overridden.
  10. * This shape is registered under <mxConstants.SHAPE_CYLINDER>
  11. * in <mxCellRenderer>.
  12. *
  13. * Constructor: mxBpmnShape
  14. *
  15. * Constructs a new cylinder shape.
  16. *
  17. * Parameters:
  18. *
  19. * bounds - <mxRectangle> that defines the bounds. This is stored in
  20. * <mxShape.bounds>.
  21. * fill - String that defines the fill color. This is stored in <fill>.
  22. * stroke - String that defines the stroke color. This is stored in <stroke>.
  23. * strokewidth - Optional integer that defines the stroke width. Default is
  24. * 1. This is stored in <strokewidth>.
  25. */
  26. function mxBpmnShape(bounds, fill, stroke, strokewidth)
  27. {
  28. mxShape.call(this);
  29. this.bounds = bounds;
  30. this.fill = fill;
  31. this.stroke = stroke;
  32. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  33. };
  34. /**
  35. * Extends mxShape.
  36. */
  37. mxUtils.extend(mxBpmnShape, mxShape);
  38. mxBpmnShape.prototype.customProperties = [
  39. {name: 'symbol', dispName: 'Event', type: 'enum', defVal:'general',
  40. enumList: [{val: 'general', dispName: 'General'},
  41. {val: 'message', dispName: 'Message'},
  42. {val: 'timer', dispName: 'Timer'},
  43. {val: 'escalation', dispName: 'Escalation'},
  44. {val: 'conditional', dispName: 'Conditional'},
  45. {val: 'link', dispName: 'Link'},
  46. {val: 'error', dispName: 'Error'},
  47. {val: 'cancel', dispName: 'Cancel'},
  48. {val: 'compensation', dispName: 'Compensation'},
  49. {val: 'signal', dispName: 'Signal'},
  50. {val: 'multiple', dispName: 'Multiple'},
  51. {val: 'parallelMultiple', dispName: 'Parallel Multiple'},
  52. {val: 'terminate', dispName: 'Terminate'},
  53. {val: 'exclusiveGw', dispName: 'Exclusive Gw'},
  54. {val: 'parallelGw', dispName: 'Parallel Gw'},
  55. {val: 'complexGw', dispName: 'Complex Gw'}]
  56. },
  57. {name: 'outline', dispName: 'Event Type', type: 'enum', defVal:'standard',
  58. enumList: [{val: 'standard', dispName: 'Standard'},
  59. {val: 'eventInt', dispName: 'Interrupting'},
  60. {val: 'eventNonint', dispName: 'Non-Interrupting'},
  61. {val: 'catching', dispName: 'Catching'},
  62. {val: 'boundInt', dispName: 'Bound Interrupting'},
  63. {val: 'boundNonint', dispName: 'Bound Non-Interrupting'},
  64. {val: 'throwing', dispName: 'Throwing'},
  65. {val: 'end', dispName: 'End'},
  66. {val: 'none', dispName: 'None'}]
  67. },
  68. {name: 'background', dispName: 'Background', type: 'enum', defVal:'none',
  69. enumList: [{val: 'gateway', dispName: 'Gateway'},
  70. {val: 'none', dispName: 'None'}]
  71. }];
  72. mxBpmnShape.prototype.eventTypeEnum = {
  73. START_STANDARD : 'standard',
  74. EVENT_SP_INT : 'eventInt',
  75. EVENT_SP_NONINT : 'eventNonint',
  76. CATCHING : 'catching',
  77. BOUND_INT : 'boundInt',
  78. BOUND_NONINT : 'boundNonint',
  79. THROWING : 'throwing',
  80. END : 'end',
  81. NONE : 'none',
  82. GATEWAY : 'gateway'};
  83. mxBpmnShape.prototype.eventEnum = {
  84. GENERAL : 'general',
  85. MESSAGE : 'message',
  86. TIMER : 'timer',
  87. ESCALATION : 'escalation',
  88. CONDITIONAL : 'conditional',
  89. LINK : 'link',
  90. ERROR : 'error',
  91. CANCEL : 'cancel',
  92. COMPENSATION : 'compensation',
  93. SIGNAL : 'signal',
  94. MULTIPLE : 'multiple',
  95. PAR_MULTI : 'parallelMultiple',
  96. TERMINATE : 'terminate',
  97. GW_EXCLUSIVE : 'exclusiveGw',
  98. GW_PARALLEL : 'parallelGw',
  99. GW_COMPLEX : 'complexGw'};
  100. mxBpmnShape.prototype.miscEnum = {
  101. OUTLINE : 'outline',
  102. BACKGROUND : 'background',
  103. SYMBOL : 'symbol',
  104. GATEWAY : 'gateway'};
  105. /**
  106. * Function: paintVertexShape
  107. *
  108. * Paints the vertex shape.
  109. */
  110. mxBpmnShape.prototype.paintVertexShape = function(c, x, y, w, h)
  111. {
  112. this.redrawPath(c, x, y, w, h, mxBpmnShape.prototype.miscEnum.BACKGROUND);
  113. var bg = mxUtils.getValue(this.style, mxBpmnShape.prototype.miscEnum.BACKGROUND, mxBpmnShape.prototype.eventTypeEnum.NONE);
  114. if (bg === mxBpmnShape.prototype.eventTypeEnum.GATEWAY)
  115. {
  116. c.setShadow(false);
  117. }
  118. this.redrawPath(c, x, y, w, h, mxBpmnShape.prototype.miscEnum.OUTLINE);
  119. this.redrawPath(c, x, y, w, h, mxBpmnShape.prototype.miscEnum.SYMBOL);
  120. }
  121. /**
  122. * Function: redrawPath
  123. *
  124. * Draws the path for this shape.
  125. */
  126. mxBpmnShape.prototype.redrawPath = function(c, x, y, w, h, layer)
  127. {
  128. var bg = mxUtils.getValue(this.style, mxBpmnShape.prototype.miscEnum.BACKGROUND, mxBpmnShape.prototype.eventTypeEnum.NONE);
  129. if (layer == mxBpmnShape.prototype.miscEnum.BACKGROUND)
  130. {
  131. if (bg != null)
  132. {
  133. var f = this.backgrounds[bg];
  134. if (f != null)
  135. {
  136. c.translate(x, y);
  137. f.call(this, c, x, y, w, h, layer);
  138. }
  139. }
  140. }
  141. else if (layer == mxBpmnShape.prototype.miscEnum.OUTLINE)
  142. {
  143. if (bg === mxBpmnShape.prototype.eventTypeEnum.GATEWAY)
  144. {
  145. c.translate(w / 4, h / 4);
  146. h /= 2;
  147. w /= 2;
  148. //add rhombus connections here
  149. this.constraints = [
  150. new mxConnectionConstraint(new mxPoint(0.5, 0), true),
  151. new mxConnectionConstraint(new mxPoint(0.5, 1), true),
  152. new mxConnectionConstraint(new mxPoint(0, 0.5), true),
  153. new mxConnectionConstraint(new mxPoint(1, 0.5), true),
  154. new mxConnectionConstraint(new mxPoint(0.25, 0.25), false),
  155. new mxConnectionConstraint(new mxPoint(0.25, 0.75), false),
  156. new mxConnectionConstraint(new mxPoint(0.75, 0.25), false),
  157. new mxConnectionConstraint(new mxPoint(0.75, 0.75), false)
  158. ];
  159. }
  160. else
  161. {
  162. //add ellipse connections here
  163. this.constraints = [
  164. new mxConnectionConstraint(new mxPoint(0.5, 0), true),
  165. new mxConnectionConstraint(new mxPoint(0.5, 1), true),
  166. new mxConnectionConstraint(new mxPoint(0, 0.5), true),
  167. new mxConnectionConstraint(new mxPoint(1, 0.5), true),
  168. new mxConnectionConstraint(new mxPoint(0.145, 0.145), false),
  169. new mxConnectionConstraint(new mxPoint(0.145, 0.855), false),
  170. new mxConnectionConstraint(new mxPoint(0.855, 0.145), false),
  171. new mxConnectionConstraint(new mxPoint(0.855, 0.855), false)
  172. ];
  173. }
  174. var o = mxUtils.getValue(this.style, mxBpmnShape.prototype.miscEnum.OUTLINE, mxBpmnShape.prototype.eventTypeEnum.NONE);
  175. if (o != null)
  176. {
  177. var f = this.outlines[o];
  178. if (f != null)
  179. {
  180. f.call(this, c, x, y, w, h, bg === mxBpmnShape.prototype.eventTypeEnum.GATEWAY);
  181. }
  182. }
  183. }
  184. else if (layer == mxBpmnShape.prototype.miscEnum.SYMBOL)
  185. {
  186. if (bg === mxBpmnShape.prototype.eventTypeEnum.GATEWAY)
  187. {
  188. h /= 2;
  189. w /= 2;
  190. }
  191. var s = mxUtils.getValue(this.style, mxBpmnShape.prototype.miscEnum.SYMBOL, null);
  192. if (s != null)
  193. {
  194. var f = this.symbols[s];
  195. if (f != null)
  196. {
  197. var strokeColor = c.state.strokeColor;
  198. var fillColor = c.state.fillColor;
  199. var o = mxUtils.getValue(this.style, mxBpmnShape.prototype.miscEnum.OUTLINE, mxBpmnShape.prototype.eventTypeEnum.NONE);
  200. if (s === mxBpmnShape.prototype.eventEnum.MESSAGE)
  201. {
  202. c.translate(w * 0.15, h * 0.3);
  203. w = w * 0.7;
  204. h = h * 0.4;
  205. }
  206. else if (s === mxBpmnShape.prototype.eventEnum.TIMER)
  207. {
  208. c.translate(w * 0.11, h * 0.11);
  209. w = w * 0.78;
  210. h = h * 0.78;
  211. }
  212. else if (s === mxBpmnShape.prototype.eventEnum.ESCALATION)
  213. {
  214. c.translate(w * 0.19, h * 0.15);
  215. w = w * 0.62;
  216. h = h * 0.57;
  217. }
  218. else if (s === mxBpmnShape.prototype.eventEnum.CONDITIONAL)
  219. {
  220. c.translate(w * 0.3, h * 0.16);
  221. w = w * 0.4;
  222. h = h * 0.68;
  223. }
  224. else if (s === mxBpmnShape.prototype.eventEnum.LINK)
  225. {
  226. c.translate(w * 0.27, h * 0.33);
  227. w = w * 0.46;
  228. h = h * 0.34;
  229. }
  230. else if (s === mxBpmnShape.prototype.eventEnum.ERROR)
  231. {
  232. c.translate(w * 0.212, h * 0.243);
  233. w = w * 0.58;
  234. h = h * 0.507;
  235. }
  236. else if (s === mxBpmnShape.prototype.eventEnum.CANCEL)
  237. {
  238. c.translate(w * 0.22, h * 0.22);
  239. w = w * 0.56;
  240. h = h * 0.56;
  241. }
  242. else if (s === mxBpmnShape.prototype.eventEnum.COMPENSATION)
  243. {
  244. c.translate(w * 0.28, h * 0.35);
  245. w = w * 0.44;
  246. h = h * 0.3;
  247. }
  248. else if (s === mxBpmnShape.prototype.eventEnum.SIGNAL)
  249. {
  250. c.translate(w * 0.19, h * 0.15);
  251. w = w * 0.62;
  252. h = h * 0.57;
  253. }
  254. else if (s === mxBpmnShape.prototype.eventEnum.MULTIPLE)
  255. {
  256. c.translate(w * 0.2, h * 0.19);
  257. w = w * 0.6;
  258. h = h * 0.565;
  259. }
  260. else if (s === mxBpmnShape.prototype.eventEnum.PAR_MULTI)
  261. {
  262. c.translate(w * 0.2, h * 0.2);
  263. w = w * 0.6;
  264. h = h * 0.6;
  265. }
  266. else if (s === mxBpmnShape.prototype.eventEnum.TERMINATE)
  267. {
  268. c.translate(w * 0.05, h * 0.05);
  269. w = w * 0.9;
  270. h = h * 0.9;
  271. }
  272. else if (s === mxBpmnShape.prototype.eventEnum.GW_EXCLUSIVE)
  273. {
  274. c.translate(w * 0.12, 0);
  275. w = w * 0.76;
  276. }
  277. var isInverse = false;
  278. if (s === 'star')
  279. {
  280. c.setFillColor(strokeColor);
  281. }
  282. else if (o === mxBpmnShape.prototype.eventTypeEnum.THROWING || o === mxBpmnShape.prototype.eventTypeEnum.END)
  283. {
  284. c.setStrokeColor(fillColor);
  285. c.setFillColor(strokeColor);
  286. isInverse = true;
  287. }
  288. f.call(this, c, x, y, w, h, layer, isInverse);
  289. if (s === 'star')
  290. {
  291. c.setFillColor(fillColor);
  292. }
  293. else if (o === mxBpmnShape.prototype.eventTypeEnum.THROWING || o === mxBpmnShape.prototype.eventTypeEnum.END)
  294. {
  295. c.setStrokeColor(strokeColor);
  296. c.setFillColor(fillColor);
  297. }
  298. }
  299. }
  300. }
  301. };
  302. //Contains all possible backgrounds
  303. mxBpmnShape.prototype.backgrounds = {
  304. 'none': function(c, x, y, w, h)
  305. {
  306. },
  307. 'gateway': function(c, x, y, w, h)
  308. {
  309. c.begin();
  310. c.moveTo(w / 2, 0);
  311. c.lineTo(w, h / 2);
  312. c.lineTo(w / 2, h);
  313. c.lineTo(0, h / 2);
  314. c.close();
  315. c.fillAndStroke();
  316. }
  317. };
  318. //Contains all possible outlines
  319. mxBpmnShape.prototype.outlines = {
  320. 'none' : function(c, x, y, w, h, isGateway)
  321. {
  322. if (!isGateway)
  323. {
  324. c.setShadow(false);
  325. }
  326. },
  327. 'standard': function(c, x, y, w, h, isGateway)
  328. {
  329. c.ellipse(0, 0, w, h);
  330. c.fillAndStroke();
  331. if (!isGateway)
  332. {
  333. c.setShadow(false);
  334. }
  335. },
  336. 'eventInt': function(c, x, y, w, h, isGateway)
  337. {
  338. c.ellipse(0, 0, w, h);
  339. c.fillAndStroke();
  340. if (!isGateway)
  341. {
  342. c.setShadow(false);
  343. }
  344. },
  345. 'eventNonint': function(c, x, y, w, h, isGateway)
  346. {
  347. var dashed = c.state.dashed;
  348. c.setDashed(true);
  349. c.ellipse(0, 0, w, h);
  350. c.fillAndStroke();
  351. c.setDashed(dashed);
  352. if (!isGateway)
  353. {
  354. c.setShadow(false);
  355. }
  356. },
  357. 'catching': function(c, x, y, w, h, isGateway)
  358. {
  359. c.ellipse(0, 0, w, h);
  360. c.fillAndStroke();
  361. if (!isGateway)
  362. {
  363. c.setShadow(false);
  364. }
  365. var inset = 2;
  366. c.ellipse(inset, inset, w - 2 *inset, h - 2 * inset);
  367. c.stroke();
  368. },
  369. 'boundInt': function(c, x, y, w, h, isGateway)
  370. {
  371. c.ellipse(0, 0, w, h);
  372. c.fillAndStroke();
  373. if (!isGateway)
  374. {
  375. c.setShadow(false);
  376. }
  377. var inset = 2;
  378. c.ellipse(inset, inset, w - 2 *inset, h - 2 * inset);
  379. c.stroke();
  380. },
  381. 'boundNonint': function(c, x, y, w, h, isGateway)
  382. {
  383. var dashed = c.state.dashed;
  384. c.setDashed(true);
  385. c.ellipse(0, 0, w, h);
  386. c.fillAndStroke();
  387. if (!isGateway)
  388. {
  389. c.setShadow(false);
  390. }
  391. var inset = 2;
  392. c.ellipse(inset, inset, w - 2 *inset, h - 2 * inset);
  393. c.stroke();
  394. c.setDashed(dashed);
  395. },
  396. 'throwing': function(c, x, y, w, h, isGateway)
  397. {
  398. c.ellipse(0, 0, w, h);
  399. c.fillAndStroke();
  400. if (!isGateway)
  401. {
  402. c.setShadow(false);
  403. }
  404. var inset = 2;
  405. c.ellipse(w * 0.02 + inset, h * 0.02 + inset, w * 0.96 - 2 *inset, h * 0.96 - 2 * inset);
  406. c.stroke();
  407. },
  408. 'end': function(c, x, y, w, h, isGateway)
  409. {
  410. var sw = c.state.strokeWidth;
  411. c.setStrokeWidth(sw * 3);
  412. c.ellipse(0, 0, w, h);
  413. c.fillAndStroke();
  414. c.setStrokeWidth(sw);
  415. if (!isGateway)
  416. {
  417. c.setShadow(false);
  418. }
  419. }
  420. };
  421. //Contains all possible symbols
  422. mxBpmnShape.prototype.symbols = {
  423. 'general' : function(c, x, y, w, h)
  424. {
  425. },
  426. 'message': function(c, x, y, w, h, layer, isInverse)
  427. {
  428. c.rect(0, 0, w, h);
  429. c.fillAndStroke();
  430. var fc = mxUtils.getValue(this.style, "fillColor", "none");
  431. if (fc === 'none')
  432. {
  433. if (isInverse)
  434. {
  435. c.setStrokeColor('#ffffff');
  436. }
  437. }
  438. c.begin();
  439. c.moveTo(0, 0);
  440. c.lineTo(w * 0.5, h * 0.5);
  441. c.lineTo(w, 0);
  442. c.stroke();
  443. },
  444. 'timer' : function(c, x, y, w, h)
  445. {
  446. c.ellipse(0, 0, w, h);
  447. c.fillAndStroke();
  448. c.begin();
  449. c.moveTo(w * 0.5, 0);
  450. c.lineTo(w * 0.5, h * 0.0642);
  451. c.moveTo(w * 0.7484, h * 0.0654);
  452. c.lineTo(w * 0.7126, h * 0.1281);
  453. c.moveTo(w * 0.93, h * 0.2471);
  454. c.lineTo(w * 0.8673, h * 0.2854);
  455. c.moveTo(w, h * 0.5);
  456. c.lineTo(w * 0.9338, h * 0.5);
  457. c.moveTo(w * 0.93, h * 0.7509);
  458. c.lineTo(w * 0.8673, h * 0.7126);
  459. c.moveTo(w * 0.7484, h * 0.9326);
  460. c.lineTo(w * 0.7126, h * 0.8699);
  461. c.moveTo(w * 0.5, h * 0.9338);
  462. c.lineTo(w * 0.5, h);
  463. c.moveTo(w * 0.2496, h * 0.9325);
  464. c.lineTo(w * 0.2854, h * 0.8699);
  465. c.moveTo(w * 0.068, h * 0.7509);
  466. c.lineTo(w * 0.1307, h * 0.7126);
  467. c.moveTo(0, h * 0.5);
  468. c.lineTo(w * 0.0642, h * 0.5);
  469. c.moveTo(w * 0.068, h * 0.2471);
  470. c.lineTo(w * 0.1307, h * 0.2854);
  471. c.moveTo(w * 0.2496, h * 0.0654);
  472. c.lineTo(w * 0.2854, h * 0.1281);
  473. c.moveTo(w * 0.5246, h * 0.0706);
  474. c.lineTo(w * 0.5, h * 0.5);
  475. c.lineTo(w * 0.7804, h * 0.5118);
  476. c.stroke();
  477. },
  478. 'escalation' : function(c, x, y, w, h)
  479. {
  480. c.begin();
  481. c.moveTo(0, h);
  482. c.lineTo(w * 0.5, 0);
  483. c.lineTo(w, h);
  484. c.lineTo(w * 0.5, h * 0.5);
  485. c.close();
  486. c.fillAndStroke();
  487. },
  488. 'conditional' : function(c, x, y, w, h)
  489. {
  490. c.rect(0, 0, w, h);
  491. c.fillAndStroke();
  492. c.begin();
  493. c.moveTo(0, h * 0.1027);
  494. c.lineTo(w * 0.798, h * 0.1027);
  495. c.moveTo(0, h * 0.3669);
  496. c.lineTo(w * 0.798, h * 0.3669);
  497. c.moveTo(0, h * 0.6311);
  498. c.lineTo(w * 0.798, h * 0.6311);
  499. c.moveTo(0, h * 0.8953);
  500. c.lineTo(w * 0.798, h * 0.8953);
  501. c.stroke();
  502. },
  503. 'link' : function(c, x, y, w, h)
  504. {
  505. c.begin();
  506. c.moveTo(0, h * 0.76);
  507. c.lineTo(0, h * 0.24);
  508. c.lineTo(w * 0.63, h * 0.24);
  509. c.lineTo(w * 0.63, 0);
  510. c.lineTo(w, h * 0.5);
  511. c.lineTo(w * 0.63, h);
  512. c.lineTo(w * 0.63, h * 0.76);
  513. c.close();
  514. c.fillAndStroke();
  515. },
  516. 'error' : function(c, x, y, w, h, layer, isInverse)
  517. {
  518. c.begin();
  519. c.moveTo(0, h);
  520. c.lineTo(w * 0.3287, h * 0.123);
  521. c.lineTo(w * 0.6194, h * 0.6342);
  522. c.lineTo(w, 0);
  523. c.lineTo(w * 0.6625, h * 0.939);
  524. c.lineTo(w * 0.3717, h * 0.5064);
  525. c.close();
  526. if(isInverse)
  527. {
  528. c.fill();
  529. }
  530. else
  531. {
  532. c.fillAndStroke();
  533. }
  534. },
  535. 'cancel' : function(c, x, y, w, h)
  536. {
  537. c.begin();
  538. c.moveTo(w * 0.1051, 0);
  539. c.lineTo(w * 0.5, h * 0.3738);
  540. c.lineTo(w * 0.8909, 0);
  541. c.lineTo(w, h * 0.1054);
  542. c.lineTo(w * 0.623, h * 0.5);
  543. c.lineTo(w, h * 0.8926);
  544. c.lineTo(w * 0.8909, h);
  545. c.lineTo(w * 0.5, h * 0.6242);
  546. c.lineTo(w * 0.1051, h);
  547. c.lineTo(0, h * 0.8926);
  548. c.lineTo(w * 0.373, h * 0.5);
  549. c.lineTo(0, h * 0.1054);
  550. c.close();
  551. c.fillAndStroke();
  552. },
  553. 'compensation' : function(c, x, y, w, h)
  554. {
  555. c.begin();
  556. c.moveTo(0, h * 0.5);
  557. c.lineTo(w * 0.5, 0);
  558. c.lineTo(w * 0.5, h);
  559. c.close();
  560. c.moveTo(w * 0.5, h * 0.5);
  561. c.lineTo(w, 0);
  562. c.lineTo(w, h);
  563. c.close();
  564. c.fillAndStroke();
  565. },
  566. 'signal' : function(c, x, y, w, h)
  567. {
  568. c.begin();
  569. c.moveTo(0, h);
  570. c.lineTo(w * 0.5, 0);
  571. c.lineTo(w, h);
  572. c.close();
  573. c.fillAndStroke();
  574. },
  575. 'multiple' : function(c, x, y, w, h)
  576. {
  577. c.begin();
  578. c.moveTo(0, h * 0.39);
  579. c.lineTo(w * 0.5, 0);
  580. c.lineTo(w, h * 0.39);
  581. c.lineTo(w * 0.815, h);
  582. c.lineTo(w * 0.185, h);
  583. c.close();
  584. c.fillAndStroke();
  585. },
  586. 'parallelMultiple' : function(c, x, y, w, h)
  587. {
  588. c.begin();
  589. c.moveTo(w * 0.38, 0);
  590. c.lineTo(w * 0.62, 0);
  591. c.lineTo(w * 0.62, h * 0.38);
  592. c.lineTo(w, h * 0.38);
  593. c.lineTo(w, h * 0.62);
  594. c.lineTo(w * 0.62, h * 0.62);
  595. c.lineTo(w * 0.62, h);
  596. c.lineTo(w * 0.38, h);
  597. c.lineTo(w * 0.38, h * 0.62);
  598. c.lineTo(0, h * 0.62);
  599. c.lineTo(0, h * 0.38);
  600. c.lineTo(w * 0.38, h * 0.38);
  601. c.close();
  602. c.fillAndStroke();
  603. },
  604. 'terminate' : function(c, x, y, w, h)
  605. {
  606. c.ellipse(0, 0, w, h);
  607. c.fillAndStroke();
  608. },
  609. 'exclusiveGw' : function(c, x, y, w, h)
  610. {
  611. var strokeColor = c.state.strokeColor;
  612. var fillColor = c.state.fillColor;
  613. c.setStrokeColor(fillColor);
  614. c.setFillColor(strokeColor);
  615. c.begin();
  616. c.moveTo(w * 0.105, 0);
  617. c.lineTo(w * 0.5, h * 0.38);
  618. c.lineTo(w * 0.895, h * 0);
  619. c.lineTo(w, h * 0.11);
  620. c.lineTo(w * 0.6172, h * 0.5);
  621. c.lineTo(w, h * 0.89);
  622. c.lineTo(w * 0.895, h);
  623. c.lineTo(w * 0.5, h * 0.62);
  624. c.lineTo(w * 0.105, h);
  625. c.lineTo(0, h * 0.89);
  626. c.lineTo(w * 0.3808, h * 0.5);
  627. c.lineTo(0, h * 0.11);
  628. c.close();
  629. c.fillAndStroke();
  630. c.setStrokeColor(strokeColor);
  631. c.setFillColor(fillColor);
  632. },
  633. 'parallelGw' : function(c, x, y, w, h)
  634. {
  635. var strokeColor = c.state.strokeColor;
  636. var fillColor = c.state.fillColor;
  637. c.setStrokeColor(fillColor);
  638. c.setFillColor(strokeColor);
  639. c.begin();
  640. c.moveTo(w * 0.38, 0);
  641. c.lineTo(w * 0.62, 0);
  642. c.lineTo(w * 0.62, h * 0.38);
  643. c.lineTo(w, h * 0.38);
  644. c.lineTo(w, h * 0.62);
  645. c.lineTo(w * 0.62, h * 0.62);
  646. c.lineTo(w * 0.62, h);
  647. c.lineTo(w * 0.38, h);
  648. c.lineTo(w * 0.38, h * 0.62);
  649. c.lineTo(0, h * 0.62);
  650. c.lineTo(0, h * 0.38);
  651. c.lineTo(w * 0.38, h * 0.38);
  652. c.close();
  653. c.fillAndStroke();
  654. c.setStrokeColor(strokeColor);
  655. c.setFillColor(fillColor);
  656. },
  657. 'complexGw' : function(c, x, y, w, h)
  658. {
  659. var strokeColor = c.state.strokeColor;
  660. var fillColor = c.state.fillColor;
  661. c.setStrokeColor(fillColor);
  662. c.setFillColor(strokeColor);
  663. c.begin();
  664. c.moveTo(0, h * 0.44);
  665. c.lineTo(w * 0.36, h * 0.44);
  666. c.lineTo(w * 0.1, h * 0.18);
  667. c.lineTo(w * 0.18, h * 0.1);
  668. c.lineTo(w * 0.44, h * 0.36);
  669. c.lineTo(w * 0.44, 0);
  670. c.lineTo(w * 0.56, 0);
  671. c.lineTo(w * 0.56, h * 0.36);
  672. c.lineTo(w * 0.82, h * 0.1);
  673. c.lineTo(w * 0.90, h * 0.18);
  674. c.lineTo(w * 0.64, h * 0.44);
  675. c.lineTo(w, h * 0.44);
  676. c.lineTo(w, h * 0.56);
  677. c.lineTo(w * 0.64, h * 0.56);
  678. c.lineTo(w * 0.9, h * 0.82);
  679. c.lineTo(w * 0.82, h * 0.9);
  680. c.lineTo(w * 0.56, h * 0.64);
  681. c.lineTo(w * 0.56, h);
  682. c.lineTo(w * 0.44, h);
  683. c.lineTo(w * 0.44, h * 0.64);
  684. c.lineTo(w * 0.18, h * 0.9);
  685. c.lineTo(w * 0.1, h * 0.82);
  686. c.lineTo(w * 0.36, h * 0.56);
  687. c.lineTo(0, h * 0.56);
  688. c.close();
  689. c.fillAndStroke();
  690. c.setStrokeColor(strokeColor);
  691. c.setFillColor(fillColor);
  692. },
  693. 'star': function(c, x, y, w, h)
  694. {
  695. c.translate(w / 5, h / 6);
  696. h *= 2 / 3;
  697. w *= 3 / 5;
  698. c.begin();
  699. c.moveTo(0, h / 4);
  700. c.lineTo(w / 3, h / 4);
  701. c.lineTo(w / 2, 0);
  702. c.lineTo(2 * w / 3, h / 4);
  703. c.lineTo(w, h / 4);
  704. c.lineTo(5 * w / 6, h / 2);
  705. c.lineTo(w, 3 * h / 4);
  706. c.lineTo(2 * w / 3, 3 * h / 4);
  707. c.lineTo(w / 2, h);
  708. c.lineTo(w / 3, 3 * h / 4);
  709. c.lineTo(0, 3 * h / 4);
  710. c.lineTo(w / 6, h / 2);
  711. c.close();
  712. c.fillAndStroke();
  713. }
  714. };
  715. mxCellRenderer.registerShape('mxgraph.bpmn.shape', mxBpmnShape);
  716. //**********************************************************************************************************************************************************
  717. //Send / Receive marker
  718. //**********************************************************************************************************************************************************
  719. /**
  720. * Extends mxShape.
  721. */
  722. function mxShapeBpmn2SendMarker(bounds, fill, stroke, strokewidth)
  723. {
  724. mxShape.call(this);
  725. this.bounds = bounds;
  726. this.fill = fill;
  727. this.stroke = stroke;
  728. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  729. this.dy = 0.5;
  730. this.dx = 0.5;
  731. this.notch = 0;
  732. };
  733. /**
  734. * Extends mxShape.
  735. */
  736. mxUtils.extend(mxShapeBpmn2SendMarker, mxActor);
  737. mxShapeBpmn2SendMarker.prototype.cst = {
  738. SEND : 'mxgraph.bpmn.sendMarker'
  739. };
  740. /**
  741. * Function: paintVertexShape
  742. *
  743. * Paints the vertex shape.
  744. */
  745. mxShapeBpmn2SendMarker.prototype.paintVertexShape = function(c, x, y, w, h)
  746. {
  747. c.translate(x, y);
  748. c.rect(0, 0, w, h);
  749. c.fillAndStroke();
  750. c.setShadow(false);
  751. c.begin();
  752. c.moveTo(0,0);
  753. c.lineTo(w * 0.5, h * 0.5);
  754. c.lineTo(w, 0);
  755. c.stroke();
  756. };
  757. mxCellRenderer.registerShape(mxShapeBpmn2SendMarker.prototype.cst.SEND, mxShapeBpmn2SendMarker);
  758. // BPMN event shape
  759. function mxShapeBpmnEvent(bounds, fill, stroke, strokewidth)
  760. {
  761. mxShape.call(this);
  762. this.bounds = bounds;
  763. this.fill = fill;
  764. this.stroke = stroke;
  765. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  766. };
  767. /**
  768. * Extends mxShape.
  769. */
  770. mxUtils.extend(mxShapeBpmnEvent, mxShape);
  771. mxShapeBpmnEvent.prototype.eventTypeEnum = {
  772. START_STANDARD : 'standard',
  773. EVENT_SP_INT : 'eventInt',
  774. EVENT_SP_NONINT : 'eventNonint',
  775. CATCHING : 'catching',
  776. BOUND_INT : 'boundInt',
  777. BOUND_NONINT : 'boundNonint',
  778. THROWING : 'throwing',
  779. END : 'end',
  780. NONE : 'none'};
  781. mxShapeBpmnEvent.prototype.eventEnum = {
  782. GENERAL : 'general',
  783. MESSAGE : 'message',
  784. TIMER : 'timer',
  785. ESCALATION : 'escalation',
  786. CONDITIONAL : 'conditional',
  787. LINK : 'link',
  788. ERROR : 'error',
  789. CANCEL : 'cancel',
  790. COMPENSATION : 'compensation',
  791. SIGNAL : 'signal',
  792. MULTIPLE : 'multiple',
  793. PAR_MULTI : 'parallelMultiple',
  794. TERMINATE : 'terminate'};
  795. mxShapeBpmnEvent.prototype.miscEnum = {
  796. OUTLINE : 'outline',
  797. SYMBOL : 'symbol'};
  798. mxShapeBpmnEvent.prototype.customProperties = [
  799. {name: mxShapeBpmnEvent.prototype.miscEnum.SYMBOL, dispName: 'Event', type: 'enum', defVal:mxShapeBpmnEvent.prototype.eventEnum.GENERAL,
  800. enumList: [{val: mxShapeBpmnEvent.prototype.eventEnum.GENERAL, dispName: 'General'},
  801. {val: mxShapeBpmnEvent.prototype.eventEnum.MESSAGE, dispName: 'Message'},
  802. {val: mxShapeBpmnEvent.prototype.eventEnum.TIMER, dispName: 'Timer'},
  803. {val: mxShapeBpmnEvent.prototype.eventEnum.ESCALATION, dispName: 'Escalation'},
  804. {val: mxShapeBpmnEvent.prototype.eventEnum.CONDITIONAL, dispName: 'Conditional'},
  805. {val: mxShapeBpmnEvent.prototype.eventEnum.LINK, dispName: 'Link'},
  806. {val: mxShapeBpmnEvent.prototype.eventEnum.ERROR, dispName: 'Error'},
  807. {val: mxShapeBpmnEvent.prototype.eventEnum.CANCEL, dispName: 'Cancel'},
  808. {val: mxShapeBpmnEvent.prototype.eventEnum.COMPENSATION, dispName: 'Compensation'},
  809. {val: mxShapeBpmnEvent.prototype.eventEnum.SIGNAL, dispName: 'Signal'},
  810. {val: mxShapeBpmnEvent.prototype.eventEnum.MULTIPLE, dispName: 'Multiple'},
  811. {val: mxShapeBpmnEvent.prototype.eventEnum.PAR_MULTI, dispName: 'Parallel Multiple'},
  812. {val: mxShapeBpmnEvent.prototype.eventEnum.TERMINATE, dispName: 'Terminate'}]
  813. },
  814. {name: mxShapeBpmnEvent.prototype.miscEnum.OUTLINE, dispName: 'Event Type', type: 'enum', defVal:mxShapeBpmnEvent.prototype.eventTypeEnum.START_STANDARD,
  815. enumList: [{val: mxShapeBpmnEvent.prototype.eventTypeEnum.START_STANDARD, dispName: 'Standard'},
  816. {val: mxShapeBpmnEvent.prototype.eventTypeEnum.EVENT_SP_INT, dispName: 'Interrupting'},
  817. {val: mxShapeBpmnEvent.prototype.eventTypeEnum.EVENT_SP_NONINT, dispName: 'Non-Interrupting'},
  818. {val: mxShapeBpmnEvent.prototype.eventTypeEnum.CATCHING, dispName: 'Catching'},
  819. {val: mxShapeBpmnEvent.prototype.eventTypeEnum.BOUND_INT, dispName: 'Bound Interrupting'},
  820. {val: mxShapeBpmnEvent.prototype.eventTypeEnum.BOUND_NONINT, dispName: 'Bound Non-Interrupting'},
  821. {val: mxShapeBpmnEvent.prototype.eventTypeEnum.THROWING, dispName: 'Throwing'},
  822. {val: mxShapeBpmnEvent.prototype.eventTypeEnum.END, dispName: 'End'},
  823. {val: mxShapeBpmnEvent.prototype.eventTypeEnum.NONE, dispName: 'None'}]
  824. }];
  825. /**
  826. * Function: paintVertexShape
  827. *
  828. * Paints the vertex shape.
  829. */
  830. mxShapeBpmnEvent.prototype.paintVertexShape = function(c, x, y, w, h)
  831. {
  832. c.translate(x, y);
  833. this.strictDrawShape(c, 0, 0, w, h, null);
  834. }
  835. mxShapeBpmnEvent.prototype.strictDrawShape = function(c, x, y, w, h, outline, symbol)
  836. {
  837. // draw event outline
  838. if (outline == null)
  839. {
  840. outline = mxUtils.getValue(this.style, this.miscEnum.OUTLINE, this.eventTypeEnum.NONE);
  841. }
  842. if (outline != null)
  843. {
  844. var f = mxShapeBpmnEvent.prototype.outlines[outline];
  845. if (f != null)
  846. {
  847. c.translate(x,y);
  848. f.call(this, c, x, y, w, h);
  849. }
  850. }
  851. // draw event symbol
  852. if (symbol == null)
  853. {
  854. symbol = mxUtils.getValue(this.style, this.miscEnum.SYMBOL, null);
  855. }
  856. if (symbol != null)
  857. {
  858. var f = mxShapeBpmnEvent.prototype.symbols[symbol];
  859. if (f != null)
  860. {
  861. var strokeColor = c.state.strokeColor;
  862. var fillColor = c.state.fillColor;
  863. if (symbol === this.eventEnum.MESSAGE)
  864. {
  865. c.translate(w * 0.15, h * 0.3);
  866. w = w * 0.7;
  867. h = h * 0.4;
  868. }
  869. else if (symbol === this.eventEnum.TIMER)
  870. {
  871. c.translate(w * 0.11, h * 0.11);
  872. w = w * 0.78;
  873. h = h * 0.78;
  874. }
  875. else if (symbol === this.eventEnum.ESCALATION)
  876. {
  877. c.translate(w * 0.19, h * 0.15);
  878. w = w * 0.62;
  879. h = h * 0.57;
  880. }
  881. else if (symbol === this.eventEnum.CONDITIONAL)
  882. {
  883. c.translate(w * 0.3, h * 0.16);
  884. w = w * 0.4;
  885. h = h * 0.68;
  886. }
  887. else if (symbol === this.eventEnum.LINK)
  888. {
  889. c.translate(w * 0.27, h * 0.33);
  890. w = w * 0.46;
  891. h = h * 0.34;
  892. }
  893. else if (symbol === this.eventEnum.ERROR)
  894. {
  895. c.translate(w * 0.212, h * 0.243);
  896. w = w * 0.58;
  897. h = h * 0.507;
  898. }
  899. else if (symbol === this.eventEnum.CANCEL)
  900. {
  901. c.translate(w * 0.22, h * 0.22);
  902. w = w * 0.56;
  903. h = h * 0.56;
  904. }
  905. else if (symbol === this.eventEnum.COMPENSATION)
  906. {
  907. c.translate(w * 0.28, h * 0.35);
  908. w = w * 0.44;
  909. h = h * 0.3;
  910. }
  911. else if (symbol === this.eventEnum.SIGNAL)
  912. {
  913. c.translate(w * 0.19, h * 0.15);
  914. w = w * 0.62;
  915. h = h * 0.57;
  916. }
  917. else if (symbol === this.eventEnum.MULTIPLE)
  918. {
  919. c.translate(w * 0.2, h * 0.19);
  920. w = w * 0.6;
  921. h = h * 0.565;
  922. }
  923. else if (symbol === this.eventEnum.PAR_MULTI)
  924. {
  925. c.translate(w * 0.2, h * 0.2);
  926. w = w * 0.6;
  927. h = h * 0.6;
  928. }
  929. else if (symbol === this.eventEnum.TERMINATE)
  930. {
  931. c.translate(w * 0.05, h * 0.05);
  932. w = w * 0.9;
  933. h = h * 0.9;
  934. }
  935. else if (symbol === this.eventEnum.GW_EXCLUSIVE)
  936. {
  937. c.translate(w * 0.12, 0);
  938. w = w * 0.76;
  939. }
  940. var isInverse = false;
  941. if (symbol === 'star')
  942. {
  943. c.setFillColor(strokeColor);
  944. }
  945. else if (outline === this.eventTypeEnum.THROWING || outline === this.eventTypeEnum.END)
  946. {
  947. c.setStrokeColor(fillColor);
  948. c.setFillColor(strokeColor);
  949. isInverse = true;
  950. }
  951. f.call(this, c, x, y, w, h, isInverse);
  952. if (symbol === 'star')
  953. {
  954. c.setFillColor(fillColor);
  955. }
  956. else if (outline === this.eventTypeEnum.THROWING || outline === this.eventTypeEnum.END)
  957. {
  958. c.setStrokeColor(strokeColor);
  959. c.setFillColor(fillColor);
  960. }
  961. }
  962. }
  963. }
  964. //Contains all possible outlines
  965. mxShapeBpmnEvent.prototype.outlines = {
  966. 'none' : function(c, x, y, w, h)
  967. {
  968. c.setShadow(false);
  969. },
  970. 'standard': function(c, x, y, w, h)
  971. {
  972. c.ellipse(0, 0, w, h);
  973. c.fillAndStroke();
  974. c.setShadow(false);
  975. },
  976. 'eventInt': function(c, x, y, w, h)
  977. {
  978. c.ellipse(0, 0, w, h);
  979. c.fillAndStroke();
  980. c.setShadow(false);
  981. },
  982. 'eventNonint': function(c, x, y, w, h)
  983. {
  984. var dashed = c.state.dashed;
  985. c.setDashed(true);
  986. c.ellipse(0, 0, w, h);
  987. c.fillAndStroke();
  988. c.setDashed(dashed);
  989. c.setShadow(false);
  990. },
  991. 'catching': function(c, x, y, w, h)
  992. {
  993. c.ellipse(0, 0, w, h);
  994. c.fillAndStroke();
  995. c.setShadow(false);
  996. var inset = 2;
  997. c.ellipse(inset, inset, w - 2 *inset, h - 2 * inset);
  998. c.stroke();
  999. },
  1000. 'boundInt': function(c, x, y, w, h)
  1001. {
  1002. c.ellipse(0, 0, w, h);
  1003. c.fillAndStroke();
  1004. c.setShadow(false);
  1005. var inset = 2;
  1006. c.ellipse(inset, inset, w - 2 *inset, h - 2 * inset);
  1007. c.stroke();
  1008. },
  1009. 'boundNonint': function(c, x, y, w, h)
  1010. {
  1011. var dashed = c.state.dashed;
  1012. c.setDashed(true);
  1013. c.ellipse(0, 0, w, h);
  1014. c.fillAndStroke();
  1015. c.setShadow(false);
  1016. var inset = 2;
  1017. c.ellipse(inset, inset, w - 2 *inset, h - 2 * inset);
  1018. c.stroke();
  1019. c.setDashed(dashed);
  1020. },
  1021. 'throwing': function(c, x, y, w, h)
  1022. {
  1023. c.ellipse(0, 0, w, h);
  1024. c.fillAndStroke();
  1025. c.setShadow(false);
  1026. var inset = 2;
  1027. c.ellipse(w * 0.02 + inset, h * 0.02 + inset, w * 0.96 - 2 *inset, h * 0.96 - 2 * inset);
  1028. c.stroke();
  1029. },
  1030. 'end': function(c, x, y, w, h)
  1031. {
  1032. var sw = c.state.strokeWidth;
  1033. c.setStrokeWidth(sw * 3);
  1034. c.ellipse(0, 0, w, h);
  1035. c.fillAndStroke();
  1036. c.setStrokeWidth(sw);
  1037. c.setShadow(false);
  1038. }
  1039. };
  1040. //Contains all possible symbols
  1041. mxShapeBpmnEvent.prototype.symbols = {
  1042. 'general' : function(c, x, y, w, h, isInverse)
  1043. {
  1044. },
  1045. 'message': function(c, x, y, w, h, isInverse)
  1046. {
  1047. c.rect(0, 0, w, h);
  1048. c.fillAndStroke();
  1049. var fc = mxUtils.getValue(this.style, "fillColor", "none");
  1050. if (fc === 'none')
  1051. {
  1052. if (isInverse)
  1053. {
  1054. c.setStrokeColor('#ffffff');
  1055. }
  1056. }
  1057. c.begin();
  1058. c.moveTo(0, 0);
  1059. c.lineTo(w * 0.5, h * 0.5);
  1060. c.lineTo(w, 0);
  1061. c.stroke();
  1062. },
  1063. 'timer' : function(c, x, y, w, h, isInverse)
  1064. {
  1065. c.ellipse(0, 0, w, h);
  1066. c.fillAndStroke();
  1067. c.begin();
  1068. c.moveTo(w * 0.5, 0);
  1069. c.lineTo(w * 0.5, h * 0.0642);
  1070. c.moveTo(w * 0.7484, h * 0.0654);
  1071. c.lineTo(w * 0.7126, h * 0.1281);
  1072. c.moveTo(w * 0.93, h * 0.2471);
  1073. c.lineTo(w * 0.8673, h * 0.2854);
  1074. c.moveTo(w, h * 0.5);
  1075. c.lineTo(w * 0.9338, h * 0.5);
  1076. c.moveTo(w * 0.93, h * 0.7509);
  1077. c.lineTo(w * 0.8673, h * 0.7126);
  1078. c.moveTo(w * 0.7484, h * 0.9326);
  1079. c.lineTo(w * 0.7126, h * 0.8699);
  1080. c.moveTo(w * 0.5, h * 0.9338);
  1081. c.lineTo(w * 0.5, h);
  1082. c.moveTo(w * 0.2496, h * 0.9325);
  1083. c.lineTo(w * 0.2854, h * 0.8699);
  1084. c.moveTo(w * 0.068, h * 0.7509);
  1085. c.lineTo(w * 0.1307, h * 0.7126);
  1086. c.moveTo(0, h * 0.5);
  1087. c.lineTo(w * 0.0642, h * 0.5);
  1088. c.moveTo(w * 0.068, h * 0.2471);
  1089. c.lineTo(w * 0.1307, h * 0.2854);
  1090. c.moveTo(w * 0.2496, h * 0.0654);
  1091. c.lineTo(w * 0.2854, h * 0.1281);
  1092. c.moveTo(w * 0.5246, h * 0.0706);
  1093. c.lineTo(w * 0.5, h * 0.5);
  1094. c.lineTo(w * 0.7804, h * 0.5118);
  1095. c.stroke();
  1096. },
  1097. 'escalation' : function(c, x, y, w, h, isInverse)
  1098. {
  1099. c.setMiterLimit(6);
  1100. c.begin();
  1101. c.moveTo(0, h);
  1102. c.lineTo(w * 0.5, 0);
  1103. c.lineTo(w, h);
  1104. c.lineTo(w * 0.5, h * 0.5);
  1105. c.close();
  1106. if (isInverse)
  1107. {
  1108. c.fill();
  1109. }
  1110. else
  1111. {
  1112. c.fillAndStroke();
  1113. }
  1114. },
  1115. 'conditional' : function(c, x, y, w, h, isInverse)
  1116. {
  1117. c.rect(0, 0, w, h);
  1118. c.fillAndStroke();
  1119. c.begin();
  1120. c.moveTo(0, h * 0.1027);
  1121. c.lineTo(w * 0.798, h * 0.1027);
  1122. c.moveTo(0, h * 0.3669);
  1123. c.lineTo(w * 0.798, h * 0.3669);
  1124. c.moveTo(0, h * 0.6311);
  1125. c.lineTo(w * 0.798, h * 0.6311);
  1126. c.moveTo(0, h * 0.8953);
  1127. c.lineTo(w * 0.798, h * 0.8953);
  1128. c.stroke();
  1129. },
  1130. 'link' : function(c, x, y, w, h, isInverse)
  1131. {
  1132. c.begin();
  1133. c.moveTo(0, h * 0.76);
  1134. c.lineTo(0, h * 0.24);
  1135. c.lineTo(w * 0.63, h * 0.24);
  1136. c.lineTo(w * 0.63, 0);
  1137. c.lineTo(w, h * 0.5);
  1138. c.lineTo(w * 0.63, h);
  1139. c.lineTo(w * 0.63, h * 0.76);
  1140. c.close();
  1141. isInverse ? c.fill() : c.fillAndStroke();
  1142. },
  1143. 'error' : function(c, x, y, w, h, isInverse)
  1144. {
  1145. c.setMiterLimit(7);
  1146. c.begin();
  1147. c.moveTo(0, h);
  1148. c.lineTo(w * 0.3287, h * 0.123);
  1149. c.lineTo(w * 0.6194, h * 0.6342);
  1150. c.lineTo(w, 0);
  1151. c.lineTo(w * 0.6625, h * 0.939);
  1152. c.lineTo(w * 0.3717, h * 0.5064);
  1153. c.close();
  1154. isInverse ? c.fill() : c.fillAndStroke();
  1155. },
  1156. 'cancel' : function(c, x, y, w, h, isInverse)
  1157. {
  1158. c.begin();
  1159. c.moveTo(w * 0.1051, 0);
  1160. c.lineTo(w * 0.5, h * 0.3738);
  1161. c.lineTo(w * 0.8909, 0);
  1162. c.lineTo(w, h * 0.1054);
  1163. c.lineTo(w * 0.623, h * 0.5);
  1164. c.lineTo(w, h * 0.8926);
  1165. c.lineTo(w * 0.8909, h);
  1166. c.lineTo(w * 0.5, h * 0.6242);
  1167. c.lineTo(w * 0.1051, h);
  1168. c.lineTo(0, h * 0.8926);
  1169. c.lineTo(w * 0.373, h * 0.5);
  1170. c.lineTo(0, h * 0.1054);
  1171. c.close();
  1172. isInverse ? c.fill() : c.fillAndStroke();
  1173. },
  1174. 'compensation' : function(c, x, y, w, h, isInverse)
  1175. {
  1176. c.setMiterLimit(1);
  1177. c.begin();
  1178. c.moveTo(0, h * 0.5);
  1179. c.lineTo(w * 0.5, 0);
  1180. c.lineTo(w * 0.5, h);
  1181. c.close();
  1182. c.moveTo(w * 0.5, h * 0.5);
  1183. c.lineTo(w, 0);
  1184. c.lineTo(w, h);
  1185. c.close();
  1186. isInverse ? c.fill() : c.fillAndStroke();
  1187. },
  1188. 'signal' : function(c, x, y, w, h, isInverse)
  1189. {
  1190. c.begin();
  1191. c.moveTo(0, h);
  1192. c.lineTo(w * 0.5, 0);
  1193. c.lineTo(w, h);
  1194. c.close();
  1195. isInverse ? c.fill() : c.fillAndStroke();
  1196. },
  1197. 'multiple' : function(c, x, y, w, h, isInverse)
  1198. {
  1199. c.begin();
  1200. c.moveTo(0, h * 0.39);
  1201. c.lineTo(w * 0.5, 0);
  1202. c.lineTo(w, h * 0.39);
  1203. c.lineTo(w * 0.815, h);
  1204. c.lineTo(w * 0.185, h);
  1205. c.close();
  1206. isInverse ? c.fill() : c.fillAndStroke();
  1207. },
  1208. 'parallelMultiple' : function(c, x, y, w, h, isInverse)
  1209. {
  1210. c.begin();
  1211. c.moveTo(w * 0.38, 0);
  1212. c.lineTo(w * 0.62, 0);
  1213. c.lineTo(w * 0.62, h * 0.38);
  1214. c.lineTo(w, h * 0.38);
  1215. c.lineTo(w, h * 0.62);
  1216. c.lineTo(w * 0.62, h * 0.62);
  1217. c.lineTo(w * 0.62, h);
  1218. c.lineTo(w * 0.38, h);
  1219. c.lineTo(w * 0.38, h * 0.62);
  1220. c.lineTo(0, h * 0.62);
  1221. c.lineTo(0, h * 0.38);
  1222. c.lineTo(w * 0.38, h * 0.38);
  1223. c.close();
  1224. isInverse ? c.fill() : c.fillAndStroke();
  1225. },
  1226. 'terminate' : function(c, x, y, w, h, isInverse)
  1227. {
  1228. c.ellipse(0, 0, w, h);
  1229. c.fillAndStroke();
  1230. },
  1231. 'star': function(c, x, y, w, h, isInverse)
  1232. {
  1233. c.translate(w / 5, h / 6);
  1234. h *= 2 / 3;
  1235. w *= 3 / 5;
  1236. c.begin();
  1237. c.moveTo(0, h / 4);
  1238. c.lineTo(w / 3, h / 4);
  1239. c.lineTo(w / 2, 0);
  1240. c.lineTo(2 * w / 3, h / 4);
  1241. c.lineTo(w, h / 4);
  1242. c.lineTo(5 * w / 6, h / 2);
  1243. c.lineTo(w, 3 * h / 4);
  1244. c.lineTo(2 * w / 3, 3 * h / 4);
  1245. c.lineTo(w / 2, h);
  1246. c.lineTo(w / 3, 3 * h / 4);
  1247. c.lineTo(0, 3 * h / 4);
  1248. c.lineTo(w / 6, h / 2);
  1249. c.close();
  1250. c.fillAndStroke();
  1251. }
  1252. };
  1253. mxCellRenderer.registerShape('mxgraph.bpmn.event', mxShapeBpmnEvent);
  1254. //BPMN gateway shape
  1255. function mxShapeBpmnGateway(bounds, fill, stroke, strokewidth)
  1256. {
  1257. mxShape.call(this);
  1258. this.bounds = bounds;
  1259. this.fill = fill;
  1260. this.stroke = stroke;
  1261. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1262. };
  1263. /**
  1264. * Extends mxShape.
  1265. */
  1266. mxUtils.extend(mxShapeBpmnGateway, mxShape);
  1267. mxShapeBpmnGateway.prototype.customProperties = mxShapeBpmnEvent.prototype.customProperties;
  1268. mxShapeBpmnGateway.prototype.eventTypeEnum = mxShapeBpmnEvent.prototype.eventTypeEnum;
  1269. mxShapeBpmnGateway.prototype.eventEnum = mxShapeBpmnEvent.prototype.eventEnum;
  1270. mxShapeBpmnGateway.prototype.miscEnum = mxShapeBpmnEvent.prototype.miscEnum;
  1271. mxShapeBpmnGateway.prototype.customProperties = mxShapeBpmnGateway.prototype.customProperties.concat(
  1272. {name: 'gwType', dispName: 'Gateway type', type: 'enum', defVal:'event',
  1273. enumList: [{val: 'event', dispName: 'Event-based'},
  1274. {val: 'exclusive', dispName: 'Exclusive'},
  1275. {val: 'parallel', dispName: 'Parallel'},
  1276. {val: 'complex', dispName: 'Complex'}]});
  1277. /**
  1278. * Function: paintVertexShape
  1279. *
  1280. * Paints the vertex shape.
  1281. */
  1282. mxShapeBpmnGateway.prototype.paintVertexShape = function(c, x, y, w, h)
  1283. {
  1284. c.translate(x, y);
  1285. c.begin();
  1286. c.moveTo(w * 0.5, 0);
  1287. c.lineTo(w, h * 0.5);
  1288. c.lineTo(w * 0.5, h);
  1289. c.lineTo(0, h * 0.5);
  1290. c.close();
  1291. c.fillAndStroke();
  1292. c.setShadow(false);
  1293. var symbolW = w * 0.6;
  1294. var symbolH = h * 0.6;
  1295. var gwType = mxUtils.getValue(this.style, 'gwType', 'event');
  1296. var outline = mxUtils.getValue(this.style, 'outline', 'none');
  1297. var symbol = mxUtils.getValue(this.style, 'symbol', 'standard');
  1298. var tmpW = w * 0.5;
  1299. var tmpH = h * 0.5;
  1300. if (gwType === 'event' && outline !== null && outline !== 'none')
  1301. {
  1302. mxShapeBpmnEvent.prototype.strictDrawShape.call(this, c, (w - symbolW) * 0.5, (h - symbolH) * 0.5, symbolW, symbolH, outline, symbol);
  1303. }
  1304. else if (gwType == 'exclusive')
  1305. {
  1306. c.translate(w * 0.31, h * 0.25);
  1307. tmpW = tmpW * 0.76;
  1308. var strokeColor = c.state.strokeColor;
  1309. var fillColor = c.state.fillColor;
  1310. c.setFillColor(strokeColor);
  1311. c.begin();
  1312. c.moveTo(tmpW * 0.105, 0);
  1313. c.lineTo(tmpW * 0.5, tmpH * 0.38);
  1314. c.lineTo(tmpW * 0.895, tmpH * 0);
  1315. c.lineTo(tmpW, tmpH * 0.11);
  1316. c.lineTo(tmpW * 0.6172, tmpH * 0.5);
  1317. c.lineTo(tmpW, tmpH * 0.89);
  1318. c.lineTo(tmpW * 0.895, tmpH);
  1319. c.lineTo(tmpW * 0.5, tmpH * 0.62);
  1320. c.lineTo(tmpW * 0.105, tmpH);
  1321. c.lineTo(0, tmpH * 0.89);
  1322. c.lineTo(tmpW * 0.3808, tmpH * 0.5);
  1323. c.lineTo(0, tmpH * 0.11);
  1324. c.close();
  1325. c.fillAndStroke();
  1326. c.setFillColor(fillColor);
  1327. c.translate(-tmpW * 0.12, 0);
  1328. }
  1329. else if (gwType == 'parallel')
  1330. {
  1331. c.translate(w * 0.25, h * 0.25);
  1332. var strokeColor = c.state.strokeColor;
  1333. var fillColor = c.state.fillColor;
  1334. c.setFillColor(strokeColor);
  1335. c.begin();
  1336. c.moveTo(tmpW * 0.38, 0);
  1337. c.lineTo(tmpW * 0.62, 0);
  1338. c.lineTo(tmpW * 0.62, tmpH * 0.38);
  1339. c.lineTo(tmpW, tmpH * 0.38);
  1340. c.lineTo(tmpW, tmpH * 0.62);
  1341. c.lineTo(tmpW * 0.62, tmpH * 0.62);
  1342. c.lineTo(tmpW * 0.62, tmpH);
  1343. c.lineTo(tmpW * 0.38, tmpH);
  1344. c.lineTo(tmpW * 0.38, tmpH * 0.62);
  1345. c.lineTo(0, tmpH * 0.62);
  1346. c.lineTo(0, tmpH * 0.38);
  1347. c.lineTo(tmpW * 0.38, tmpH * 0.38);
  1348. c.close();
  1349. c.fillAndStroke();
  1350. c.setFillColor(fillColor);
  1351. }
  1352. else if (gwType == 'complex')
  1353. {
  1354. c.translate(w * 0.25, h * 0.25);
  1355. var strokeColor = c.state.strokeColor;
  1356. var fillColor = c.state.fillColor;
  1357. c.setFillColor(strokeColor);
  1358. c.begin();
  1359. c.moveTo(0, tmpH * 0.44);
  1360. c.lineTo(tmpW * 0.36, tmpH * 0.44);
  1361. c.lineTo(tmpW * 0.1, tmpH * 0.18);
  1362. c.lineTo(tmpW * 0.18, tmpH * 0.1);
  1363. c.lineTo(tmpW * 0.44, tmpH * 0.36);
  1364. c.lineTo(tmpW * 0.44, 0);
  1365. c.lineTo(tmpW * 0.56, 0);
  1366. c.lineTo(tmpW * 0.56, tmpH * 0.36);
  1367. c.lineTo(tmpW * 0.82, tmpH * 0.1);
  1368. c.lineTo(tmpW * 0.90, tmpH * 0.18);
  1369. c.lineTo(tmpW * 0.64, tmpH * 0.44);
  1370. c.lineTo(tmpW, tmpH * 0.44);
  1371. c.lineTo(tmpW, tmpH * 0.56);
  1372. c.lineTo(tmpW * 0.64, tmpH * 0.56);
  1373. c.lineTo(tmpW * 0.9, tmpH * 0.82);
  1374. c.lineTo(tmpW * 0.82, tmpH * 0.9);
  1375. c.lineTo(tmpW * 0.56, tmpH * 0.64);
  1376. c.lineTo(tmpW * 0.56, tmpH);
  1377. c.lineTo(tmpW * 0.44, tmpH);
  1378. c.lineTo(tmpW * 0.44, tmpH * 0.64);
  1379. c.lineTo(tmpW * 0.18, tmpH * 0.9);
  1380. c.lineTo(tmpW * 0.1, tmpH * 0.82);
  1381. c.lineTo(tmpW * 0.36, tmpH * 0.56);
  1382. c.lineTo(0, tmpH * 0.56);
  1383. c.close();
  1384. c.fillAndStroke();
  1385. c.setFillColor(fillColor);
  1386. }
  1387. }
  1388. mxCellRenderer.registerShape('mxgraph.bpmn.gateway2', mxShapeBpmnGateway);
  1389. //**********************************************************************************************************************************************************
  1390. //Task (LEGACY)
  1391. //**********************************************************************************************************************************************************
  1392. /**
  1393. * Extends mxShape.
  1394. */
  1395. function mxShapeBpmn2Task(bounds, fill, stroke, strokewidth)
  1396. {
  1397. mxCellRenderer.prototype.getShape('mxgraph.basic.rect').call(this);
  1398. this.bounds = bounds;
  1399. this.fill = fill;
  1400. this.stroke = stroke;
  1401. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1402. this.dy = 0.5;
  1403. this.dx = 0.5;
  1404. this.notch = 0;
  1405. };
  1406. /**
  1407. * Extends mxShape.
  1408. */
  1409. mxUtils.extend(mxShapeBpmn2Task, mxCellRenderer.prototype.getShape('mxgraph.basic.rect'));
  1410. mxShapeBpmn2Task.prototype.customProperties = [
  1411. {name: 'bpmnShapeType', dispName: 'Type', defVal: 'task', type: 'enum',
  1412. enumList: [{val: 'task', dispName: 'Task'},
  1413. {val: 'transaction', dispName: 'Transaction'},
  1414. {val: 'call', dispName: 'Call'},
  1415. {val: 'subprocess', dispName: 'Sub-Process'}]},
  1416. {name: 'taskMarker', dispName: 'Task Marker', defVal: 'abstract', type: 'enum',
  1417. enumList: [{val: 'abstract', dispName: 'Abstract'},
  1418. {val: 'service', dispName: 'Service'},
  1419. {val: 'send', dispName: 'Send'},
  1420. {val: 'receive', dispName: 'Receive'},
  1421. {val: 'user', dispName: 'User'},
  1422. {val: 'nime', dispName: 'Non-Interrupting Message Event'},
  1423. {val: 'manual', dispName: 'Manual'},
  1424. {val: 'businessRule', dispName: 'Business Rule'},
  1425. {val: 'script', dispName: 'Script'}]},
  1426. {name: 'isLoopSub', dispName: 'Subprocess', type: 'bool'},
  1427. {name: 'isLoopStandard', dispName: 'Standard Loop', type: 'bool'},
  1428. {name: 'isLoopMultiParallel', dispName: 'Multi-Instance Parallel Loop', type: 'bool'},
  1429. {name: 'isLoopMultiSeq', dispName: 'Multi-Instance Sequential Loop', type: 'bool'},
  1430. {name: 'isLoopComp', dispName: 'Compensation Loop', type: 'bool'},
  1431. {name: 'isAdHoc', dispName: 'Ad Hoc', type: 'bool'}
  1432. ];
  1433. mxShapeBpmn2Task.prototype.customProperties = mxShapeBpmn2Task.prototype.customProperties.concat(mxShapeBpmnEvent.prototype.customProperties);
  1434. mxShapeBpmn2Task.prototype.customProperties = mxShapeBpmn2Task.prototype.customProperties.concat(mxCellRenderer.prototype.getShape('mxgraph.basic.rect').prototype.customProperties);
  1435. mxShapeBpmn2Task.prototype.eventTypeEnum = mxShapeBpmnEvent.prototype.eventTypeEnum;
  1436. mxShapeBpmn2Task.prototype.eventEnum = mxShapeBpmnEvent.prototype.eventEnum;
  1437. mxShapeBpmn2Task.prototype.miscEnum = mxShapeBpmnEvent.prototype.miscEnum;
  1438. mxShapeBpmn2Task.prototype.cst = {
  1439. TASK : 'mxgraph.bpmn.task'
  1440. };
  1441. /**
  1442. * Function: paintVertexShape
  1443. *
  1444. * Paints the vertex shape.
  1445. */
  1446. mxShapeBpmn2Task.prototype.paintVertexShape = function(c, x, y, w, h)
  1447. {
  1448. var bpmnShapeType = mxUtils.getValue(this.style, 'bpmnShapeType', 'task');
  1449. var taskMarker = mxUtils.getValue(this.style, 'taskMarker', 'abstract');
  1450. var strokeWidth = mxUtils.getValue(this.style, 'strokeWidth', 1);
  1451. var dashed = mxUtils.getValue(this.style, 'dashed', false);
  1452. var inset = mxUtils.getValue(this.style, 'indent', 3);
  1453. var offsetY = 14;
  1454. var rectOutline = mxUtils.getValue(this.style, 'rectOutline', 'single');
  1455. c.translate(x, y);
  1456. var superShape = mxCellRenderer.prototype.getShape('mxgraph.basic.rect');
  1457. var overrideStyles = {};
  1458. if (bpmnShapeType == 'transaction')
  1459. {
  1460. offsetY += inset;
  1461. overrideStyles.rectOutline = 'double';
  1462. overrideStyles.indent = 3;
  1463. }
  1464. else if (bpmnShapeType == 'subprocess')
  1465. {
  1466. overrideStyles.dashed = true;
  1467. }
  1468. else if (bpmnShapeType == 'call')
  1469. {
  1470. overrideStyles.strokeWidth = 4;
  1471. }
  1472. superShape.prototype.strictDrawShape.call(this, c, 0, 0, w, h, overrideStyles);
  1473. c.setStrokeWidth(strokeWidth);
  1474. c.setDashed(dashed);
  1475. if (bpmnShapeType == 'call')
  1476. {
  1477. c.setStrokeWidth(strokeWidth);
  1478. }
  1479. c.setDashed(false);
  1480. c.setShadow(false);
  1481. var isLoopSub = mxUtils.getValue(this.style, 'isLoopSub', false);
  1482. var isLoopStandard = mxUtils.getValue(this.style, 'isLoopStandard', false);
  1483. var isLoopMultiParallel = mxUtils.getValue(this.style, 'isLoopMultiParallel', false);
  1484. var isLoopMultiSeq = mxUtils.getValue(this.style, 'isLoopMultiSeq', false);
  1485. var isLoopComp = mxUtils.getValue(this.style, 'isLoopComp', false);
  1486. var isAdHoc = mxUtils.getValue(this.style, 'isAdHoc', false);
  1487. var loopnum = 0;
  1488. if (isLoopStandard) loopnum++;
  1489. if (isLoopMultiParallel) loopnum++;
  1490. if (isLoopMultiSeq) loopnum++;
  1491. if (isLoopComp) loopnum++;
  1492. if (isLoopSub) loopnum++;
  1493. if (isAdHoc) loopnum++;
  1494. var iconSpaceX = 14;
  1495. var currXOffset = - iconSpaceX * loopnum * 0.5;
  1496. if (isLoopStandard)
  1497. {
  1498. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.loop');
  1499. if (stencil != null)
  1500. {
  1501. stencil.drawShape(c, this, w * 0.5 + currXOffset + 1, h - offsetY + 1, 12, 12);
  1502. currXOffset += iconSpaceX;
  1503. }
  1504. }
  1505. if (isLoopMultiParallel)
  1506. {
  1507. c.translate(w * 0.5 + currXOffset + 1, h - offsetY + 1);
  1508. c.begin();
  1509. c.moveTo(2.4, 0);
  1510. c.lineTo(2.4, 12);
  1511. c.moveTo(6, 0);
  1512. c.lineTo(6, 12);
  1513. c.moveTo(9.6, 0);
  1514. c.lineTo(9.6, 12);
  1515. c.stroke();
  1516. c.translate(- w * 0.5 - currXOffset - 1, offsetY - 1 - h);
  1517. currXOffset += iconSpaceX;
  1518. }
  1519. if (isLoopMultiSeq)
  1520. {
  1521. c.translate(w * 0.5 + currXOffset + 1, h - offsetY + 1);
  1522. c.begin();
  1523. c.moveTo(0, 2.4);
  1524. c.lineTo(12, 2.4);
  1525. c.moveTo(0, 6);
  1526. c.lineTo(12, 6);
  1527. c.moveTo(0, 9.6);
  1528. c.lineTo(12, 9.6);
  1529. c.stroke();
  1530. c.translate(- w * 0.5 - currXOffset - 1, offsetY - 1 - h);
  1531. currXOffset += iconSpaceX;
  1532. }
  1533. if (isLoopComp)
  1534. {
  1535. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.compensation');
  1536. if (stencil != null)
  1537. {
  1538. stencil.drawShape(c, this, w * 0.5 + currXOffset, h - offsetY + 1, 14, 12);
  1539. currXOffset += iconSpaceX;
  1540. }
  1541. }
  1542. if (isLoopSub)
  1543. {
  1544. c.translate(w * 0.5 + currXOffset, h - offsetY);
  1545. c.rect(0, 0, 14, 14);
  1546. c.stroke();
  1547. c.begin();
  1548. c.moveTo(4, 7);
  1549. c.lineTo(10, 7);
  1550. c.moveTo(7, 4);
  1551. c.lineTo(7, 10);
  1552. c.stroke();
  1553. c.translate(- w * 0.5 - currXOffset, offsetY - h);
  1554. currXOffset += iconSpaceX;
  1555. }
  1556. if (isAdHoc)
  1557. {
  1558. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.ad_hoc');
  1559. if (stencil != null)
  1560. {
  1561. var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');
  1562. var fillColor = mxUtils.getValue(this.style, 'fillColor', '#ffffff');
  1563. c.setStrokeColor('none');
  1564. c.setFillColor(strokeColor);
  1565. stencil.drawShape(c, this, w * 0.5 + currXOffset + 1, h - offsetY + 4, 12, 6);
  1566. currXOffset += iconSpaceX;
  1567. c.setStrokeColor(strokeColor);
  1568. c.setFillColor(fillColor);
  1569. }
  1570. }
  1571. switch (taskMarker) {
  1572. case 'abstract':
  1573. break;
  1574. case 'service':
  1575. c.setFillColor(mxUtils.getValue(this.style, 'fillColor', '#ffffff'));
  1576. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.service_task');
  1577. if (stencil != null)
  1578. {
  1579. stencil.drawShape(c, this, 2, 2, 16, 16);
  1580. }
  1581. break;
  1582. case 'send':
  1583. var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');
  1584. var fillColor = mxUtils.getValue(this.style, 'fillColor', '#ffffff');
  1585. c.setStrokeColor(fillColor);
  1586. c.setFillColor(strokeColor);
  1587. mxShapeBpmn2SendMarker.prototype.paintVertexShape(c, 4, 4, 18, 13);
  1588. break;
  1589. case 'receive':
  1590. mxShapeBpmn2SendMarker.prototype.paintVertexShape(c, 4, 4, 18, 13);
  1591. break;
  1592. case 'user':
  1593. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.user_task');
  1594. if (stencil != null)
  1595. {
  1596. stencil.drawShape(c, this, 2, 2, 16, 16);
  1597. }
  1598. break;
  1599. case 'manual':
  1600. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.manual_task');
  1601. if (stencil != null)
  1602. {
  1603. stencil.drawShape(c, this, 3, 3, 18, 14);
  1604. }
  1605. break;
  1606. case 'businessRule':
  1607. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.business_rule_task');
  1608. if (stencil != null)
  1609. {
  1610. stencil.drawShape(c, this, 4, 4, 18, 14);
  1611. }
  1612. break;
  1613. case 'script':
  1614. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.script_task');
  1615. if (stencil != null)
  1616. {
  1617. stencil.drawShape(c, this, 3, 3, 19, 18);
  1618. }
  1619. break;
  1620. }
  1621. var symbolW = 20;
  1622. var symbolH = 20;
  1623. var outline = mxUtils.getValue(this.style, 'outline', 'none');
  1624. var symbol = mxUtils.getValue(this.style, 'symbol', 'standard');
  1625. mxShapeBpmnEvent.prototype.strictDrawShape.call(this, c, 0, 0, symbolW, symbolH, outline, symbol);
  1626. };
  1627. mxCellRenderer.registerShape(mxShapeBpmn2Task.prototype.cst.TASK, mxShapeBpmn2Task);
  1628. //**********************************************************************************************************************************************************
  1629. //Task v2
  1630. //**********************************************************************************************************************************************************
  1631. /**
  1632. * Extends mxShape.
  1633. */
  1634. function mxShapeBpmn2Task2(bounds, fill, stroke, strokewidth)
  1635. {
  1636. mxCellRenderer.prototype.getShape('mxgraph.basic.rect').call(this);
  1637. this.bounds = bounds;
  1638. this.fill = fill;
  1639. this.stroke = stroke;
  1640. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1641. this.dy = 0.5;
  1642. this.dx = 0.5;
  1643. this.notch = 0;
  1644. };
  1645. /**
  1646. * Extends mxShape.
  1647. */
  1648. mxUtils.extend(mxShapeBpmn2Task2, mxCellRenderer.prototype.getShape('mxgraph.basic.rect'));
  1649. mxShapeBpmn2Task2.prototype.customProperties = [
  1650. {name: 'bpmnShapeType', dispName: 'Type', defVal: 'task', type: 'enum',
  1651. enumList: [{val: 'task', dispName: 'Task'},
  1652. {val: 'transaction', dispName: 'Transaction'},
  1653. {val: 'call', dispName: 'Call'},
  1654. {val: 'subprocess', dispName: 'Sub-Process'}]},
  1655. {name: 'taskMarker', dispName: 'Task Marker', defVal: 'abstract', type: 'enum',
  1656. enumList: [{val: 'abstract', dispName: 'Abstract'},
  1657. {val: 'service', dispName: 'Service'},
  1658. {val: 'send', dispName: 'Send'},
  1659. {val: 'receive', dispName: 'Receive'},
  1660. {val: 'user', dispName: 'User'},
  1661. {val: 'nime', dispName: 'Non-Interrupting Message Event'},
  1662. {val: 'manual', dispName: 'Manual'},
  1663. {val: 'businessRule', dispName: 'Business Rule'},
  1664. {val: 'script', dispName: 'Script'}]},
  1665. {name: 'isLoopSub', dispName: 'Subprocess', type: 'bool'},
  1666. {name: 'isLoopStandard', dispName: 'Standard Loop', type: 'bool'},
  1667. {name: 'isLoopMultiParallel', dispName: 'Multi-Instance Parallel Loop', type: 'bool'},
  1668. {name: 'isLoopMultiSeq', dispName: 'Multi-Instance Sequential Loop', type: 'bool'},
  1669. {name: 'isLoopComp', dispName: 'Compensation Loop', type: 'bool'},
  1670. {name: 'isAdHoc', dispName: 'Ad Hoc', type: 'bool'}
  1671. ];
  1672. mxShapeBpmn2Task2.prototype.customProperties = mxShapeBpmn2Task2.prototype.customProperties.concat(mxShapeBpmnEvent.prototype.customProperties);
  1673. mxShapeBpmn2Task2.prototype.customProperties = mxShapeBpmn2Task2.prototype.customProperties.concat(mxCellRenderer.prototype.getShape('mxgraph.basic.rect').prototype.customProperties);
  1674. mxShapeBpmn2Task2.prototype.eventTypeEnum = mxShapeBpmnEvent.prototype.eventTypeEnum;
  1675. mxShapeBpmn2Task2.prototype.eventEnum = mxShapeBpmnEvent.prototype.eventEnum;
  1676. mxShapeBpmn2Task2.prototype.miscEnum = mxShapeBpmnEvent.prototype.miscEnum;
  1677. mxShapeBpmn2Task2.prototype.cst = {
  1678. TASK : 'mxgraph.bpmn.task2'
  1679. };
  1680. /**
  1681. * Function: paintVertexShape
  1682. *
  1683. * Paints the vertex shape.
  1684. */
  1685. mxShapeBpmn2Task2.prototype.paintVertexShape = function(c, x, y, w, h)
  1686. {
  1687. var bpmnShapeType = mxUtils.getValue(this.style, 'bpmnShapeType', 'task');
  1688. var taskMarker = mxUtils.getValue(this.style, 'taskMarker', 'abstract');
  1689. var strokeWidth = mxUtils.getValue(this.style, 'strokeWidth', 1);
  1690. var dashed = mxUtils.getValue(this.style, 'dashed', false);
  1691. var inset = mxUtils.getValue(this.style, 'indent', 3);
  1692. var offsetY = 14 + strokeWidth * 0.5;
  1693. if (bpmnShapeType == 'call')
  1694. {
  1695. offsetY = 14 + strokeWidth * 2;
  1696. }
  1697. var rectOutline = mxUtils.getValue(this.style, 'rectOutline', 'single');
  1698. c.translate(x, y);
  1699. var superShape = mxCellRenderer.prototype.getShape('mxgraph.basic.rect');
  1700. var overrideStyles = {};
  1701. if (bpmnShapeType == 'transaction')
  1702. {
  1703. offsetY += inset;
  1704. overrideStyles.rectOutline = 'double';
  1705. overrideStyles.indent = 3;
  1706. }
  1707. else if (bpmnShapeType == 'subprocess')
  1708. {
  1709. overrideStyles.dashed = true;
  1710. }
  1711. else if (bpmnShapeType == 'call')
  1712. {
  1713. overrideStyles.strokeWidth = strokeWidth * 4;
  1714. }
  1715. superShape.prototype.strictDrawShape.call(this, c, 0, 0, w, h, overrideStyles);
  1716. c.setStrokeWidth(strokeWidth);
  1717. c.setDashed(dashed);
  1718. if (bpmnShapeType == 'call')
  1719. {
  1720. c.setStrokeWidth(strokeWidth);
  1721. }
  1722. c.setDashed(false);
  1723. c.setShadow(false);
  1724. var isLoopSub = mxUtils.getValue(this.style, 'isLoopSub', false);
  1725. var isLoopStandard = mxUtils.getValue(this.style, 'isLoopStandard', false);
  1726. var isLoopMultiParallel = mxUtils.getValue(this.style, 'isLoopMultiParallel', false);
  1727. var isLoopMultiSeq = mxUtils.getValue(this.style, 'isLoopMultiSeq', false);
  1728. var isLoopComp = mxUtils.getValue(this.style, 'isLoopComp', false);
  1729. var isAdHoc = mxUtils.getValue(this.style, 'isAdHoc', false);
  1730. var loopnum = 0;
  1731. if (isLoopStandard) loopnum++;
  1732. if (isLoopMultiParallel) loopnum++;
  1733. if (isLoopMultiSeq) loopnum++;
  1734. if (isLoopComp) loopnum++;
  1735. if (isLoopSub) loopnum++;
  1736. if (isAdHoc) loopnum++;
  1737. var iconSpaceX = 14;
  1738. var currXOffset = - iconSpaceX * loopnum * 0.5;
  1739. c.setStrokeWidth(1);
  1740. if (isLoopStandard)
  1741. {
  1742. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.loop');
  1743. if (stencil != null)
  1744. {
  1745. var previousSetStrokeWidth = c.setStrokeWidth;
  1746. c.setStrokeWidth = function() { };
  1747. stencil.drawShape(c, this, w * 0.5 + currXOffset + 1, h - offsetY + 1, 12, 12);
  1748. c.setStrokeWidth = previousSetStrokeWidth;
  1749. currXOffset += iconSpaceX;
  1750. }
  1751. }
  1752. if (isLoopMultiParallel)
  1753. {
  1754. c.translate(w * 0.5 + currXOffset + 1, h - offsetY + 1);
  1755. c.begin();
  1756. c.moveTo(2.4, 0);
  1757. c.lineTo(2.4, 12);
  1758. c.moveTo(6, 0);
  1759. c.lineTo(6, 12);
  1760. c.moveTo(9.6, 0);
  1761. c.lineTo(9.6, 12);
  1762. c.stroke();
  1763. c.translate(- w * 0.5 - currXOffset - 1, offsetY - 1 - h);
  1764. currXOffset += iconSpaceX;
  1765. }
  1766. if (isLoopMultiSeq)
  1767. {
  1768. c.translate(w * 0.5 + currXOffset + 1, h - offsetY + 1);
  1769. c.begin();
  1770. c.moveTo(0, 2.4);
  1771. c.lineTo(12, 2.4);
  1772. c.moveTo(0, 6);
  1773. c.lineTo(12, 6);
  1774. c.moveTo(0, 9.6);
  1775. c.lineTo(12, 9.6);
  1776. c.stroke();
  1777. c.translate(- w * 0.5 - currXOffset - 1, offsetY - 1 - h);
  1778. currXOffset += iconSpaceX;
  1779. }
  1780. if (isLoopComp)
  1781. {
  1782. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.compensation');
  1783. if (stencil != null)
  1784. {
  1785. var previousSetStrokeWidth = c.setStrokeWidth;
  1786. c.setStrokeWidth = function() { };
  1787. stencil.drawShape(c, this, w * 0.5 + currXOffset, h - offsetY + 1, 14, 12);
  1788. c.setStrokeWidth = previousSetStrokeWidth;
  1789. currXOffset += iconSpaceX;
  1790. }
  1791. }
  1792. if (isLoopSub)
  1793. {
  1794. c.translate(w * 0.5 + currXOffset, h - offsetY);
  1795. c.rect(0, 0, 14, 14);
  1796. c.stroke();
  1797. c.begin();
  1798. c.moveTo(4, 7);
  1799. c.lineTo(10, 7);
  1800. c.moveTo(7, 4);
  1801. c.lineTo(7, 10);
  1802. c.stroke();
  1803. c.translate(- w * 0.5 - currXOffset, offsetY - h);
  1804. currXOffset += iconSpaceX;
  1805. }
  1806. if (isAdHoc)
  1807. {
  1808. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.ad_hoc');
  1809. if (stencil != null)
  1810. {
  1811. var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');
  1812. var fillColor = mxUtils.getValue(this.style, 'fillColor', '#ffffff');
  1813. c.setStrokeColor('none');
  1814. c.setFillColor(strokeColor);
  1815. stencil.drawShape(c, this, w * 0.5 + currXOffset + 1, h - offsetY + 4, 12, 6);
  1816. currXOffset += iconSpaceX;
  1817. c.setStrokeColor(strokeColor);
  1818. c.setFillColor(fillColor);
  1819. c.setStrokeWidth(1);
  1820. }
  1821. }
  1822. var inlet = strokeWidth * 0.5;
  1823. if (bpmnShapeType == 'call')
  1824. {
  1825. inlet = strokeWidth * 2;
  1826. }
  1827. switch (taskMarker) {
  1828. case 'abstract':
  1829. break;
  1830. case 'service':
  1831. c.setFillColor(mxUtils.getValue(this.style, 'fillColor', '#ffffff'));
  1832. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.service_task');
  1833. if (stencil != null)
  1834. {
  1835. var previousSetStrokeWidth = c.setStrokeWidth;
  1836. c.setStrokeWidth = function() { };
  1837. stencil.drawShape(c, this, inlet + 2, inlet + 2, 16, 16);
  1838. c.setStrokeWidth = previousSetStrokeWidth;
  1839. }
  1840. break;
  1841. case 'send':
  1842. var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');
  1843. var fillColor = mxUtils.getValue(this.style, 'fillColor', '#ffffff');
  1844. c.setStrokeColor(fillColor);
  1845. c.setFillColor(strokeColor);
  1846. mxShapeBpmn2SendMarker.prototype.paintVertexShape(c, inlet + 4, inlet + 4, 18, 13);
  1847. break;
  1848. case 'receive':
  1849. mxShapeBpmn2SendMarker.prototype.paintVertexShape(c, inlet + 4, inlet + 4, 18, 13);
  1850. break;
  1851. case 'user':
  1852. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.user_task');
  1853. if (stencil != null)
  1854. {
  1855. var previousSetStrokeWidth = c.setStrokeWidth;
  1856. c.setStrokeWidth = function() { };
  1857. stencil.drawShape(c, this, inlet + 2, inlet + 2, 16, 16);
  1858. c.setStrokeWidth = previousSetStrokeWidth;
  1859. }
  1860. break;
  1861. case 'manual':
  1862. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.manual_task');
  1863. if (stencil != null)
  1864. {
  1865. var previousSetStrokeWidth = c.setStrokeWidth;
  1866. c.setStrokeWidth = function() { };
  1867. stencil.drawShape(c, this, inlet + 3, inlet + 3, 18, 14);
  1868. c.setStrokeWidth = previousSetStrokeWidth;
  1869. }
  1870. break;
  1871. case 'businessRule':
  1872. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.business_rule_task');
  1873. if (stencil != null)
  1874. {
  1875. var previousSetStrokeWidth = c.setStrokeWidth;
  1876. c.setStrokeWidth = function() { };
  1877. stencil.drawShape(c, this, inlet + 4, inlet + 4, 18, 14);
  1878. c.setStrokeWidth = previousSetStrokeWidth;
  1879. }
  1880. break;
  1881. case 'script':
  1882. var stencil = mxStencilRegistry.getStencil('mxgraph.bpmn.script_task');
  1883. if (stencil != null)
  1884. {
  1885. var previousSetStrokeWidth = c.setStrokeWidth;
  1886. c.setStrokeWidth = function() { };
  1887. stencil.drawShape(c, this, inlet + 3, inlet + 3, 19, 18);
  1888. c.setStrokeWidth = previousSetStrokeWidth;
  1889. }
  1890. break;
  1891. }
  1892. var symbolW = 20;
  1893. var symbolH = 20;
  1894. var outline = mxUtils.getValue(this.style, 'outline', 'none');
  1895. var symbol = mxUtils.getValue(this.style, 'symbol', 'standard');
  1896. var previousSetStrokeWidth = c.setStrokeWidth;
  1897. c.setStrokeWidth = function() { };
  1898. mxShapeBpmnEvent.prototype.strictDrawShape.call(this, c, inlet, inlet, symbolW, symbolH, outline, symbol);
  1899. c.setStrokeWidth = previousSetStrokeWidth;
  1900. };
  1901. mxCellRenderer.registerShape(mxShapeBpmn2Task2.prototype.cst.TASK, mxShapeBpmn2Task2);
  1902. //**********************************************************************************************************************************************************
  1903. //Data (LEGACY)
  1904. //**********************************************************************************************************************************************************
  1905. /**
  1906. * Extends mxShape.
  1907. */
  1908. function mxShapeBpmn2Data(bounds, fill, stroke, strokewidth)
  1909. {
  1910. mxCellRenderer.prototype.getShape('note').call(this);
  1911. this.bounds = bounds;
  1912. this.fill = fill;
  1913. this.stroke = stroke;
  1914. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1915. this.dy = 0.5;
  1916. this.dx = 0.5;
  1917. this.notch = 0;
  1918. };
  1919. /**
  1920. * Extends mxShape.
  1921. */
  1922. mxUtils.extend(mxShapeBpmn2Data, mxCellRenderer.prototype.getShape('note'));
  1923. mxShapeBpmn2Data.prototype.cst = {
  1924. DATA : 'mxgraph.bpmn.data'
  1925. };
  1926. mxShapeBpmn2Data.prototype.customProperties = [
  1927. {name: 'bpmnTransferType', dispName: 'Transfer Type', defVal: 'none', type: 'enum',
  1928. enumList: [{val: 'none', dispName: 'None'},
  1929. {val: 'input', dispName: 'Input'},
  1930. {val: 'output', dispName: 'Output'}]},
  1931. {name: 'isCollection', dispName: 'Collection', type: 'bool'}
  1932. ];
  1933. /**
  1934. * Function: paintVertexShape
  1935. *
  1936. * Paints the vertex shape.
  1937. */
  1938. mxShapeBpmn2Data.prototype.paintVertexShape = function(c, x, y, w, h)
  1939. {
  1940. var superShape = mxCellRenderer.prototype.getShape('note');
  1941. superShape.prototype.paintVertexShape.call(this, c, x, y, w, h);
  1942. var trType = mxUtils.getValue(this.style, 'bpmnTransferType', 'none');
  1943. var isColl = mxUtils.getValue(this.style, 'isCollection', false);
  1944. c.setShadow(false);
  1945. if (trType === 'input' || trType === 'output')
  1946. {
  1947. var arrX = 3;
  1948. var arrY = 3;
  1949. var arrW = 14;
  1950. var arrH = 12;
  1951. c.translate(arrX, arrY);
  1952. c.begin();
  1953. c.moveTo(0, arrH * 0.3);
  1954. c.lineTo(arrW * 0.55, arrH * 0.3);
  1955. c.lineTo(arrW * 0.55, 0);
  1956. c.lineTo(arrW, arrH * 0.5);
  1957. c.lineTo(arrW * 0.55, arrH);
  1958. c.lineTo(arrW * 0.55, arrH * 0.7);
  1959. c.lineTo(0, arrH * 0.7);
  1960. c.close();
  1961. c.translate(-arrX, -arrY);
  1962. if (trType === 'input')
  1963. {
  1964. c.stroke();
  1965. }
  1966. else
  1967. {
  1968. var fillColor = mxUtils.getValue(this.style, 'fillColor', '#ffffff');
  1969. var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');
  1970. c.setFillColor(strokeColor);
  1971. c.fillAndStroke();
  1972. c.setFillColor(fillColor);
  1973. }
  1974. }
  1975. if (isColl)
  1976. {
  1977. c.translate(w * 0.5 - 6, h - 12);
  1978. c.begin();
  1979. c.moveTo(2.4, 0);
  1980. c.lineTo(2.4, 12);
  1981. c.moveTo(6, 0);
  1982. c.lineTo(6, 12);
  1983. c.moveTo(9.6, 0);
  1984. c.lineTo(9.6, 12);
  1985. c.stroke();
  1986. c.translate( - w * 0.5 + 6, - h + 12);
  1987. }
  1988. };
  1989. mxCellRenderer.registerShape(mxShapeBpmn2Data.prototype.cst.DATA, mxShapeBpmn2Data);
  1990. Graph.handleFactory[mxShapeBpmn2Data.prototype.cst.DATA] = Graph.handleFactory['note'];
  1991. //**********************************************************************************************************************************************************
  1992. //Data v2
  1993. //**********************************************************************************************************************************************************
  1994. /**
  1995. * Extends mxShape.
  1996. */
  1997. function mxShapeBpmn2Data2(bounds, fill, stroke, strokewidth)
  1998. {
  1999. mxCellRenderer.prototype.getShape('note').call(this);
  2000. this.bounds = bounds;
  2001. this.fill = fill;
  2002. this.stroke = stroke;
  2003. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2004. this.dy = 0.5;
  2005. this.dx = 0.5;
  2006. this.notch = 0;
  2007. };
  2008. /**
  2009. * Extends mxShape.
  2010. */
  2011. mxUtils.extend(mxShapeBpmn2Data2, mxCellRenderer.prototype.getShape('note'));
  2012. mxShapeBpmn2Data2.prototype.cst = {
  2013. DATA : 'mxgraph.bpmn.data2'
  2014. };
  2015. mxShapeBpmn2Data2.prototype.customProperties = [
  2016. {name: 'bpmnTransferType', dispName: 'Transfer Type', defVal: 'none', type: 'enum',
  2017. enumList: [{val: 'none', dispName: 'None'},
  2018. {val: 'input', dispName: 'Input'},
  2019. {val: 'output', dispName: 'Output'}]},
  2020. {name: 'isCollection', dispName: 'Collection', type: 'bool'}
  2021. ];
  2022. /**
  2023. * Function: paintVertexShape
  2024. *
  2025. * Paints the vertex shape.
  2026. */
  2027. mxShapeBpmn2Data2.prototype.paintVertexShape = function(c, x, y, w, h)
  2028. {
  2029. var superShape = mxCellRenderer.prototype.getShape('note');
  2030. superShape.prototype.paintVertexShape.call(this, c, x, y, w, h);
  2031. var trType = mxUtils.getValue(this.style, 'bpmnTransferType', 'none');
  2032. var isColl = mxUtils.getValue(this.style, 'isCollection', false);
  2033. var strokeWidth = mxUtils.getValue(this.style, 'strokeWidth', 1);
  2034. c.setShadow(false);
  2035. c.setStrokeWidth(1);
  2036. if (trType === 'input' || trType === 'output')
  2037. {
  2038. var arrX = 3 + strokeWidth * 0.5;
  2039. var arrY = 3 + strokeWidth * 0.5;
  2040. var arrW = 14;
  2041. var arrH = 12;
  2042. c.translate(arrX, arrY);
  2043. c.begin();
  2044. c.moveTo(0, arrH * 0.3);
  2045. c.lineTo(arrW * 0.55, arrH * 0.3);
  2046. c.lineTo(arrW * 0.55, 0);
  2047. c.lineTo(arrW, arrH * 0.5);
  2048. c.lineTo(arrW * 0.55, arrH);
  2049. c.lineTo(arrW * 0.55, arrH * 0.7);
  2050. c.lineTo(0, arrH * 0.7);
  2051. c.close();
  2052. c.translate(-arrX, -arrY);
  2053. if (trType === 'input')
  2054. {
  2055. c.stroke();
  2056. }
  2057. else
  2058. {
  2059. var fillColor = mxUtils.getValue(this.style, 'fillColor', '#ffffff');
  2060. var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');
  2061. c.setFillColor(strokeColor);
  2062. c.fillAndStroke();
  2063. c.setFillColor(fillColor);
  2064. }
  2065. }
  2066. if (isColl)
  2067. {
  2068. c.translate(w * 0.5 - 6, h - 12 - strokeWidth * 0.5);
  2069. c.begin();
  2070. c.moveTo(2.4, 0);
  2071. c.lineTo(2.4, 12);
  2072. c.moveTo(6, 0);
  2073. c.lineTo(6, 12);
  2074. c.moveTo(9.6, 0);
  2075. c.lineTo(9.6, 12);
  2076. c.stroke();
  2077. c.translate( - w * 0.5 + 6, - h + 12);
  2078. }
  2079. };
  2080. mxCellRenderer.registerShape(mxShapeBpmn2Data2.prototype.cst.DATA, mxShapeBpmn2Data2);
  2081. Graph.handleFactory[mxShapeBpmn2Data2.prototype.cst.DATA] = Graph.handleFactory['note'];
  2082. //**********************************************************************************************************************************************************
  2083. //Swimlane
  2084. //**********************************************************************************************************************************************************
  2085. /**
  2086. * Extends mxShape.
  2087. */
  2088. function mxShapeBpmn2Swimlane(bounds, fill, stroke, strokewidth)
  2089. {
  2090. mxCellRenderer.prototype.getShape('note').call(this);
  2091. this.bounds = bounds;
  2092. this.fill = fill;
  2093. this.stroke = stroke;
  2094. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2095. this.dy = 0.5;
  2096. this.dx = 0.5;
  2097. this.notch = 0;
  2098. };
  2099. /**
  2100. * Extends mxShape.
  2101. */
  2102. mxUtils.extend(mxShapeBpmn2Swimlane, mxSwimlane);
  2103. mxShapeBpmn2Swimlane.prototype.cst = {
  2104. SWIMLANE : 'mxgraph.bpmn.swimlane'
  2105. };
  2106. mxShapeBpmn2Swimlane.prototype.customProperties = [
  2107. {name: 'isCollection', dispName: 'Collection', type: 'bool'}
  2108. ];
  2109. /**
  2110. * Function: paintVertexShape
  2111. *
  2112. * Paints the vertex shape.
  2113. */
  2114. mxShapeBpmn2Swimlane.prototype.paintVertexShape = function(c, x, y, w, h)
  2115. {
  2116. mxSwimlane.prototype.paintVertexShape.call(this, c, x, y, w, h);
  2117. var isColl = mxUtils.getValue(this.style, 'isCollection', false);
  2118. c.setShadow(false);
  2119. if (isColl)
  2120. {
  2121. c.translate(w * 0.5 - 6, h - 12);
  2122. c.begin();
  2123. c.moveTo(2.4, 0);
  2124. c.lineTo(2.4, 12);
  2125. c.moveTo(6, 0);
  2126. c.lineTo(6, 12);
  2127. c.moveTo(9.6, 0);
  2128. c.lineTo(9.6, 12);
  2129. c.stroke();
  2130. c.translate( - w * 0.5 + 6, - h + 12);
  2131. }
  2132. };
  2133. mxCellRenderer.registerShape(mxShapeBpmn2Swimlane.prototype.cst.SWIMLANE, mxShapeBpmn2Swimlane);
  2134. Graph.handleFactory[mxShapeBpmn2Swimlane.prototype.cst.SWIMLANE] = Graph.handleFactory['swimlane'];
  2135. //**********************************************************************************************************************************************************
  2136. //Conversation (LEGACY)
  2137. //**********************************************************************************************************************************************************
  2138. /**
  2139. * Extends mxShape.
  2140. */
  2141. function mxShapeBpmn2Conversation(bounds, fill, stroke, strokewidth)
  2142. {
  2143. mxShape.call(this);
  2144. this.bounds = bounds;
  2145. this.fill = fill;
  2146. this.stroke = stroke;
  2147. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2148. };
  2149. /**
  2150. * Extends mxShape.
  2151. */
  2152. mxUtils.extend(mxShapeBpmn2Conversation, mxHexagon);
  2153. mxShapeBpmn2Conversation.prototype.customProperties = [
  2154. {name: 'bpmnConversationType', dispName: 'Type', defVal: 'conv', type: 'enum',
  2155. enumList: [{val: 'conv', dispName: 'Conversation'},
  2156. {val: 'call', dispName: 'Call'}]},
  2157. {name: 'isLoopSub', dispName: 'Subprocess', type: 'bool'}
  2158. ];
  2159. mxShapeBpmn2Conversation.prototype.cst = {
  2160. CONVERSATION : 'mxgraph.bpmn.conversation'
  2161. };
  2162. /**
  2163. * Function: paintVertexShape
  2164. *
  2165. * Paints the vertex shape.
  2166. */
  2167. mxShapeBpmn2Conversation.prototype.paintVertexShape = function(c, x, y, w, h)
  2168. {
  2169. var bpmnConvType = mxUtils.getValue(this.style, 'bpmnConversationType', 'conv');
  2170. var strokeWidth = mxUtils.getValue(this.style, 'strokeWidth', 1);
  2171. if (bpmnConvType == 'call')
  2172. {
  2173. c.setStrokeWidth(strokeWidth * 4);
  2174. }
  2175. c.translate(x, y);
  2176. c.begin();
  2177. c.moveTo(0, h * 0.5);
  2178. c.lineTo(w * 0.25, 0);
  2179. c.lineTo(w * 0.75, 0);
  2180. c.lineTo(w, h * 0.5);
  2181. c.lineTo(w * 0.75, h);
  2182. c.lineTo(w * 0.25, h);
  2183. c.close();
  2184. c.fillAndStroke();
  2185. if (bpmnConvType == 'call')
  2186. {
  2187. c.setStrokeWidth(strokeWidth);
  2188. }
  2189. var isLoopSub = mxUtils.getValue(this.style, 'isLoopSub', false);
  2190. if (isLoopSub)
  2191. {
  2192. c.translate(w * 0.5 - 7, h - 14);
  2193. c.rect(0, 0, 14, 14);
  2194. c.stroke();
  2195. c.begin();
  2196. c.moveTo(4, 7);
  2197. c.lineTo(10, 7);
  2198. c.moveTo(7, 4);
  2199. c.lineTo(7, 10);
  2200. c.stroke();
  2201. }
  2202. };
  2203. mxCellRenderer.registerShape(mxShapeBpmn2Conversation.prototype.cst.CONVERSATION, mxShapeBpmn2Conversation);
  2204. //**********************************************************************************************************************************************************
  2205. //Conversation v2
  2206. //**********************************************************************************************************************************************************
  2207. /**
  2208. * Extends mxShape.
  2209. */
  2210. function mxShapeBpmn2Conversation2(bounds, fill, stroke, strokewidth)
  2211. {
  2212. mxShape.call(this);
  2213. this.bounds = bounds;
  2214. this.fill = fill;
  2215. this.stroke = stroke;
  2216. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  2217. };
  2218. /**
  2219. * Extends mxShape.
  2220. */
  2221. mxUtils.extend(mxShapeBpmn2Conversation2, mxHexagon);
  2222. mxShapeBpmn2Conversation2.prototype.customProperties = [
  2223. {name: 'bpmnConversationType', dispName: 'Type', defVal: 'conv', type: 'enum',
  2224. enumList: [{val: 'conv', dispName: 'Conversation'},
  2225. {val: 'call', dispName: 'Call'}]},
  2226. {name: 'isLoopSub', dispName: 'Subprocess', type: 'bool'}
  2227. ];
  2228. mxShapeBpmn2Conversation2.prototype.cst = {
  2229. CONVERSATION : 'mxgraph.bpmn.conversation2'
  2230. };
  2231. /**
  2232. * Function: paintVertexShape
  2233. *
  2234. * Paints the vertex shape.
  2235. */
  2236. mxShapeBpmn2Conversation2.prototype.paintVertexShape = function(c, x, y, w, h)
  2237. {
  2238. var bpmnConvType = mxUtils.getValue(this.style, 'bpmnConversationType', 'conv');
  2239. var strokeWidth = mxUtils.getValue(this.style, 'strokeWidth', 1);
  2240. if (bpmnConvType == 'call')
  2241. {
  2242. c.setStrokeWidth(strokeWidth * 4);
  2243. }
  2244. c.translate(x, y);
  2245. c.begin();
  2246. c.moveTo(0, h * 0.5);
  2247. c.lineTo(w * 0.25, 0);
  2248. c.lineTo(w * 0.75, 0);
  2249. c.lineTo(w, h * 0.5);
  2250. c.lineTo(w * 0.75, h);
  2251. c.lineTo(w * 0.25, h);
  2252. c.close();
  2253. c.fillAndStroke();
  2254. c.setStrokeWidth(1);
  2255. var isLoopSub = mxUtils.getValue(this.style, 'isLoopSub', false);
  2256. if (isLoopSub)
  2257. {
  2258. if (bpmnConvType == 'call')
  2259. {
  2260. c.translate(w * 0.5 - 7, h - 14 - strokeWidth * 2);
  2261. }
  2262. else
  2263. {
  2264. c.translate(w * 0.5 - 7, h - 14 - strokeWidth * 0.5);
  2265. }
  2266. c.rect(0, 0, 14, 14);
  2267. c.stroke();
  2268. c.begin();
  2269. c.moveTo(4, 7);
  2270. c.lineTo(10, 7);
  2271. c.moveTo(7, 4);
  2272. c.lineTo(7, 10);
  2273. c.stroke();
  2274. }
  2275. };
  2276. mxCellRenderer.registerShape(mxShapeBpmn2Conversation2.prototype.cst.CONVERSATION, mxShapeBpmn2Conversation2);