1/**2 * Copyright (c) 2006-2014, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//Cabinet7//**********************************************************************************************************************************************************8/**9* Extends mxShape.10*/11function mxCabinetsCabinet(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(mxCabinetsCabinet, mxShape);2425mxCabinetsCabinet.prototype.cst = {26 HAS_STAND : 'hasStand',27 CABINET : 'mxgraph.cabinets.cabinet'28};2930mxCabinetsCabinet.prototype.customProperties = [31 {name: 'hasStand', dispName:'Has Stand', type:'bool', defVal:true}32];3334/**35* Function: paintVertexShape36* 37* Paints the vertex shape.38*/39mxCabinetsCabinet.prototype.paintVertexShape = function(c, x, y, w, h)40{41 c.translate(x, y);42 this.background(c, 0, 0, w, h);43 c.setShadow(false);44 this.foreground(c, 0, 0, w, h);45};4647mxCabinetsCabinet.prototype.background = function(c, x, y, w, h)48{49 c.rect(0, 0, w, h);50 c.fillAndStroke();51};5253mxCabinetsCabinet.prototype.foreground = function(c, x, y, w, h)54{55 var wallTh = 15;56 c.rect(0, 0, w, wallTh);57 c.stroke();58 59 c.begin();60 c.moveTo(wallTh, wallTh);61 c.lineTo(wallTh, h);62 c.moveTo(w - wallTh, wallTh);63 c.lineTo(w - wallTh, h);64 c.stroke();65 66 var hasStand = mxUtils.getValue(this.style, mxCabinetsCabinet.prototype.cst.HAS_STAND, '1');67 68 if (hasStand === 1)69 {70 c.rect(0, h - 40, w, 40);71 c.fillAndStroke();72 }73 else74 {75 c.rect(0, h - wallTh, w, wallTh);76 c.fillAndStroke();77 };78};7980mxCellRenderer.registerShape(mxCabinetsCabinet.prototype.cst.CABINET, mxCabinetsCabinet);8182//**********************************************************************************************************************************************************83//Cover Plate84//**********************************************************************************************************************************************************85/**86* Extends mxShape.87*/88function mxCabinetsCoverPlate(bounds, fill, stroke, strokewidth)89{90 mxShape.call(this);91 this.bounds = bounds;92 this.fill = fill;93 this.stroke = stroke;94 this.strokewidth = (strokewidth != null) ? strokewidth : 1;95};9697/**98* Extends mxShape.99*/100mxUtils.extend(mxCabinetsCoverPlate, mxShape);101102mxCabinetsCoverPlate.prototype.cst = {103 COVER_PLATE : 'mxgraph.cabinets.coverPlate'104};105106107108/**109* Function: paintVertexShape110* 111* Paints the vertex shape.112*/113mxCabinetsCoverPlate.prototype.paintVertexShape = function(c, x, y, w, h)114{115 c.translate(x, y);116 this.background(c, 0, 0, w, h);117 c.setShadow(false);118 this.foreground(c, 0, 0, w, h);119};120121mxCabinetsCoverPlate.prototype.background = function(c, x, y, w, h)122{123 c.begin();124 c.moveTo(0, 0);125 c.lineTo(w, 0);126 c.lineTo(w, h);127 c.lineTo(0, h);128 c.close();129 c.moveTo(10, h * 0.5 - 12.5);130 c.lineTo(10, h * 0.5 + 12.5);131 c.lineTo(w - 10, h * 0.5 + 12.5);132 c.lineTo(w - 10, h * 0.5 - 12.5);133 c.close();134 c.fillAndStroke();135};136137mxCabinetsCoverPlate.prototype.foreground = function(c, x, y, w, h)138{139};140141mxCellRenderer.registerShape(mxCabinetsCoverPlate.prototype.cst.COVER_PLATE, mxCabinetsCoverPlate);142143//**********************************************************************************************************************************************************144//Dimension145//**********************************************************************************************************************************************************146/**147* Extends mxShape.148*/149function mxCabinetsDimension(bounds, fill, stroke, strokewidth)150{151 mxShape.call(this);152 this.bounds = bounds;153 this.fill = fill;154 this.stroke = stroke;155 this.strokewidth = (strokewidth != null) ? strokewidth : 1;156};157158/**159* Extends mxShape.160*/161mxUtils.extend(mxCabinetsDimension, mxShape);162163mxCabinetsDimension.prototype.cst = {164 DIMENSION : 'mxgraph.cabinets.dimension'165};166167168169/**170* Function: paintVertexShape171* 172* Paints the vertex shape.173*/174mxCabinetsDimension.prototype.paintVertexShape = function(c, x, y, w, h)175{176 c.translate(x, y);177 this.background(c, x, y, w, h);178};179180mxCabinetsDimension.prototype.background = function(c, x, y, w, h)181{182 c.begin();183 c.moveTo(0, 20);184 c.lineTo(w, 20);185 c.moveTo(10, 15);186 c.lineTo(0, 20);187 c.lineTo(10, 25);188 c.moveTo(w - 10, 15);189 c.lineTo(w, 20);190 c.lineTo(w - 10, 25);191 c.moveTo(0, 15);192 c.lineTo(0, h);193 c.moveTo(w, 15);194 c.lineTo(w, h);195 c.stroke();196};197198mxCellRenderer.registerShape(mxCabinetsDimension.prototype.cst.DIMENSION, mxCabinetsDimension);199200//**********************************************************************************************************************************************************201//Dimension Bottom202//**********************************************************************************************************************************************************203/**204* Extends mxShape.205*/206function mxCabinetsDimensionBottom(bounds, fill, stroke, strokewidth)207{208 mxShape.call(this);209 this.bounds = bounds;210 this.fill = fill;211 this.stroke = stroke;212 this.strokewidth = (strokewidth != null) ? strokewidth : 1;213};214215/**216* Extends mxShape.217*/218mxUtils.extend(mxCabinetsDimensionBottom, mxShape);219220mxCabinetsDimensionBottom.prototype.cst = {221 DIMENSION : 'mxgraph.cabinets.dimensionBottom'222};223224225226/**227* Function: paintVertexShape228* 229* Paints the vertex shape.230*/231mxCabinetsDimensionBottom.prototype.paintVertexShape = function(c, x, y, w, h)232{233 c.translate(x, y);234 this.background(c, x, y, w, h);235};236237mxCabinetsDimensionBottom.prototype.background = function(c, x, y, w, h)238{239 c.begin();240 c.moveTo(0, h - 20);241 c.lineTo(w, h - 20);242 c.moveTo(10, h - 15);243 c.lineTo(0, h - 20);244 c.lineTo(10, h - 25);245 c.moveTo(w - 10, h - 15);246 c.lineTo(w, h - 20);247 c.lineTo(w - 10, h - 25);248 c.moveTo(0, h - 15);249 c.lineTo(0, 0);250 c.moveTo(w, h - 15);251 c.lineTo(w, 0);252 c.stroke();253};254255mxCellRenderer.registerShape(mxCabinetsDimensionBottom.prototype.cst.DIMENSION, mxCabinetsDimensionBottom);256