mxIBM.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /**
  2. * $Id: mxIBM.js,v 1.0 2018/08/21 13:05:39 mate Exp $
  3. * Copyright (c) 2006-2020, JGraph Ltd
  4. */
  5. //**********************************************************************************************************************************************************
  6. //Box
  7. //**********************************************************************************************************************************************************
  8. /**
  9. * Extends mxShape.
  10. */
  11. function 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. };
  19. /**
  20. * Extends mxShape.
  21. */
  22. mxUtils.extend(mxShapeIBMBox, mxShape);
  23. mxShapeIBMBox.prototype.cst = {
  24. IBM_BOX : 'mxgraph.ibm.box'
  25. };
  26. mxShapeIBMBox.prototype.customProperties = [
  27. {name: 'prType', dispName: 'Box Type', defVal: 'cloud', type: 'enum',
  28. enumList: [{val: 'cloud', dispName: 'IBM Cloud'},
  29. {val: 'vpc', dispName: 'VPC'},
  30. {val: 'region', dispName: 'Region'},
  31. {val: 'zone', dispName: 'Zone'},
  32. {val: 'subnet', dispName: 'Subnet ACL'},
  33. {val: 'public', dispName: 'Public Network'},
  34. {val: 'enterprise', dispName: 'Enterprise Network'},
  35. {val: 'classic', dispName: 'Classic Infrastructure'}]}
  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);