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