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