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