1(function()
2{
3	// Adds Cabinets shapes
4	Sidebar.prototype.addCabinetsPalette = function()
5	{
6		var s = mxConstants.STYLE_VERTICAL_LABEL_POSITION + '=bottom;dashed=0;shadow=0;html=1;align=center;' + mxConstants.STYLE_VERTICAL_ALIGN + '=top;shape=mxgraph.cabinets.';
7		var s2 = mxConstants.STYLE_VERTICAL_LABEL_POSITION + '=middle;dashed=0;shadow=0;html=1;shape=mxgraph.cabinets.';
8		var inh = 'strokeColor=inherit;fillColor=inherit;gradientColor=inherit;';
9		var w = 50;
10		var h = 50;
11		var gn = 'mxgraph.cabinets';
12		var dt = 'cabinet ';
13		var sb = this;
14		this.setCurrentSearchEntryLibrary('cabinets');
15
16		var fns =
17		[
18			this.createVertexTemplateEntry(s + 'cabinet;hasStand=1',
19					w * 5, h * 10, '', 'Cabinet', null, null, this.getTagsForStencil(gn, 'cabinet', dt).join(' ')),
20			this.createVertexTemplateEntry(s2 + 'dimension;verticalAlign=top;align=center;',
21					w * 5, 40, '100', 'Dimension', null, null, this.getTagsForStencil(gn, 'dimension', dt).join(' ')),
22			this.createVertexTemplateEntry(s2 + 'dimensionBottom;verticalAlign=bottom;align=center;',
23					w * 5, 40, '100', 'Dimension', null, null, this.getTagsForStencil(gn, 'dimensionBottom', dt).join(' ')),
24			this.createVertexTemplateEntry(s + 'coverPlate',
25					w * 4.4, h * 2.5, '', 'Cover Plate', null, null, this.getTagsForStencil(gn, 'coverPlate', dt).join(' ')),
26			this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;',
27					w * 4.4, h * 0.25, '25x40', 'Panel Wiring System 25x40mm', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
28			this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;',
29					w * 4.4, h * 0.4, '40x40', 'Panel Wiring System 40x40mm', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
30			this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;',
31					w * 4.4, h * 0.6, '60x40', 'Panel Wiring System 60x40mm', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
32			this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;',
33					w * 4.4, h * 0.8, '80x40', 'Panel Wiring System 80x40mm', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
34			this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;',
35					w * 4.4, h, '100x40', 'Panel Wiring System 100x40mm', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
36			this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;direction=south;horizontal=0;',
37					w * 0.25, h * 7, '25x40', 'Panel Wiring System 25x40mm (Vertical)', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
38			this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;direction=south;horizontal=0;',
39					w * 0.4, h * 7, '40x40', 'Panel Wiring System 40x40mm (Vertical)', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
40			this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;direction=south;horizontal=0;',
41					w * 0.6, h * 7, '60x40', 'Panel Wiring System 60x40mm (Vertical)', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
42			this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;direction=south;horizontal=0;',
43					w * 0.8, h * 7, '80x40', 'Panel Wiring System 80x40mm (Vertical)', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
44			this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;direction=south;horizontal=0;',
45					w, h * 7, '100x40', 'Panel Wiring System 100x40mm (Vertical)', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
46			this.createVertexTemplateEntry(s + 'cb_1p;',
47					w * 0.18, h, '', 'Circuit Breaker (1P)', null, null, this.getTagsForStencil(gn, 'cb_1p', dt).join(' ')),
48
49			this.addEntry(dt + 'circuit breaker row', function()
50	   		{
51			   	var bg1 = new mxCell('', new mxGeometry(0, 0, w * 0.18, h), s + 'cb_1p;');
52			   	bg1.vertex = true;
53			   	var bg2 = new mxCell('', new mxGeometry(w * 0.18, 0, w * 0.18, h), s + 'cb_1p;');
54			   	bg2.vertex = true;
55			   	var bg3 = new mxCell('', new mxGeometry(w * 0.36, 0, w * 0.18, h), s + 'cb_1p;');
56			   	bg3.vertex = true;
57			   	var bg4 = new mxCell('', new mxGeometry(w * 0.54, 0, w * 0.18, h), s + 'cb_1p;');
58			   	bg4.vertex = true;
59			   	var bg5 = new mxCell('', new mxGeometry(w * 0.72, 0, w * 0.18, h), s + 'cb_1p;');
60			   	bg5.vertex = true;
61			   	var bg6 = new mxCell('', new mxGeometry(w * 0.9, 0, w * 0.18, h), s + 'cb_1p;');
62			   	bg6.vertex = true;
63			   	var bg7 = new mxCell('', new mxGeometry(w * 1.08, 0, w * 0.18, h), s + 'cb_1p;');
64			   	bg7.vertex = true;
65			   	var bg8 = new mxCell('', new mxGeometry(w * 1.26, 0, w * 0.18, h), s + 'cb_1p;');
66			   	bg8.vertex = true;
67			   	var bg9 = new mxCell('', new mxGeometry(w * 1.44, 0, w * 0.18, h), s + 'cb_1p;');
68			   	bg9.vertex = true;
69			   	var bg10 = new mxCell('', new mxGeometry(w * 1.62, 0, w * 0.18, h), s + 'cb_1p;');
70			   	bg10.vertex = true;
71
72			   	return sb.createVertexTemplateFromCells([bg1, bg2, bg3, bg4, bg5, bg6, bg7, bg8, bg9, bg10], w * 1.8, h, 'Circuit Breaker (1P x 10)');
73			}),
74
75			this.createVertexTemplateEntry(s + 'cb_2p;', w * 0.36, h, '', 'Circuit Breaker (2P)', null, null, this.getTagsForStencil(gn, 'cb_2p', dt).join(' ')),
76
77			this.addEntry(dt + 'circuit breaker row', function()
78	   		{
79			   	var bg1 = new mxCell('', new mxGeometry(0, 0, w * 0.36, h), s + 'cb_2p;');
80			   	bg1.vertex = true;
81			   	var bg2 = new mxCell('', new mxGeometry(w * 0.36, 0, w * 0.36, h), s + 'cb_2p;');
82			   	bg2.vertex = true;
83			   	var bg3 = new mxCell('', new mxGeometry(w * 0.72, 0, w * 0.36, h), s + 'cb_2p;');
84			   	bg3.vertex = true;
85			   	var bg4 = new mxCell('', new mxGeometry(w * 1.08, 0, w * 0.36, h), s + 'cb_2p;');
86			   	bg4.vertex = true;
87			   	var bg5 = new mxCell('', new mxGeometry(w * 1.44, 0, w * 0.36, h), s + 'cb_2p;');
88			   	bg5.vertex = true;
89			   	var bg6 = new mxCell('', new mxGeometry(w * 1.8, 0, w * 0.36, h), s + 'cb_2p;');
90			   	bg6.vertex = true;
91			   	var bg7 = new mxCell('', new mxGeometry(w * 2.16, 0, w * 0.36, h), s + 'cb_2p;');
92			   	bg7.vertex = true;
93			   	var bg8 = new mxCell('', new mxGeometry(w * 2.52, 0, w * 0.36, h), s + 'cb_2p;');
94			   	bg8.vertex = true;
95			   	var bg9 = new mxCell('', new mxGeometry(w * 2.88, 0, w * 0.36, h), s + 'cb_2p;');
96			   	bg9.vertex = true;
97			   	var bg10 = new mxCell('', new mxGeometry(w * 3.24, 0, w * 0.36, h), s + 'cb_2p;');
98			   	bg10.vertex = true;
99
100			   	return sb.createVertexTemplateFromCells([bg1, bg2, bg3, bg4, bg5, bg6, bg7, bg8, bg9, bg10], w * 3.6, h, 'Circuit Breaker (2P x 10)');
101			}),
102
103			this.createVertexTemplateEntry(s + 'cb_3p;', w * 0.54, h, '', 'Circuit Breaker (3P)', null, null, this.getTagsForStencil(gn, 'cb_3p', dt).join(' ')),
104
105			this.addEntry(dt + 'circuit breaker row', function()
106	   		{
107			   	var bg1 = new mxCell('', new mxGeometry(0, 0, w * 0.54, h), s + 'cb_3p;');
108			   	bg1.vertex = true;
109			   	var bg2 = new mxCell('', new mxGeometry(w * 0.54, 0, w * 0.54, h), s + 'cb_3p;');
110			   	bg2.vertex = true;
111			   	var bg3 = new mxCell('', new mxGeometry(w * 1.08, 0, w * 0.54, h), s + 'cb_3p;');
112			   	bg3.vertex = true;
113			   	var bg4 = new mxCell('', new mxGeometry(w * 1.62, 0, w * 0.54, h), s + 'cb_3p;');
114			   	bg4.vertex = true;
115			   	var bg5 = new mxCell('', new mxGeometry(w * 2.16, 0, w * 0.54, h), s + 'cb_3p;');
116			   	bg5.vertex = true;
117
118			   	return sb.createVertexTemplateFromCells([bg1, bg2, bg3, bg4, bg5], w * 2.7, h, 'Circuit Breaker (3P x 5)');
119			}),
120
121			this.createVertexTemplateEntry(s + 'cb_4p;', w * 0.72, h, '', 'Circuit Breaker (4P)', null, null, this.getTagsForStencil(gn, 'cb_4p', dt).join(' ')),
122
123			this.addEntry(dt + 'circuit breaker row', function()
124	   		{
125				var bg1 = new mxCell('', new mxGeometry(0, 0, w * 0.72, h), s + 'cb_4p;');
126			   	bg1.vertex = true;
127			   	var bg2 = new mxCell('', new mxGeometry(w * 0.72, 0, w * 0.72, h), s + 'cb_4p;');
128			   	bg2.vertex = true;
129			   	var bg3 = new mxCell('', new mxGeometry(w * 1.44, 0, w * 0.72, h), s + 'cb_4p;');
130			   	bg3.vertex = true;
131			   	var bg4 = new mxCell('', new mxGeometry(w * 2.16, 0, w * 0.72, h), s + 'cb_4p;');
132			   	bg4.vertex = true;
133			   	var bg5 = new mxCell('', new mxGeometry(w * 2.88, 0, w * 0.72, h), s + 'cb_4p;');
134			   	bg5.vertex = true;
135
136			   	return sb.createVertexTemplateFromCells([bg1, bg2, bg3, bg4, bg5], w * 3.6, h, 'Circuit Breaker (4P x 5)');
137			}),
138
139			this.createVertexTemplateEntry(s + 'cb_auxiliary_contact;',
140					w * 0.09, h, '', 'Auxiliary Contact (Circuit Breaker)', null, null, this.getTagsForStencil(gn, 'cb_auxiliary_contact', dt).join(' ')),
141			this.createVertexTemplateEntry(s + 'contactor_1_32a;',
142					w * 0.54, h * 0.86, '', 'Contactor (1-32A)', null, null, this.getTagsForStencil(gn, 'contactor_1_32a', dt).join(' ')),
143			this.createVertexTemplateEntry(s + 'auxiliary_contact_contactor_1_32a;',
144					w * 0.09, h * 0.86, '', 'Auxiliary Contact (Contactor 1-32A)', null, null, this.getTagsForStencil(gn, 'auxiliary_contact_contactor_1_32a', dt).join(' ')),
145			this.createVertexTemplateEntry(s + 'contactor_32_125a;',
146					w * 0.6, h, '', 'Contactor 32 to 125A', null, null, this.getTagsForStencil(gn, 'contactor_32_125a', dt).join(' ')),
147			this.createVertexTemplateEntry(s + 'auxiliary_contact_contactor_32_125a;',
148					w * 0.09, h, '', 'Auxiliary Contact (Contactor 32-125A)', null, null, this.getTagsForStencil(gn, 'auxiliary_contact_contactor_32_125a', dt).join(' ')),
149			this.createVertexTemplateEntry(s + 'contactor_125_400a;',
150					w * 1.1, h * 1.8, '', 'Contactor 125 to 400A', null, null, this.getTagsForStencil(gn, 'contactor_125_400a', dt).join(' ')),
151			this.createVertexTemplateEntry(s + 'distribution_block_4p_125a_11_connections;',
152					w * 2, h * 1.2, '', 'Distribution Block 4P 125A 11 Connections', null, null, this.getTagsForStencil(gn, 'distribution_block_4p_125a_11_connections', dt).join(' ')),
153			this.createVertexTemplateEntry(s + 'distribution_block_4p_125a_11_connections_2;',
154					w * 2, h, '', 'Distribution Block 4P 125A 11 Connections', null, null, this.getTagsForStencil(gn, 'distribution_block_4p_125a_11_connections_2', dt).join(' ')),
155			this.createVertexTemplateEntry(s + 'mccb_25_63a_3p;',
156					w * 1.2, h * 1.8, '', 'MCCB 25-63A 3P', null, null, this.getTagsForStencil(gn, 'mccb_25_63a_3p', dt).join(' ')),
157			this.createVertexTemplateEntry(s + 'mccb_25_63a_4p;',
158					w * 1.6, h * 1.8, '', 'MCCB 25-63A 4P', null, null, this.getTagsForStencil(gn, 'mccb_25_63a_4p', dt).join(' ')),
159			this.createVertexTemplateEntry(s + 'mccb_63_250a_3p;',
160					w * 1.4, h * 2.1, '', 'MCCB 63-250A 3P', null, null, this.getTagsForStencil(gn, 'mccb_63_250a_3p', dt).join(' ')),
161			this.createVertexTemplateEntry(s + 'mccb_63_250a_4p;',
162					w * 1.9, h * 2.1, '', 'MCCB 63-250A 4P', null, null, this.getTagsForStencil(gn, 'mccb_63_250a_4p', dt).join(' ')),
163			this.createVertexTemplateEntry(s + 'motorized_switch_3p;',
164					w * 1.7, h * 1.4, '', 'Motorized Switch 3P', null, null, this.getTagsForStencil(gn, 'motorized_switch_3p', dt).join(' ')),
165			this.createVertexTemplateEntry(s + 'motorized_switch_4p;',
166					w * 2, h * 1.4, '', 'Motorized Switch 4P', null, null, this.getTagsForStencil(gn, 'motorized_switch_4p', dt).join(' ')),
167			this.createVertexTemplateEntry(s + 'motor_cb_1_32a;',
168					w * 0.54, h * 0.86, '', 'Motor Circuit Breaker 1-32A', null, null, this.getTagsForStencil(gn, 'motor_cb_1_32a', dt).join(' ')),
169			this.createVertexTemplateEntry(s + 'motor_cb_32_125a;',
170					w * 0.6, h, '', 'Motor Circuit Breaker 32-125A', null, null, this.getTagsForStencil(gn, 'motor_cb_32_125a', dt).join(' ')),
171			this.createVertexTemplateEntry(s + 'motor_cb_125_400a;',
172					w * 1.1, h * 1.8, '', 'Motor Circuit Breaker 125-400A', null, null, this.getTagsForStencil(gn, 'motor_cb_125_400a', dt).join(' ')),
173			this.createVertexTemplateEntry(s + 'motor_protection_cb;',
174					w * 0.54, h, '', 'Motor Protection CB', null, null, this.getTagsForStencil(gn, 'motor_protection_cb', dt).join(' ')),
175			this.createVertexTemplateEntry(s + 'motor_starter_1_32a;',
176					w * 0.54, h * 0.86, '', 'Motor Circuit Breaker 1-32A', null, null, this.getTagsForStencil(gn, 'motor_starter_1_32a', dt).join(' ')),
177			this.createVertexTemplateEntry(s + 'motor_starter_32_125a;',
178					w * 0.6, h, '', 'Motor Circuit Breaker 32-125A', null, null, this.getTagsForStencil(gn, 'motor_starter_32_125a', dt).join(' ')),
179			this.createVertexTemplateEntry(s + 'motor_starter_125_400a;',
180					w * 1.1, h * 1.8, '', 'Motor Circuit Breaker 125-400A', null, null, this.getTagsForStencil(gn, 'motor_starter_125_400a', dt).join(' ')),
181			this.createVertexTemplateEntry(s + 'overcurrent_relay_1_32a;',
182					w * 0.54, h * 0.3, '', 'Overcurrent Relay 1-32A', null, null, this.getTagsForStencil(gn, 'overcurrent_relay_1_32a', dt).join(' ')),
183			this.createVertexTemplateEntry(s + 'overcurrent_relay_32_125a;',
184					w * 0.6, h * 0.33, '', 'Overcurrent Relay 32-125A', null, null, this.getTagsForStencil(gn, 'overcurrent_relay_32_125a', dt).join(' ')),
185			this.createVertexTemplateEntry(s + 'overcurrent_relay_125_400a;',
186					w * 1.1, h * 0.6, '', 'Overcurrent Relay 125-400A', null, null, this.getTagsForStencil(gn, 'overcurrent_relay_125_400a', dt).join(' ')),
187			this.createVertexTemplateEntry(s + 'plugin_relay_1;',
188					w * 0.06, h * 0.8, '', 'Plugin Relay', null, null, this.getTagsForStencil(gn, 'plugin_relay_1', dt).join(' ')),
189			this.createVertexTemplateEntry(s + 'plugin_relay_2;',
190					w * 0.24, h * 0.8, '', 'Plugin Relay', null, null, this.getTagsForStencil(gn, 'plugin_relay_2', dt).join(' ')),
191			this.createVertexTemplateEntry(s + 'din_rail;',
192					w * 10, h * 0.5, '', 'DIN Rail', null, null, this.getTagsForStencil(gn, 'din_rail', dt).join(' ')),
193			this.createVertexTemplateEntry(s + 'residual_current_device_2p;',
194					w * 0.36, h, '', 'Residual Current Device 2p', null, null, this.getTagsForStencil(gn, 'residual_current_device_2p', dt).join(' ')),
195			this.createVertexTemplateEntry(s + 'residual_current_device_4p;',
196					w * 0.72, h, '', 'Residual Current Device 4p', null, null, this.getTagsForStencil(gn, 'residual_current_device_4p', dt).join(' ')),
197			this.createVertexTemplateEntry(s + 'surge_protection_1p;',
198					w * 0.18, h, '', 'Surge Protection 1p', null, null, this.getTagsForStencil(gn, 'surge_protection_1p', dt).join(' ')),
199			this.createVertexTemplateEntry(s + 'surge_protection_2p;',
200					w * 0.36, h, '', 'Surge Protection 2p', null, null, this.getTagsForStencil(gn, 'surge_protection_2p', dt).join(' ')),
201			this.createVertexTemplateEntry(s + 'surge_protection_3p;',
202					w * 0.54, h, '', 'Surge Protection 3p', null, null, this.getTagsForStencil(gn, 'surge_protection_3p', dt).join(' ')),
203			this.createVertexTemplateEntry(s + 'surge_protection_4p;',
204					w * 0.72, h, '', 'Surge Protection 4p', null, null, this.getTagsForStencil(gn, 'surge_protection_4p', dt).join(' ')),
205			this.createVertexTemplateEntry(s + 'terminal_4mm2;',
206					w * 0.05, h * 0.5, '', 'Terminal 4mm2', null, null, this.getTagsForStencil(gn, 'terminal_4mm2', dt).join(' ')),
207			this.createVertexTemplateEntry(s + 'terminal_4mm2_x10;',
208					w * 0.5, h * 0.5, '', 'Terminal 4mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_4mm2_x10', dt).join(' ')),
209			this.createVertexTemplateEntry(s + 'terminal_4_6mm2;',
210					w * 0.05, h * 0.6, '', 'Terminal 4-6mm2', null, null, this.getTagsForStencil(gn, 'terminal_4_6mm2', dt).join(' ')),
211			this.createVertexTemplateEntry(s + 'terminal_4_6mm2_x10;',
212					w * 0.5, h * 0.6, '', 'Terminal 4-6mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_4_6mm2_x10', dt).join(' ')),
213			this.createVertexTemplateEntry(s + 'terminal_6_25mm2;',
214					w * 0.1, h * 0.75, '', 'Terminal 6-25mm2', null, null, this.getTagsForStencil(gn, 'terminal_6_25mm2', dt).join(' ')),
215			this.createVertexTemplateEntry(s + 'terminal_6_25mm2_x10;',
216					w, h * 0.75, '', 'Terminal 6-25mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_6_25mm2_x10', dt).join(' ')),
217			this.createVertexTemplateEntry(s + 'terminal_40mm2;',
218					w * 0.22, h, '', 'Terminal 40mm2', null, null, this.getTagsForStencil(gn, 'terminal_40mm2', dt).join(' ')),
219			this.createVertexTemplateEntry(s + 'terminal_40mm2_x10;',
220					w * 2.2, h, '', 'Terminal 40mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_40mm2_x10', dt).join(' ')),
221			this.createVertexTemplateEntry(s + 'terminal_50mm2;',
222					w * 0.25, h * 1.1, '', 'Terminal 50mm2', null, null, this.getTagsForStencil(gn, 'terminal_50mm2', dt).join(' ')),
223			this.createVertexTemplateEntry(s + 'terminal_50mm2_x10;',
224					w * 2.5, h * 1.1, '', 'Terminal 50mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_50mm2_x10', dt).join(' ')),
225			this.createVertexTemplateEntry(s + 'terminal_75mm2;',
226					w * 0.3, h * 1.4, '', 'Terminal 75mm2', null, null, this.getTagsForStencil(gn, 'terminal_75mm2', dt).join(' ')),
227			this.createVertexTemplateEntry(s + 'terminal_75mm2_x10;',
228					w * 3, h * 1.4, '', 'Terminal 75mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_75mm2_x10', dt).join(' '))
229		];
230
231		this.addPalette('cabinets', mxResources.get('cabinets'), false, mxUtils.bind(this, function(content)
232	    {
233			for (var i = 0; i < fns.length; i++)
234			{
235				content.appendChild(fns[i](content));
236			}
237		}));
238
239		this.setCurrentSearchEntryLibrary();
240	};
241
242})();
243