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 / mxIBM.js
mxIBM.js 2.9K
1/**2 * Copyright (c) 2006-2020, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//Box7//**********************************************************************************************************************************************************8/**9* Extends mxShape.10*/11function mxShapeIBMBox(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(mxShapeIBMBox, mxShape);2425mxShapeIBMBox.prototype.cst = {26 IBM_BOX : 'mxgraph.ibm.box'27};2829mxShapeIBMBox.prototype.customProperties = [30 {name: 'prType', dispName: 'Box Type', defVal: 'cloud', type: 'enum', 31 enumList: [{val: 'cloud', dispName: 'IBM Cloud'}, 32 {val: 'vpc', dispName: 'VPC'}, 33 {val: 'region', dispName: 'Region'}, 34 {val: 'zone', dispName: 'Zone'}, 35 {val: 'subnet', dispName: 'Subnet ACL'}, 36 {val: 'public', dispName: 'Public Network'}, 37 {val: 'enterprise', dispName: 'Enterprise Network'}, 38 {val: 'classic', dispName: 'Classic Infrastructure'}]}39];4041/**42* Function: paintVertexShape43* 44* Paints the vertex shape.45*/46mxShapeIBMBox.prototype.paintVertexShape = function(c, x, y, w, h)47{48 c.translate(x, y);49 50 c.begin();51 c.rect(0,0, w, h);52 c.fillAndStroke();53 54 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', 'none');55 c.setFillColor(strokeColor);56 c.setStrokeColor('none');57 58 var prType = mxUtils.getValue(this.state.style, 'prType', '');59 60 switch(prType)61 {62 case 'cloud':63 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.cloudtag');64 bgSt1.drawShape(c, this, 0, 0, 25, 25);65 break;66 case 'vpc':67 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.vpctag');68 bgSt1.drawShape(c, this, 0, 0, 25, 25);69 break;70 case 'region':71 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.regiontag');72 bgSt1.drawShape(c, this, 0, 0, 25, 25);73 break;74 case 'zone':75 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.zonetag');76 bgSt1.drawShape(c, this, 0, 0, 25, 25);77 break;78 case 'subnet':79 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.subnettag');80 bgSt1.drawShape(c, this, 0, 0, 25, 25);81 break;82 case 'public':83 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.publictag');84 bgSt1.drawShape(c, this, 0, 0, 25, 25);85 break;86 case 'enterprise':87 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.enterprisetag');88 bgSt1.drawShape(c, this, 0, 0, 25, 25);89 break;90 case 'classic':91 var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.classictag');92 bgSt1.drawShape(c, this, 0, 0, 25, 25);93 break;94 default:95 break;96 }97};9899mxCellRenderer.registerShape(mxShapeIBMBox.prototype.cst.IBM_BOX, mxShapeIBMBox);