mxIBM.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /**
  2. * Copyright (c) 2006-2020, JGraph Holdings Ltd
  3. */
  4. //**********************************************************************************************************************************************************
  5. //Box
  6. //**********************************************************************************************************************************************************
  7. /**
  8. * Extends mxShape.
  9. */
  10. function mxShapeIBMBox(bounds, fill, stroke, strokewidth)
  11. {
  12. mxShape.call(this);
  13. this.bounds = bounds;
  14. this.fill = fill;
  15. this.stroke = stroke;
  16. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  17. };
  18. /**
  19. * Extends mxShape.
  20. */
  21. mxUtils.extend(mxShapeIBMBox, mxShape);
  22. mxShapeIBMBox.prototype.cst = {
  23. IBM_BOX : 'mxgraph.ibm.box'
  24. };
  25. mxShapeIBMBox.prototype.customProperties = [
  26. {name: 'prType', dispName: 'Box Type', defVal: 'cloud', type: 'enum',
  27. enumList: [{val: 'cloud', dispName: 'IBM Cloud'},
  28. {val: 'vpc', dispName: 'VPC'},
  29. {val: 'region', dispName: 'Region'},
  30. {val: 'zone', dispName: 'Zone'},
  31. {val: 'subnet', dispName: 'Subnet ACL'},
  32. {val: 'public', dispName: 'Public Network'},
  33. {val: 'enterprise', dispName: 'Enterprise Network'},
  34. {val: 'classic', dispName: 'Classic Infrastructure'}]},
  35. {name: 'iconColor', dispName: 'Icon Color', defVal: '#ffffff', type: 'color', primary: true}
  36. ];
  37. /**
  38. * Function: paintVertexShape
  39. *
  40. * Paints the vertex shape.
  41. */
  42. mxShapeIBMBox.prototype.paintVertexShape = function(c, x, y, w, h)
  43. {
  44. c.translate(x, y);
  45. c.begin();
  46. c.rect(0,0, w, h);
  47. c.fillAndStroke();
  48. var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', 'none');
  49. c.setFillColor(strokeColor);
  50. c.setStrokeColor('none');
  51. var prType = mxUtils.getValue(this.state.style, 'prType', '');
  52. switch(prType)
  53. {
  54. case 'cloud':
  55. var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.cloudtag');
  56. bgSt1.drawShape(c, this, 0, 0, 25, 25);
  57. break;
  58. case 'vpc':
  59. var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.vpctag');
  60. bgSt1.drawShape(c, this, 0, 0, 25, 25);
  61. break;
  62. case 'region':
  63. var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.regiontag');
  64. bgSt1.drawShape(c, this, 0, 0, 25, 25);
  65. break;
  66. case 'zone':
  67. var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.zonetag');
  68. bgSt1.drawShape(c, this, 0, 0, 25, 25);
  69. break;
  70. case 'subnet':
  71. var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.subnettag');
  72. bgSt1.drawShape(c, this, 0, 0, 25, 25);
  73. break;
  74. case 'public':
  75. var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.publictag');
  76. bgSt1.drawShape(c, this, 0, 0, 25, 25);
  77. break;
  78. case 'enterprise':
  79. var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.enterprisetag');
  80. bgSt1.drawShape(c, this, 0, 0, 25, 25);
  81. break;
  82. case 'classic':
  83. var bgSt1 = mxStencilRegistry.getStencil('mxgraph.ibm.classictag');
  84. bgSt1.drawShape(c, this, 0, 0, 25, 25);
  85. break;
  86. default:
  87. break;
  88. }
  89. };
  90. mxCellRenderer.registerShape(mxShapeIBMBox.prototype.cst.IBM_BOX, mxShapeIBMBox);