mxEip.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. /**
  2. * $Id: mxEip.js,v 1.0 2014/11/27 06:09:21 mate Exp $
  3. * Copyright (c) 2006-2015, JGraph Ltd
  4. */
  5. //**********************************************************************************************************************************************************
  6. //Message Expiration
  7. //**********************************************************************************************************************************************************
  8. /**
  9. * Extends mxShape.
  10. */
  11. function mxShapeEipMessageExpiration(bounds, fill, stroke, strokewidth)
  12. {
  13. mxShape.call(this);
  14. this.bounds = bounds;
  15. this.fill = fill;
  16. this.stroke = stroke;
  17. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  18. };
  19. /**
  20. * Extends mxShape.
  21. */
  22. mxUtils.extend(mxShapeEipMessageExpiration, mxShape);
  23. mxShapeEipMessageExpiration.prototype.cst = {
  24. SHAPE_MESS_EXP : 'mxgraph.eip.messExp'
  25. };
  26. /**
  27. * Function: paintVertexShape
  28. *
  29. * Paints the vertex shape.
  30. */
  31. mxShapeEipMessageExpiration.prototype.paintVertexShape = function(c, x, y, w, h)
  32. {
  33. c.translate(x, y);
  34. this.background(c, x, y, w, h);
  35. };
  36. mxShapeEipMessageExpiration.prototype.background = function(c, x, y, w, h)
  37. {
  38. c.ellipse(0, 0, w, h);
  39. c.stroke();
  40. c.setStrokeColor("#808080");
  41. c.begin();
  42. c.moveTo(w * 0.5, h * 0.1);
  43. c.lineTo(w * 0.5, h * 0.5);
  44. c.lineTo(w * 0.6, h * 0.8);
  45. c.stroke();
  46. };
  47. mxCellRenderer.registerShape(mxShapeEipMessageExpiration.prototype.cst.SHAPE_MESS_EXP, mxShapeEipMessageExpiration);
  48. mxShapeEipMessageExpiration.prototype.getConstraints = function(style, w, h)
  49. {
  50. var constr = [];
  51. constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.145), false));
  52. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  53. constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.145), false));
  54. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  55. constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.855), false));
  56. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  57. constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.855), false));
  58. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  59. return (constr);
  60. };
  61. //**********************************************************************************************************************************************************
  62. //Return Address
  63. //**********************************************************************************************************************************************************
  64. /**
  65. * Extends mxShape.
  66. */
  67. function mxShapeEipReturnAddress(bounds, fill, stroke, strokewidth)
  68. {
  69. mxShape.call(this);
  70. this.bounds = bounds;
  71. this.fill = fill;
  72. this.stroke = stroke;
  73. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  74. };
  75. /**
  76. * Extends mxShape.
  77. */
  78. mxUtils.extend(mxShapeEipReturnAddress, mxShape);
  79. mxShapeEipReturnAddress.prototype.cst = {
  80. SHAPE_RET_ADDR : 'mxgraph.eip.retAddr'
  81. };
  82. /**
  83. * Function: paintVertexShape
  84. *
  85. * Paints the vertex shape.
  86. */
  87. mxShapeEipReturnAddress.prototype.paintVertexShape = function(c, x, y, w, h)
  88. {
  89. c.translate(x, y);
  90. this.background(c, x, y, w, h);
  91. c.setShadow(false);
  92. this.foreground(c, x, y, w, h);
  93. };
  94. mxShapeEipReturnAddress.prototype.background = function(c, x, y, w, h)
  95. {
  96. c.rect(0, 0, w, h);
  97. c.fillAndStroke();
  98. };
  99. mxShapeEipReturnAddress.prototype.foreground = function(c, x, y, w, h)
  100. {
  101. c.begin();
  102. c.moveTo(w * 0.05, h * 0.11);
  103. c.lineTo(w * 0.25, h * 0.11);
  104. c.moveTo(w * 0.05, h * 0.18);
  105. c.lineTo(w * 0.25, h * 0.18);
  106. c.moveTo(w * 0.05, h * 0.25);
  107. c.lineTo(w * 0.25, h * 0.25);
  108. c.setStrokeWidth(2);
  109. c.moveTo(w * 0.3, h * 0.63);
  110. c.lineTo(w * 0.8, h * 0.63);
  111. c.moveTo(w * 0.3, h * 0.72);
  112. c.lineTo(w * 0.8, h * 0.72);
  113. c.moveTo(w * 0.3, h * 0.80);
  114. c.lineTo(w * 0.8, h * 0.80);
  115. c.stroke();
  116. c.setFillColor("#EDEDED");
  117. c.rect(w * 0.8, h * 0.1, w * 0.12, h * 0.19);
  118. c.fillAndStroke();
  119. };
  120. mxCellRenderer.registerShape(mxShapeEipReturnAddress.prototype.cst.SHAPE_RET_ADDR, mxShapeEipReturnAddress);
  121. mxShapeEipReturnAddress.prototype.getConstraints = function(style, w, h)
  122. {
  123. var constr = [];
  124. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
  125. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
  126. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
  127. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
  128. constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
  129. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
  130. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
  131. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
  132. constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
  133. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
  134. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
  135. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
  136. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
  137. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
  138. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
  139. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
  140. return (constr);
  141. };
  142. //**********************************************************************************************************************************************************
  143. //Anchor
  144. //**********************************************************************************************************************************************************
  145. /**
  146. * Extends mxShape.
  147. */
  148. function mxShapeEipAnchor(bounds, fill, stroke, strokewidth)
  149. {
  150. mxShape.call(this);
  151. this.bounds = bounds;
  152. this.fill = fill;
  153. this.stroke = stroke;
  154. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  155. };
  156. /**
  157. * Extends mxShape.
  158. */
  159. mxUtils.extend(mxShapeEipAnchor, mxShape);
  160. mxShapeEipAnchor.prototype.cst = {
  161. SHAPE_ANCHOR : 'mxgraph.eip.anchor'
  162. };
  163. /**
  164. * Function: paintVertexShape
  165. *
  166. * Paints the vertex shape.
  167. */
  168. mxShapeEipAnchor.prototype.paintVertexShape = function(c, x, y, w, h)
  169. {
  170. };
  171. mxCellRenderer.registerShape(mxShapeEipAnchor.prototype.cst.SHAPE_ANCHOR, mxShapeEipAnchor);
  172. //**********************************************************************************************************************************************************
  173. //Message Channel
  174. //**********************************************************************************************************************************************************
  175. /**
  176. * Extends mxShape.
  177. */
  178. function mxShapeEipMessageChannel(bounds, fill, stroke, strokewidth)
  179. {
  180. mxShape.call(this);
  181. this.bounds = bounds;
  182. this.fill = fill;
  183. this.stroke = stroke;
  184. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  185. };
  186. /**
  187. * Extends mxShape.
  188. */
  189. mxUtils.extend(mxShapeEipMessageChannel, mxShape);
  190. mxShapeEipMessageChannel.prototype.cst = {
  191. SHAPE_MESSAGE_CHANNEL : 'mxgraph.eip.messageChannel'
  192. };
  193. /**
  194. * Function: paintVertexShape
  195. *
  196. * Paints the vertex shape.
  197. */
  198. mxShapeEipMessageChannel.prototype.paintVertexShape = function(c, x, y, w, h)
  199. {
  200. c.translate(x, y);
  201. this.background(c, x, y, w, h);
  202. c.setShadow(false);
  203. this.foreground(c, x, y, w, h);
  204. };
  205. mxShapeEipMessageChannel.prototype.background = function(c, x, y, w, h)
  206. {
  207. c.setGradient('#e6e6e6', '#808080', 0, 0, w, h, mxConstants.DIRECTION_SOUTH, 1, 1);
  208. c.begin();
  209. c.moveTo(8, h * 0.5 + 10);
  210. c.arcTo(12, 12, 0, 0, 1, 8, h * 0.5 - 10);
  211. c.lineTo(w - 8, h * 0.5 - 10);
  212. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);
  213. c.close();
  214. c.fillAndStroke();
  215. };
  216. mxShapeEipMessageChannel.prototype.foreground = function(c, x, y, w, h)
  217. {
  218. c.setFillColor('#e6e6e6');
  219. c.begin();
  220. c.moveTo(w - 8, h * 0.5 - 10);
  221. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);
  222. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 - 10);
  223. c.fillAndStroke();
  224. };
  225. mxCellRenderer.registerShape(mxShapeEipMessageChannel.prototype.cst.SHAPE_MESSAGE_CHANNEL, mxShapeEipMessageChannel);
  226. mxShapeEipMessageChannel.prototype.getConstraints = function(style, w, h)
  227. {
  228. var constr = [];
  229. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 2.7, 0));
  230. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -2.7, 0));
  231. var currW = 10;
  232. while (currW < w)
  233. {
  234. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, currW, 0));
  235. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, currW, 0));
  236. currW = currW + 10;
  237. }
  238. return (constr);
  239. };
  240. //**********************************************************************************************************************************************************
  241. //Datatype Channel
  242. //**********************************************************************************************************************************************************
  243. /**
  244. * Extends mxShape.
  245. */
  246. function mxShapeEipDatatypeChannel(bounds, fill, stroke, strokewidth)
  247. {
  248. mxShape.call(this);
  249. this.bounds = bounds;
  250. this.fill = fill;
  251. this.stroke = stroke;
  252. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  253. };
  254. /**
  255. * Extends mxShape.
  256. */
  257. mxUtils.extend(mxShapeEipDatatypeChannel, mxShape);
  258. mxShapeEipDatatypeChannel.prototype.cst = {
  259. SHAPE_DATATYPE_CHANNEL : 'mxgraph.eip.dataChannel'
  260. };
  261. /**
  262. * Function: paintVertexShape
  263. *
  264. * Paints the vertex shape.
  265. */
  266. mxShapeEipDatatypeChannel.prototype.paintVertexShape = function(c, x, y, w, h)
  267. {
  268. c.translate(x, y);
  269. this.background(c, x, y, w, h);
  270. c.setShadow(false);
  271. this.foreground(c, x, y, w, h);
  272. };
  273. mxShapeEipDatatypeChannel.prototype.background = function(c, x, y, w, h)
  274. {
  275. c.setGradient('#e6e6e6', '#808080', 0, 0, w, h, mxConstants.DIRECTION_SOUTH, 1, 1);
  276. c.begin();
  277. c.moveTo(8, h * 0.5 + 10);
  278. c.arcTo(12, 12, 0, 0, 1, 8, h * 0.5 - 10);
  279. c.lineTo(w - 8, h * 0.5 - 10);
  280. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);
  281. c.close();
  282. c.fillAndStroke();
  283. };
  284. mxShapeEipDatatypeChannel.prototype.foreground = function(c, x, y, w, h)
  285. {
  286. c.setFillColor('#e6e6e6');
  287. c.begin();
  288. c.moveTo(w - 8, h * 0.5 - 10);
  289. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);
  290. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 - 10);
  291. c.fillAndStroke();
  292. c.setFillColor("#fffbc0");
  293. c.setStrokeWidth("1");
  294. for(var i = 1; i * 20 + 10 < w - 14; i++)
  295. {
  296. c.rect(i * 20, h * 0.5 - 5, 10, 10);
  297. c.fillAndStroke();
  298. };
  299. };
  300. mxCellRenderer.registerShape(mxShapeEipDatatypeChannel.prototype.cst.SHAPE_DATATYPE_CHANNEL, mxShapeEipDatatypeChannel);
  301. mxShapeEipDatatypeChannel.prototype.getConstraints = function(style, w, h)
  302. {
  303. var constr = [];
  304. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 2.7, 0));
  305. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -2.7, 0));
  306. var currW = 10;
  307. while (currW < w)
  308. {
  309. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, currW, 0));
  310. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, currW, 0));
  311. currW = currW + 10;
  312. }
  313. return (constr);
  314. };
  315. //**********************************************************************************************************************************************************
  316. //Dead Letter Channel
  317. //**********************************************************************************************************************************************************
  318. /**
  319. * Extends mxShape.
  320. */
  321. function mxShapeEipDeadLetterChannel(bounds, fill, stroke, strokewidth)
  322. {
  323. mxShape.call(this);
  324. this.bounds = bounds;
  325. this.fill = fill;
  326. this.stroke = stroke;
  327. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  328. };
  329. /**
  330. * Extends mxShape.
  331. */
  332. mxUtils.extend(mxShapeEipDeadLetterChannel, mxShape);
  333. mxShapeEipDeadLetterChannel.prototype.cst = {
  334. SHAPE_DEAD_LETTER_CHANNEL : 'mxgraph.eip.deadLetterChannel'
  335. };
  336. /**
  337. * Function: paintVertexShape
  338. *
  339. * Paints the vertex shape.
  340. */
  341. mxShapeEipDeadLetterChannel.prototype.paintVertexShape = function(c, x, y, w, h)
  342. {
  343. c.translate(x, y);
  344. this.background(c, x, y, w, h);
  345. c.setShadow(false);
  346. this.foreground(c, x, y, w, h);
  347. };
  348. mxShapeEipDeadLetterChannel.prototype.background = function(c, x, y, w, h)
  349. {
  350. c.setGradient('#e6e6e6', '#808080', 0, 0, w, h, mxConstants.DIRECTION_SOUTH, 1, 1);
  351. c.begin();
  352. c.moveTo(8, h * 0.5 + 10);
  353. c.arcTo(12, 12, 0, 0, 1, 8, h * 0.5 - 10);
  354. c.lineTo(w - 8, h * 0.5 - 10);
  355. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);
  356. c.close();
  357. c.fillAndStroke();
  358. };
  359. mxShapeEipDeadLetterChannel.prototype.foreground = function(c, x, y, w, h)
  360. {
  361. c.setFillColor('#e6e6e6');
  362. c.begin();
  363. c.moveTo(w - 8, h * 0.5 - 10);
  364. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);
  365. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 - 10);
  366. c.fillAndStroke();
  367. c.setFillColor("#ff0000");
  368. c.setStrokeWidth("1");
  369. c.begin();
  370. c.moveTo(w * 0.5 - 6, h * 0.5 - 3);
  371. c.lineTo(w * 0.5 - 3, h * 0.5 - 6);
  372. c.lineTo(w * 0.5 + 3, h * 0.5 - 6);
  373. c.lineTo(w * 0.5 + 6, h * 0.5 - 3);
  374. c.lineTo(w * 0.5 + 6, h * 0.5 + 3);
  375. c.lineTo(w * 0.5 + 3, h * 0.5 + 6);
  376. c.lineTo(w * 0.5 - 3, h * 0.5 + 6);
  377. c.lineTo(w * 0.5 - 6, h * 0.5 + 3);
  378. c.close();
  379. c.fillAndStroke();
  380. c.setStrokeWidth("2");
  381. c.setStrokeColor("#ffffff");
  382. c.begin();
  383. c.moveTo(w * 0.5 - 4, h * 0.5);
  384. c.lineTo(w * 0.5 + 4, h * 0.5);
  385. c.stroke();
  386. };
  387. mxCellRenderer.registerShape(mxShapeEipDeadLetterChannel.prototype.cst.SHAPE_DEAD_LETTER_CHANNEL, mxShapeEipDeadLetterChannel);
  388. mxShapeEipDeadLetterChannel.prototype.getConstraints = function(style, w, h)
  389. {
  390. var constr = [];
  391. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 2.7, 0));
  392. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -2.7, 0));
  393. var currW = 10;
  394. while (currW < w)
  395. {
  396. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, currW, 0));
  397. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, currW, 0));
  398. currW = currW + 10;
  399. }
  400. return (constr);
  401. };
  402. //**********************************************************************************************************************************************************
  403. //Invalid Message Channel
  404. //**********************************************************************************************************************************************************
  405. /**
  406. * Extends mxShape.
  407. */
  408. function mxShapeEipInvalidMessageChannel(bounds, fill, stroke, strokewidth)
  409. {
  410. mxShape.call(this);
  411. this.bounds = bounds;
  412. this.fill = fill;
  413. this.stroke = stroke;
  414. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  415. };
  416. /**
  417. * Extends mxShape.
  418. */
  419. mxUtils.extend(mxShapeEipInvalidMessageChannel, mxShape);
  420. mxShapeEipInvalidMessageChannel.prototype.cst = {
  421. SHAPE_INVALID_MESSAGE_CHANNEL : 'mxgraph.eip.invalidMessageChannel'
  422. };
  423. /**
  424. * Function: paintVertexShape
  425. *
  426. * Paints the vertex shape.
  427. */
  428. mxShapeEipInvalidMessageChannel.prototype.paintVertexShape = function(c, x, y, w, h)
  429. {
  430. c.translate(x, y);
  431. this.background(c, x, y, w, h);
  432. c.setShadow(false);
  433. this.foreground(c, x, y, w, h);
  434. };
  435. mxShapeEipInvalidMessageChannel.prototype.background = function(c, x, y, w, h)
  436. {
  437. c.setGradient('#e6e6e6', '#808080', 0, 0, w, h, mxConstants.DIRECTION_SOUTH, 1, 1);
  438. c.begin();
  439. c.moveTo(8, h * 0.5 + 10);
  440. c.arcTo(12, 12, 0, 0, 1, 8, h * 0.5 - 10);
  441. c.lineTo(w - 8, h * 0.5 - 10);
  442. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);
  443. c.close();
  444. c.fillAndStroke();
  445. };
  446. mxShapeEipInvalidMessageChannel.prototype.foreground = function(c, x, y, w, h)
  447. {
  448. c.setFillColor('#e6e6e6');
  449. c.begin();
  450. c.moveTo(w - 8, h * 0.5 - 10);
  451. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);
  452. c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 - 10);
  453. c.fillAndStroke();
  454. c.setFillColor("#ffe040");
  455. c.setStrokeWidth("1");
  456. c.begin();
  457. c.moveTo(w * 0.5 - 6, h * 0.5 + 5);
  458. c.lineTo(w * 0.5, h * 0.5 - 5);
  459. c.lineTo(w * 0.5 + 6, h * 0.5 + 5);
  460. c.close();
  461. c.fillAndStroke();
  462. c.setStrokeWidth("1");
  463. c.begin();
  464. c.moveTo(w * 0.5, h * 0.5 - 2);
  465. c.lineTo(w * 0.5, h * 0.5 + 2);
  466. c.moveTo(w * 0.5, h * 0.5 + 3);
  467. c.lineTo(w * 0.5, h * 0.5 + 4);
  468. c.stroke();
  469. };
  470. mxCellRenderer.registerShape(mxShapeEipInvalidMessageChannel.prototype.cst.SHAPE_INVALID_MESSAGE_CHANNEL, mxShapeEipInvalidMessageChannel);
  471. mxShapeEipInvalidMessageChannel.prototype.getConstraints = function(style, w, h)
  472. {
  473. var constr = [];
  474. constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 2.7, 0));
  475. constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -2.7, 0));
  476. var currW = 10;
  477. while (currW < w)
  478. {
  479. constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, currW, 0));
  480. constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, currW, 0));
  481. currW = currW + 10;
  482. }
  483. return (constr);
  484. };