clone

a browser-first diagram editor with live svg previews, local drafts and encrypted, accountless sharing

main
diagramzip / renderers / browser-run / frames / diagramsnet / vendor / assets / shapes / mxEip.js
mxEip.js 16.1K
1/**2 * Copyright (c) 2006-2015, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//Message Expiration7//**********************************************************************************************************************************************************8/**9 * Extends mxShape.10 */11function 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};1920/**21 * Extends mxShape.22 */23mxUtils.extend(mxShapeEipMessageExpiration, mxShape);2425mxShapeEipMessageExpiration.prototype.cst = {26 SHAPE_MESS_EXP : 'mxgraph.eip.messExp'27};2829/**30 * Function: paintVertexShape31 * 32 * Paints the vertex shape.33 */34mxShapeEipMessageExpiration.prototype.paintVertexShape = function(c, x, y, w, h)35{36 c.translate(x, y);37 this.background(c, x, y, w, h);38};3940mxShapeEipMessageExpiration.prototype.background = function(c, x, y, w, h)41{42 c.ellipse(0, 0, w, h);43 c.stroke();44 45 c.setStrokeColor("#808080");46 c.begin();47 c.moveTo(w * 0.5, h * 0.1);48 c.lineTo(w * 0.5, h * 0.5);49 c.lineTo(w * 0.6, h * 0.8);50 c.stroke();51};5253mxCellRenderer.registerShape(mxShapeEipMessageExpiration.prototype.cst.SHAPE_MESS_EXP, mxShapeEipMessageExpiration);5455mxShapeEipMessageExpiration.prototype.getConstraints = function(style, w, h)56{57 var constr = [];5859 constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.145), false));60 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));61 constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.145), false));62 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));63 constr.push(new mxConnectionConstraint(new mxPoint(0.855, 0.855), false));64 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));65 constr.push(new mxConnectionConstraint(new mxPoint(0.145, 0.855), false));66 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));6768 return (constr);69};7071//**********************************************************************************************************************************************************72//Return Address73//**********************************************************************************************************************************************************74/**75* Extends mxShape.76*/77function mxShapeEipReturnAddress(bounds, fill, stroke, strokewidth)78{79 mxShape.call(this);80 this.bounds = bounds;81 this.fill = fill;82 this.stroke = stroke;83 this.strokewidth = (strokewidth != null) ? strokewidth : 1;84};8586/**87* Extends mxShape.88*/89mxUtils.extend(mxShapeEipReturnAddress, mxShape);9091mxShapeEipReturnAddress.prototype.cst = {92 SHAPE_RET_ADDR : 'mxgraph.eip.retAddr'93};9495/**96* Function: paintVertexShape97* 98* Paints the vertex shape.99*/100mxShapeEipReturnAddress.prototype.paintVertexShape = function(c, x, y, w, h)101{102 c.translate(x, y);103 this.background(c, x, y, w, h);104 c.setShadow(false);105 this.foreground(c, x, y, w, h);106};107108mxShapeEipReturnAddress.prototype.background = function(c, x, y, w, h)109{110 c.rect(0, 0, w, h);111 c.fillAndStroke();112};113114mxShapeEipReturnAddress.prototype.foreground = function(c, x, y, w, h)115{116 c.begin();117 c.moveTo(w * 0.05, h * 0.11);118 c.lineTo(w * 0.25, h * 0.11);119 c.moveTo(w * 0.05, h * 0.18);120 c.lineTo(w * 0.25, h * 0.18);121 c.moveTo(w * 0.05, h * 0.25);122 c.lineTo(w * 0.25, h * 0.25);123124 c.setStrokeWidth(2);125 c.moveTo(w * 0.3, h * 0.63);126 c.lineTo(w * 0.8, h * 0.63);127 c.moveTo(w * 0.3, h * 0.72);128 c.lineTo(w * 0.8, h * 0.72);129 c.moveTo(w * 0.3, h * 0.80);130 c.lineTo(w * 0.8, h * 0.80);131 c.stroke();132133 c.setFillColor("#EDEDED");134 c.rect(w * 0.8, h * 0.1, w * 0.12, h * 0.19);135 c.fillAndStroke();136};137138mxCellRenderer.registerShape(mxShapeEipReturnAddress.prototype.cst.SHAPE_RET_ADDR, mxShapeEipReturnAddress);139140mxShapeEipReturnAddress.prototype.getConstraints = function(style, w, h)141{142 var constr = [];143144 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));145 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));146 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));147 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));148 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));149 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));150 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));151 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));152 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));153 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));154 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));155 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));156 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));157 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));158 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));159 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));160161 return (constr);162};163164//**********************************************************************************************************************************************************165//Anchor166//**********************************************************************************************************************************************************167/**168* Extends mxShape.169*/170function mxShapeEipAnchor(bounds, fill, stroke, strokewidth)171{172 mxShape.call(this);173 this.bounds = bounds;174 this.fill = fill;175 this.stroke = stroke;176 this.strokewidth = (strokewidth != null) ? strokewidth : 1;177};178179/**180* Extends mxShape.181*/182mxUtils.extend(mxShapeEipAnchor, mxShape);183184mxShapeEipAnchor.prototype.cst = {185 SHAPE_ANCHOR : 'mxgraph.eip.anchor'186};187188/**189* Function: paintVertexShape190* 191* Paints the vertex shape.192*/193mxShapeEipAnchor.prototype.paintVertexShape = function(c, x, y, w, h)194{195};196197mxCellRenderer.registerShape(mxShapeEipAnchor.prototype.cst.SHAPE_ANCHOR, mxShapeEipAnchor);198199//**********************************************************************************************************************************************************200//Message Channel201//**********************************************************************************************************************************************************202/**203* Extends mxShape.204*/205function mxShapeEipMessageChannel(bounds, fill, stroke, strokewidth)206{207 mxShape.call(this);208 this.bounds = bounds;209 this.fill = fill;210 this.stroke = stroke;211 this.strokewidth = (strokewidth != null) ? strokewidth : 1;212};213214/**215* Extends mxShape.216*/217mxUtils.extend(mxShapeEipMessageChannel, mxShape);218219mxShapeEipMessageChannel.prototype.cst = {220 SHAPE_MESSAGE_CHANNEL : 'mxgraph.eip.messageChannel'221};222223/**224* Function: paintVertexShape225* 226* Paints the vertex shape.227*/228mxShapeEipMessageChannel.prototype.paintVertexShape = function(c, x, y, w, h)229{230 c.translate(x, y);231 this.background(c, x, y, w, h);232 c.setShadow(false);233 this.foreground(c, x, y, w, h);234};235236mxShapeEipMessageChannel.prototype.background = function(c, x, y, w, h)237{238 c.setGradient('#e6e6e6', '#808080', 0, 0, w, h, mxConstants.DIRECTION_SOUTH, 1, 1);239 c.begin();240 c.moveTo(8, h * 0.5 + 10);241 c.arcTo(12, 12, 0, 0, 1, 8, h * 0.5 - 10);242 c.lineTo(w - 8, h * 0.5 - 10);243 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);244 c.close();245 c.fillAndStroke();246};247248mxShapeEipMessageChannel.prototype.foreground = function(c, x, y, w, h)249{250 c.setFillColor('#e6e6e6');251 c.begin();252 c.moveTo(w - 8, h * 0.5 - 10);253 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);254 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 - 10);255 c.fillAndStroke();256};257258mxCellRenderer.registerShape(mxShapeEipMessageChannel.prototype.cst.SHAPE_MESSAGE_CHANNEL, mxShapeEipMessageChannel);259260261mxShapeEipMessageChannel.prototype.getConstraints = function(style, w, h)262{263 var constr = [];264265 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 2.7, 0));266 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -2.7, 0));267268 var currW = 10;269 270 while (currW < w)271 {272 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, currW, 0));273 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, currW, 0));274 275 currW = currW + 10;276 }277 278 return (constr);279};280281//**********************************************************************************************************************************************************282//Datatype Channel283//**********************************************************************************************************************************************************284/**285* Extends mxShape.286*/287function mxShapeEipDatatypeChannel(bounds, fill, stroke, strokewidth)288{289 mxShape.call(this);290 this.bounds = bounds;291 this.fill = fill;292 this.stroke = stroke;293 this.strokewidth = (strokewidth != null) ? strokewidth : 1;294};295296/**297* Extends mxShape.298*/299mxUtils.extend(mxShapeEipDatatypeChannel, mxShape);300301mxShapeEipDatatypeChannel.prototype.cst = {302 SHAPE_DATATYPE_CHANNEL : 'mxgraph.eip.dataChannel'303};304305/**306* Function: paintVertexShape307* 308* Paints the vertex shape.309*/310mxShapeEipDatatypeChannel.prototype.paintVertexShape = function(c, x, y, w, h)311{312 c.translate(x, y);313 this.background(c, x, y, w, h);314 c.setShadow(false);315 this.foreground(c, x, y, w, h);316};317318mxShapeEipDatatypeChannel.prototype.background = function(c, x, y, w, h)319{320 c.setGradient('#e6e6e6', '#808080', 0, 0, w, h, mxConstants.DIRECTION_SOUTH, 1, 1);321 c.begin();322 c.moveTo(8, h * 0.5 + 10);323 c.arcTo(12, 12, 0, 0, 1, 8, h * 0.5 - 10);324 c.lineTo(w - 8, h * 0.5 - 10);325 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);326 c.close();327 c.fillAndStroke();328};329330mxShapeEipDatatypeChannel.prototype.foreground = function(c, x, y, w, h)331{332 c.setFillColor('#e6e6e6');333 c.begin();334 c.moveTo(w - 8, h * 0.5 - 10);335 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);336 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 - 10);337 c.fillAndStroke();338 339 c.setFillColor("#fffbc0");340 c.setStrokeWidth("1");341 342 for(var i = 1; i * 20 + 10 < w - 14; i++)343 {344 c.rect(i * 20, h * 0.5 - 5, 10, 10);345 c.fillAndStroke();346 };347};348349mxCellRenderer.registerShape(mxShapeEipDatatypeChannel.prototype.cst.SHAPE_DATATYPE_CHANNEL, mxShapeEipDatatypeChannel);350351mxShapeEipDatatypeChannel.prototype.getConstraints = function(style, w, h)352{353 var constr = [];354355 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 2.7, 0));356 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -2.7, 0));357358 var currW = 10;359 360 while (currW < w)361 {362 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, currW, 0));363 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, currW, 0));364 365 currW = currW + 10;366 }367 368 return (constr);369};370371//**********************************************************************************************************************************************************372//Dead Letter Channel373//**********************************************************************************************************************************************************374/**375* Extends mxShape.376*/377function mxShapeEipDeadLetterChannel(bounds, fill, stroke, strokewidth)378{379 mxShape.call(this);380 this.bounds = bounds;381 this.fill = fill;382 this.stroke = stroke;383 this.strokewidth = (strokewidth != null) ? strokewidth : 1;384};385386/**387* Extends mxShape.388*/389mxUtils.extend(mxShapeEipDeadLetterChannel, mxShape);390391mxShapeEipDeadLetterChannel.prototype.cst = {392 SHAPE_DEAD_LETTER_CHANNEL : 'mxgraph.eip.deadLetterChannel'393};394395/**396* Function: paintVertexShape397* 398* Paints the vertex shape.399*/400mxShapeEipDeadLetterChannel.prototype.paintVertexShape = function(c, x, y, w, h)401{402 c.translate(x, y);403 this.background(c, x, y, w, h);404 c.setShadow(false);405 this.foreground(c, x, y, w, h);406};407408mxShapeEipDeadLetterChannel.prototype.background = function(c, x, y, w, h)409{410 c.setGradient('#e6e6e6', '#808080', 0, 0, w, h, mxConstants.DIRECTION_SOUTH, 1, 1);411 c.begin();412 c.moveTo(8, h * 0.5 + 10);413 c.arcTo(12, 12, 0, 0, 1, 8, h * 0.5 - 10);414 c.lineTo(w - 8, h * 0.5 - 10);415 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);416 c.close();417 c.fillAndStroke();418};419420mxShapeEipDeadLetterChannel.prototype.foreground = function(c, x, y, w, h)421{422 c.setFillColor('#e6e6e6');423 c.begin();424 c.moveTo(w - 8, h * 0.5 - 10);425 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);426 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 - 10);427 c.fillAndStroke();428 429 c.setFillColor("#ff0000");430 c.setStrokeWidth("1");431 c.begin();432 c.moveTo(w * 0.5 - 6, h * 0.5 - 3);433 c.lineTo(w * 0.5 - 3, h * 0.5 - 6);434 c.lineTo(w * 0.5 + 3, h * 0.5 - 6);435 c.lineTo(w * 0.5 + 6, h * 0.5 - 3);436 c.lineTo(w * 0.5 + 6, h * 0.5 + 3);437 c.lineTo(w * 0.5 + 3, h * 0.5 + 6);438 c.lineTo(w * 0.5 - 3, h * 0.5 + 6);439 c.lineTo(w * 0.5 - 6, h * 0.5 + 3);440 c.close();441 c.fillAndStroke();442 443 c.setStrokeWidth("2");444 c.setStrokeColor("#ffffff");445 c.begin();446 c.moveTo(w * 0.5 - 4, h * 0.5);447 c.lineTo(w * 0.5 + 4, h * 0.5);448 c.stroke();449};450451mxCellRenderer.registerShape(mxShapeEipDeadLetterChannel.prototype.cst.SHAPE_DEAD_LETTER_CHANNEL, mxShapeEipDeadLetterChannel);452453mxShapeEipDeadLetterChannel.prototype.getConstraints = function(style, w, h)454{455 var constr = [];456457 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 2.7, 0));458 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -2.7, 0));459460 var currW = 10;461 462 while (currW < w)463 {464 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, currW, 0));465 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, currW, 0));466 467 currW = currW + 10;468 }469 470 return (constr);471};472473//**********************************************************************************************************************************************************474//Invalid Message Channel475//**********************************************************************************************************************************************************476/**477* Extends mxShape.478*/479function mxShapeEipInvalidMessageChannel(bounds, fill, stroke, strokewidth)480{481 mxShape.call(this);482 this.bounds = bounds;483 this.fill = fill;484 this.stroke = stroke;485 this.strokewidth = (strokewidth != null) ? strokewidth : 1;486};487488/**489* Extends mxShape.490*/491mxUtils.extend(mxShapeEipInvalidMessageChannel, mxShape);492493mxShapeEipInvalidMessageChannel.prototype.cst = {494 SHAPE_INVALID_MESSAGE_CHANNEL : 'mxgraph.eip.invalidMessageChannel'495};496497/**498* Function: paintVertexShape499* 500* Paints the vertex shape.501*/502mxShapeEipInvalidMessageChannel.prototype.paintVertexShape = function(c, x, y, w, h)503{504 c.translate(x, y);505 this.background(c, x, y, w, h);506 c.setShadow(false);507 this.foreground(c, x, y, w, h);508};509510mxShapeEipInvalidMessageChannel.prototype.background = function(c, x, y, w, h)511{512 c.setGradient('#e6e6e6', '#808080', 0, 0, w, h, mxConstants.DIRECTION_SOUTH, 1, 1);513 c.begin();514 c.moveTo(8, h * 0.5 + 10);515 c.arcTo(12, 12, 0, 0, 1, 8, h * 0.5 - 10);516 c.lineTo(w - 8, h * 0.5 - 10);517 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);518 c.close();519 c.fillAndStroke();520};521522mxShapeEipInvalidMessageChannel.prototype.foreground = function(c, x, y, w, h)523{524 c.setFillColor('#e6e6e6');525 c.begin();526 c.moveTo(w - 8, h * 0.5 - 10);527 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 + 10);528 c.arcTo(12, 12, 0, 0, 1, w - 8, h * 0.5 - 10);529 c.fillAndStroke();530 531 c.setFillColor("#ffe040");532 c.setStrokeWidth("1");533 c.begin();534 c.moveTo(w * 0.5 - 6, h * 0.5 + 5);535 c.lineTo(w * 0.5, h * 0.5 - 5);536 c.lineTo(w * 0.5 + 6, h * 0.5 + 5);537 c.close();538 c.fillAndStroke();539 540 c.setStrokeWidth("1");541 c.begin();542 c.moveTo(w * 0.5, h * 0.5 - 2);543 c.lineTo(w * 0.5, h * 0.5 + 2);544 c.moveTo(w * 0.5, h * 0.5 + 3);545 c.lineTo(w * 0.5, h * 0.5 + 4);546 c.stroke();547};548549mxCellRenderer.registerShape(mxShapeEipInvalidMessageChannel.prototype.cst.SHAPE_INVALID_MESSAGE_CHANNEL, mxShapeEipInvalidMessageChannel);550551mxShapeEipInvalidMessageChannel.prototype.getConstraints = function(style, w, h)552{553 var constr = [];554555 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, 2.7, 0));556 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -2.7, 0));557558 var currW = 10;559 560 while (currW < w)561 {562 constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, currW, 0));563 constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, currW, 0));564 565 currW = currW + 10;566 }567 568 return (constr);569};