mxBpmnShape2.js 53 KB

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