mxMockupContainers.js 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063
  1. /**
  2. * $Id: mxMockupContainers.js,v 1.10 2013/07/09 11:19:51 mate Exp $
  3. * Copyright (c) 2006-2010, JGraph Ltd
  4. */
  5. //**********************************************************************************************************************************************************
  6. //Video Player
  7. //**********************************************************************************************************************************************************
  8. /**
  9. * Extends mxShape.
  10. */
  11. function mxShapeMockupVideoPlayer(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. this.barPos = 20;
  19. this.barHeight = 30;
  20. };
  21. /**
  22. * Extends mxShape.
  23. */
  24. mxUtils.extend(mxShapeMockupVideoPlayer, mxShape);
  25. mxShapeMockupVideoPlayer.prototype.cst = {
  26. FILL_COLOR2 : 'fillColor2',
  27. TEXT_COLOR : 'textColor',
  28. STROKE_COLOR2 : 'strokeColor2',
  29. STROKE_COLOR3 : 'strokeColor3',
  30. SHAPE_VIDEO_PLAYER : 'mxgraph.mockup.containers.videoPlayer',
  31. BAR_POS : 'barPos',
  32. BAR_HEIGHT : 'barHeight'
  33. };
  34. /**
  35. * Function: paintVertexShape
  36. *
  37. * Paints the vertex shape.
  38. */
  39. mxShapeMockupVideoPlayer.prototype.paintVertexShape = function(c, x, y, w, h)
  40. {
  41. var bgColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  42. var buttonColor = mxUtils.getValue(this.style, mxShapeMockupVideoPlayer.prototype.cst.FILL_COLOR2, '#c4c4c4');
  43. var frameColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#666666');
  44. var filledColor = mxUtils.getValue(this.style, mxShapeMockupVideoPlayer.prototype.cst.STROKE_COLOR2, '#008cff');
  45. var emptyColor = mxUtils.getValue(this.style, mxShapeMockupVideoPlayer.prototype.cst.STROKE_COLOR3, '#c4c4c4');
  46. var barHeight = mxUtils.getValue(this.style, mxShapeMockupVideoPlayer.prototype.cst.BAR_HEIGHT, '30');
  47. w = Math.max(w, 5 * barHeight);
  48. h = Math.max(h, barHeight + 10);
  49. c.translate(x, y);
  50. this.background(c, x, y, w, h, bgColor, frameColor);
  51. c.setShadow(false);
  52. this.otherShapes(c, x, y, w, h, buttonColor, frameColor, filledColor, emptyColor, barHeight);
  53. };
  54. mxShapeMockupVideoPlayer.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  55. {
  56. c.setFillColor(bgColor);
  57. c.setStrokeColor(frameColor);
  58. c.begin();
  59. c.moveTo(0, 0);
  60. c.lineTo(w, 0);
  61. c.lineTo(w, h);
  62. c.lineTo(0, h);
  63. c.close();
  64. c.fillAndStroke();
  65. };
  66. mxShapeMockupVideoPlayer.prototype.otherShapes = function(c, x, y, w, h, buttonColor, frameColor, filledColor, emptyColor, barHeight)
  67. {
  68. var barPos = mxUtils.getValue(this.style, mxShapeMockupVideoPlayer.prototype.cst.BAR_POS, '20');
  69. barPos = Math.max(0, barPos);
  70. barPos = Math.min(100, barPos);
  71. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  72. var buttonR = 8;
  73. var barY = h - barHeight;
  74. var barMin = buttonR;
  75. var barMax = w - buttonR;
  76. var barRange = barMax - barMin;
  77. var realBarPos = barRange * barPos / 100;
  78. var barEnd = barMin + realBarPos;
  79. //progress bar
  80. c.setStrokeColor(filledColor);
  81. c.begin();
  82. c.moveTo(0, barY);
  83. c.lineTo(barEnd, barY);
  84. c.stroke();
  85. c.setStrokeColor(emptyColor);
  86. c.begin();
  87. c.moveTo(barEnd, barY);
  88. c.lineTo(w, barY);
  89. c.stroke();
  90. //progress bar button
  91. c.setStrokeColor(frameColor);
  92. c.begin();
  93. c.ellipse(barEnd - buttonR, barY - buttonR, 2 * buttonR, 2 * buttonR);
  94. c.fillAndStroke();
  95. c.begin();
  96. c.setStrokeWidth(strokeWidth / 2);
  97. c.ellipse(barEnd - buttonR * 0.5, barY - buttonR * 0.5, buttonR, buttonR);
  98. c.fillAndStroke();
  99. c.setStrokeWidth(strokeWidth);
  100. var iconSize = barHeight * 0.3;
  101. var iconY = h - (barHeight + iconSize) * 0.5;
  102. var iconX = barHeight * 0.3;
  103. c.setFillColor(buttonColor);
  104. c.setStrokeColor(buttonColor);
  105. //play icon
  106. c.begin();
  107. c.moveTo(iconX, iconY);
  108. c.lineTo(iconX + iconSize, iconY + iconSize * 0.5);
  109. c.lineTo(iconX, iconY + iconSize);
  110. c.close();
  111. c.fillAndStroke();
  112. //volume icon
  113. var speakerX = barHeight;
  114. var speakerY = h - barHeight;
  115. c.moveTo(speakerX + barHeight * 0.05, speakerY + barHeight * 0.4);
  116. c.lineTo(speakerX + barHeight * 0.15, speakerY + barHeight * 0.4);
  117. c.lineTo(speakerX + barHeight * 0.3, speakerY + barHeight * 0.25);
  118. c.lineTo(speakerX + barHeight * 0.3, speakerY + barHeight * 0.75);
  119. c.lineTo(speakerX + barHeight * 0.15, speakerY + barHeight * 0.6);
  120. c.lineTo(speakerX + barHeight * 0.05, speakerY + barHeight * 0.6);
  121. c.close();
  122. c.fillAndStroke();
  123. c.begin();
  124. c.moveTo(speakerX + barHeight * 0.4, speakerY + barHeight * 0.35);
  125. c.arcTo(barHeight * 0.2, barHeight * 0.3, 0, 0, 1, speakerX + barHeight * 0.4, speakerY + barHeight * 0.65);
  126. c.moveTo(speakerX + barHeight * 0.425, speakerY + barHeight * 0.25);
  127. c.arcTo(barHeight * 0.225, barHeight * 0.35, 0, 0, 1, speakerX + barHeight * 0.425, speakerY + barHeight * 0.75);
  128. c.stroke();
  129. //fullscreen button
  130. var screenX = w - barHeight * 1.3;
  131. c.begin();
  132. c.moveTo(screenX + barHeight * 0.1, speakerY + barHeight * 0.4);
  133. c.lineTo(screenX + barHeight * 0.1, speakerY + barHeight * 0.3);
  134. c.lineTo(screenX + barHeight * 0.25, speakerY + barHeight * 0.3);
  135. c.moveTo(screenX + barHeight * 0.1, speakerY + barHeight * 0.6);
  136. c.lineTo(screenX + barHeight * 0.1, speakerY + barHeight * 0.7);
  137. c.lineTo(screenX + barHeight * 0.25, speakerY + barHeight * 0.7);
  138. c.moveTo(screenX + barHeight * 0.9, speakerY + barHeight * 0.4);
  139. c.lineTo(screenX + barHeight * 0.9, speakerY + barHeight * 0.3);
  140. c.lineTo(screenX + barHeight * 0.75, speakerY + barHeight * 0.3);
  141. c.moveTo(screenX + barHeight * 0.9, speakerY + barHeight * 0.6);
  142. c.lineTo(screenX + barHeight * 0.9, speakerY + barHeight * 0.7);
  143. c.lineTo(screenX + barHeight * 0.75, speakerY + barHeight * 0.7);
  144. c.stroke();
  145. var textColor = mxUtils.getValue(this.style, mxShapeMockupVideoPlayer.prototype.cst.TEXT_COLOR, '#666666');
  146. c.begin();
  147. c.setFontSize(barHeight * 0.5);
  148. c.setFontColor(textColor);
  149. c.text(barHeight * 1.9, h - barHeight * 0.45, 0, 0, '0:00/3:53', mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  150. };
  151. mxCellRenderer.prototype.defaultShapes[mxShapeMockupVideoPlayer.prototype.cst.SHAPE_VIDEO_PLAYER] = mxShapeMockupVideoPlayer;
  152. Graph.handleFactory[mxShapeMockupVideoPlayer.prototype.cst.SHAPE_VIDEO_PLAYER] = function(state)
  153. {
  154. var handles = [Graph.createHandle(state, ['barPos'], function(bounds)
  155. {
  156. var barPos = Math.max(0, Math.min(100, parseFloat(mxUtils.getValue(this.state.style, 'barPos', this.barPos))));
  157. var barH = parseFloat(mxUtils.getValue(this.state.style, 'barHeight', this.barHeight));
  158. return new mxPoint(bounds.x + ((bounds.width - 16) * barPos / bounds.width) / 100 * bounds.width + 8, bounds.y + bounds.height - barH - 20);
  159. }, function(bounds, pt)
  160. {
  161. this.state.style['barPos'] = Math.round(1000 * Math.max(0, Math.min(100, (pt.x - bounds.x) * 100 / bounds.width))) / 1000;
  162. })];
  163. var handle2 = Graph.createHandle(state, ['barHeight'], function(bounds)
  164. {
  165. var barHeight = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'barHeight', this.barHeight))));
  166. return new mxPoint(bounds.x + bounds.width - 20, bounds.y + bounds.height - barHeight);
  167. }, function(bounds, pt)
  168. {
  169. this.state.style['barHeight'] = Math.round(1000 * Math.max(0, Math.min(bounds.height, bounds.y + bounds.height - pt.y))) / 1000;
  170. });
  171. handles.push(handle2);
  172. return handles;
  173. }
  174. //**********************************************************************************************************************************************************
  175. //Accordion (LEGACY)
  176. //**********************************************************************************************************************************************************
  177. /**
  178. * Extends mxShape.
  179. */
  180. function mxShapeMockupAccordion(bounds, fill, stroke, strokewidth)
  181. {
  182. mxShape.call(this);
  183. this.bounds = bounds;
  184. this.fill = fill;
  185. this.stroke = stroke;
  186. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  187. };
  188. /**
  189. * Extends mxShape.
  190. */
  191. mxUtils.extend(mxShapeMockupAccordion, mxShape);
  192. mxShapeMockupAccordion.prototype.cst = {
  193. TEXT_COLOR : 'textColor',
  194. TEXT_COLOR2 : 'textColor2',
  195. TEXT_SIZE : 'textSize',
  196. SHAPE_ACCORDION : 'mxgraph.mockup.containers.accordion',
  197. STROKE_COLOR2 : 'strokeColor2',
  198. FILL_COLOR2 : 'fillColor2',
  199. SELECTED : '+', // must be 1 char
  200. MAIN_TEXT : 'mainText'
  201. };
  202. /**
  203. * Function: paintVertexShape
  204. *
  205. * Paints the vertex shape.
  206. */
  207. mxShapeMockupAccordion.prototype.paintVertexShape = function(c, x, y, w, h)
  208. {
  209. var textStrings = mxUtils.getValue(this.style, mxShapeMockupAccordion.prototype.cst.MAIN_TEXT, '+Group 1, Group 2, Group 3').toString().split(',');
  210. var fontColor = mxUtils.getValue(this.style, mxShapeMockupAccordion.prototype.cst.TEXT_COLOR, '#666666');
  211. var selectedFontColor = mxUtils.getValue(this.style, mxShapeMockupAccordion.prototype.cst.TEXT_COLOR2, '#ffffff');
  212. var fontSize = mxUtils.getValue(this.style, mxShapeMockupAccordion.prototype.cst.TEXT_SIZE, '17').toString();
  213. var frameColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#666666');
  214. var separatorColor = mxUtils.getValue(this.style, mxShapeMockupAccordion.prototype.cst.STROKE_COLOR2, '#c4c4c4');
  215. var bgColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  216. var selectedFillColor = mxUtils.getValue(this.style, mxShapeMockupAccordion.prototype.cst.FILL_COLOR2, '#008cff');
  217. var buttonNum = textStrings.length;
  218. var maxButtonWidth = 0;
  219. var selectedButton = -1;
  220. var rSize = 10; //rounding size
  221. var labelOffset = 5;
  222. for (var i = 0; i < buttonNum; i++)
  223. {
  224. var buttonText = textStrings[i];
  225. if(buttonText.charAt(0) === mxShapeMockupAccordion.prototype.cst.SELECTED)
  226. {
  227. buttonText = textStrings[i].substring(1);
  228. selectedButton = i;
  229. }
  230. var currWidth = mxUtils.getSizeForString(buttonText, fontSize, mxConstants.DEFAULT_FONTFAMILY).width;
  231. if (currWidth > maxButtonWidth)
  232. {
  233. maxButtonWidth = currWidth;
  234. }
  235. }
  236. var minButtonHeight = fontSize * 1.5;
  237. var minH = buttonNum * minButtonHeight;
  238. var trueH = Math.max(h, minH);
  239. var minW = 2 * labelOffset + maxButtonWidth;
  240. var trueW = Math.max(w, minW);
  241. c.translate(x, y);
  242. this.background(c, trueW, trueH, rSize, buttonNum, labelOffset, buttonNum * minButtonHeight, frameColor, separatorColor, bgColor, selectedFillColor, selectedButton, minButtonHeight);
  243. c.setShadow(false);
  244. var currWidth = 0;
  245. for (var i = 0; i < buttonNum; i++)
  246. {
  247. if (i === selectedButton)
  248. {
  249. c.setFontColor(selectedFontColor);
  250. }
  251. else
  252. {
  253. c.setFontColor(fontColor);
  254. }
  255. currWidth = currWidth + labelOffset;
  256. var currHeight = 0;
  257. if (selectedButton === -1 || i <= selectedButton)
  258. {
  259. currHeight = (i * minButtonHeight + minButtonHeight * 0.5);
  260. }
  261. else
  262. {
  263. currHeight = trueH - (buttonNum - i - 0.5) * minButtonHeight;
  264. }
  265. this.buttonText(c, trueW, currHeight, textStrings[i], fontSize);
  266. }
  267. };
  268. mxShapeMockupAccordion.prototype.background = function(c, w, h, rSize, buttonNum, labelOffset, minH, frameColor, separatorColor, bgColor, selectedFillColor, selectedButton, minButtonHeight)
  269. {
  270. c.begin();
  271. //draw the frame
  272. c.setStrokeColor(frameColor);
  273. c.setFillColor(bgColor);
  274. c.moveTo(0, 0);
  275. c.lineTo(w, 0);
  276. c.lineTo(w, h);
  277. c.lineTo(0, h);
  278. c.close();
  279. c.fillAndStroke();
  280. //draw the button separators
  281. c.setStrokeColor(separatorColor);
  282. c.begin();
  283. for (var i = 1; i < buttonNum; i++)
  284. {
  285. if (i !== selectedButton)
  286. {
  287. if (selectedButton === -1 || i < selectedButton)
  288. {
  289. var currHeight = i * minButtonHeight;
  290. c.moveTo(0, currHeight);
  291. c.lineTo(w, currHeight);
  292. }
  293. else
  294. {
  295. var currHeight = h - (buttonNum - i) * minButtonHeight;
  296. c.moveTo(0, currHeight);
  297. c.lineTo(w, currHeight);
  298. }
  299. }
  300. }
  301. c.stroke();
  302. //draw the selected button
  303. c.setStrokeColor(mxConstants.NONE);
  304. c.setFillColor(selectedFillColor);
  305. if (selectedButton !== -1)
  306. {
  307. c.begin();
  308. var buttonTop = minButtonHeight * selectedButton;
  309. var buttonBottom = minButtonHeight * (selectedButton + 1);
  310. c.moveTo(0, buttonTop);
  311. c.lineTo(w, buttonTop);
  312. c.lineTo(w, buttonBottom);
  313. c.lineTo(0, buttonBottom);
  314. c.close();
  315. c.fill();
  316. }
  317. // //draw the frame again, to achieve a nicer effect
  318. c.begin();
  319. c.setStrokeColor(frameColor);
  320. c.setFillColor(bgColor);
  321. c.moveTo(0, 0);
  322. c.lineTo(w, 0);
  323. c.lineTo(w, h);
  324. c.lineTo(0, h);
  325. c.close();
  326. c.stroke();
  327. };
  328. mxShapeMockupAccordion.prototype.buttonText = function(c, w, h, textString, fontSize)
  329. {
  330. if(textString.charAt(0) === mxShapeMockupAccordion.prototype.cst.SELECTED)
  331. {
  332. textString = textString.substring(1);
  333. }
  334. c.begin();
  335. c.setFontSize(fontSize);
  336. c.text((w * 0.5), h, 0, 0, textString, mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  337. };
  338. mxCellRenderer.prototype.defaultShapes[mxShapeMockupAccordion.prototype.cst.SHAPE_ACCORDION] = mxShapeMockupAccordion;
  339. //**********************************************************************************************************************************************************
  340. //Browser Window
  341. //**********************************************************************************************************************************************************
  342. /**
  343. * Extends mxShape.
  344. */
  345. function mxShapeMockupBrowserWindow(bounds, fill, stroke, strokewidth)
  346. {
  347. mxShape.call(this);
  348. this.bounds = bounds;
  349. this.fill = fill;
  350. this.stroke = stroke;
  351. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  352. };
  353. /**
  354. * Extends mxShape.
  355. */
  356. mxUtils.extend(mxShapeMockupBrowserWindow, mxShape);
  357. mxShapeMockupBrowserWindow.prototype.cst = {
  358. STROKE_COLOR2 : 'strokeColor2',
  359. STROKE_COLOR3 : 'strokeColor3',
  360. MAIN_TEXT : 'mainText',
  361. SHAPE_BROWSER_WINDOW : 'mxgraph.mockup.containers.browserWindow'
  362. };
  363. /**
  364. * Function: paintVertexShape
  365. *
  366. * Paints the vertex shape.
  367. */
  368. mxShapeMockupBrowserWindow.prototype.paintVertexShape = function(c, x, y, w, h)
  369. {
  370. var bgColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  371. var frameColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#666666');
  372. var closeColor = mxUtils.getValue(this.style, mxShapeMockupBrowserWindow.prototype.cst.STROKE_COLOR2, '#008cff');
  373. var insideColor = mxUtils.getValue(this.style, mxShapeMockupBrowserWindow.prototype.cst.STROKE_COLOR3, '#c4c4c4');
  374. w = Math.max(w, 260);
  375. h = Math.max(h, 110);
  376. c.translate(x, y);
  377. this.background(c, x, y, w, h, bgColor, frameColor);
  378. c.setShadow(false);
  379. this.otherShapes(c, x, y, w, h, frameColor, insideColor, closeColor);
  380. };
  381. mxShapeMockupBrowserWindow.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  382. {
  383. c.setFillColor(bgColor);
  384. c.setStrokeColor(frameColor);
  385. c.begin();
  386. c.moveTo(0, 0);
  387. c.lineTo(w, 0);
  388. c.lineTo(w, h);
  389. c.lineTo(0, h);
  390. c.close();
  391. c.fillAndStroke();
  392. };
  393. mxShapeMockupBrowserWindow.prototype.otherShapes = function(c, x, y, w, h, frameColor, insideColor, closeColor)
  394. {
  395. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  396. var mainText = mxUtils.getValue(this.style, mxShapeMockupBrowserWindow.prototype.cst.MAIN_TEXT, 'http://www.draw.io,Page 1').toString().split(',');
  397. //window buttons
  398. c.setStrokeColor(frameColor);
  399. c.ellipse(w - 75, 5, 20, 20);
  400. c.stroke();
  401. c.ellipse(w - 50, 5, 20, 20);
  402. c.stroke();
  403. c.setStrokeColor(closeColor);
  404. c.ellipse(w - 25, 5, 20, 20);
  405. c.stroke();
  406. c.setStrokeColor(insideColor);
  407. //lines
  408. c.begin();
  409. c.moveTo(0, 40);
  410. c.lineTo(30, 40);
  411. c.lineTo(30, 15);
  412. c.arcTo(5, 5, 0, 0, 1, 35, 10);
  413. c.lineTo(170, 10);
  414. c.arcTo(5, 5, 0, 0, 1, 175, 15);
  415. c.lineTo(175, 40);
  416. c.lineTo(w, 40);
  417. c.stroke();
  418. c.begin();
  419. c.moveTo(0, 110);
  420. c.lineTo(w, 110);
  421. c.stroke();
  422. //address field
  423. c.begin();
  424. c.moveTo(100, 60);
  425. c.arcTo(5, 5, 0, 0, 1, 105, 55);
  426. c.lineTo(w - 15, 55);
  427. c.arcTo(5, 5, 0, 0, 1, w - 10, 60);
  428. c.lineTo(w - 10, 85);
  429. c.arcTo(5, 5, 0, 0, 1, w - 15, 90);
  430. c.lineTo(105, 90);
  431. c.arcTo(5, 5, 0, 0, 1, 100, 85);
  432. c.close();
  433. c.stroke();
  434. //text
  435. var textColor = mxUtils.getValue(this.style, mxShapeMockupBrowserWindow.prototype.cst.TEXT_COLOR, '#666666');
  436. c.setFontColor(textColor);
  437. c.setFontSize(17);
  438. c.text(65, 25, 0, 0, mainText[1], mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  439. c.text(130, 73, 0, 0, mainText[0], mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  440. c.stroke();
  441. //icon on tab
  442. c.translate(37, 17);
  443. c.begin();
  444. c.moveTo(0, 0);
  445. c.lineTo(11, 0);
  446. c.lineTo(15, 4);
  447. c.lineTo(15, 18);
  448. c.lineTo(0, 18);
  449. c.close();
  450. c.stroke();
  451. c.setStrokeWidth(strokeWidth * 0.5); //maybe because of this (read later)
  452. c.begin();
  453. c.moveTo(11, 0);
  454. c.lineTo(11, 4);
  455. c.lineTo(15, 5);
  456. c.stroke();
  457. //icon in address bar
  458. c.setStrokeWidth(strokeWidth * 2); // i'm not sure why i have to multiply here
  459. c.translate(70, 47);
  460. c.begin();
  461. c.moveTo(0, 0);
  462. c.lineTo(11, 0);
  463. c.lineTo(15, 4);
  464. c.lineTo(15, 18);
  465. c.lineTo(0, 18);
  466. c.close();
  467. c.stroke();
  468. c.setStrokeWidth(strokeWidth * 0.5);
  469. c.begin();
  470. c.moveTo(11, 0);
  471. c.lineTo(11, 4);
  472. c.lineTo(15, 5);
  473. c.stroke();
  474. //back
  475. var iSi = 20; //icon size
  476. c.setFillColor(insideColor);
  477. c.begin();
  478. c.setStrokeWidth(strokeWidth * 2); // i'm not sure why i have to multiply here
  479. c.translate(-95, 0);
  480. c.moveTo(0, iSi * 0.5);
  481. c.lineTo(iSi * 0.5, 0);
  482. c.lineTo(iSi * 0.5, iSi * 0.3);
  483. c.lineTo(iSi, iSi * 0.3);
  484. c.lineTo(iSi, iSi * 0.7);
  485. c.lineTo(iSi * 0.5, iSi * 0.7);
  486. c.lineTo(iSi * 0.5, iSi);
  487. c.close();
  488. c.fillAndStroke();
  489. //forward
  490. c.begin();
  491. c.translate(30, 0);
  492. c.moveTo(iSi, iSi * 0.5);
  493. c.lineTo(iSi * 0.5, 0);
  494. c.lineTo(iSi * 0.5, iSi * 0.3);
  495. c.lineTo(0, iSi * 0.3);
  496. c.lineTo(0, iSi * 0.7);
  497. c.lineTo(iSi * 0.5, iSi * 0.7);
  498. c.lineTo(iSi * 0.5, iSi);
  499. c.close();
  500. c.fillAndStroke();
  501. //refresh
  502. c.begin();
  503. c.translate(30, 0);
  504. c.moveTo(iSi * 0.78, iSi * 0.665);
  505. c.arcTo(iSi * 0.3, iSi * 0.3, 0, 1, 1, iSi * 0.675, iSi * 0.252);
  506. c.lineTo(iSi * 0.595, iSi * 0.325);
  507. c.lineTo(iSi * 0.99, iSi * 0.415);
  508. c.lineTo(iSi * 0.9, iSi * 0.04);
  509. c.lineTo(iSi * 0.815, iSi * 0.12);
  510. c.arcTo(iSi * 0.49, iSi * 0.49, 0, 1, 0, iSi * 0.92, iSi * 0.8);
  511. c.close();
  512. c.fillAndStroke();
  513. };
  514. mxCellRenderer.prototype.defaultShapes[mxShapeMockupBrowserWindow.prototype.cst.SHAPE_BROWSER_WINDOW] = mxShapeMockupBrowserWindow;
  515. //**********************************************************************************************************************************************************
  516. //User, Male
  517. //**********************************************************************************************************************************************************
  518. /**
  519. * Extends mxShape.
  520. */
  521. function mxShapeMockupUserMale(bounds, fill, stroke, strokewidth)
  522. {
  523. mxShape.call(this);
  524. this.bounds = bounds;
  525. this.fill = fill;
  526. this.stroke = stroke;
  527. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  528. };
  529. /**
  530. * Extends mxShape.
  531. */
  532. mxUtils.extend(mxShapeMockupUserMale, mxShape);
  533. mxShapeMockupUserMale.prototype.cst = {
  534. STROKE_COLOR2 : 'strokeColor2',
  535. SHAPE_MALE_USER : 'mxgraph.mockup.containers.userMale'
  536. };
  537. /**
  538. * Function: paintVertexShape
  539. *
  540. * Paints the vertex shape.
  541. */
  542. mxShapeMockupUserMale.prototype.paintVertexShape = function(c, x, y, w, h)
  543. {
  544. var bgColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  545. var frameColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#666666');
  546. var insideColor = mxUtils.getValue(this.style, mxShapeMockupUserMale.prototype.cst.STROKE_COLOR2, '#008cff');
  547. c.translate(x, y);
  548. this.background(c, x, y, w, h, bgColor, frameColor);
  549. c.setShadow(false);
  550. this.otherShapes(c, x, y, w, h, insideColor, frameColor);
  551. };
  552. mxShapeMockupUserMale.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  553. {
  554. c.setFillColor(bgColor);
  555. c.setStrokeColor(frameColor);
  556. c.begin();
  557. c.moveTo(0, 0);
  558. c.lineTo(w, 0);
  559. c.lineTo(w, h);
  560. c.lineTo(0, h);
  561. c.close();
  562. c.fillAndStroke();
  563. };
  564. mxShapeMockupUserMale.prototype.otherShapes = function(c, x, y, w, h, insideColor, frameColor)
  565. {
  566. //head left
  567. c.setStrokeColor(insideColor);
  568. c.setLineCap('round');
  569. c.setLineJoin('round');
  570. c.begin();
  571. c.moveTo(w * 0.5, h * 0.6721);
  572. c.curveTo(w * 0.3891, h * 0.6721, w * 0.31, h * 0.5648, w * 0.31, h * 0.3962);
  573. c.curveTo(w * 0.31, h * 0.3656, w * 0.3012, h * 0.3473, w * 0.3051, h * 0.3227);
  574. c.curveTo(w * 0.3126, h * 0.2762, w * 0.3124, h * 0.2212, w * 0.332, h * 0.1939);
  575. c.curveTo(w * 0.354, h * 0.1633, w * 0.4382, h * 0.12, w * 0.5, h * 0.12);
  576. c.stroke();
  577. //left ear
  578. c.begin();
  579. c.moveTo(w * 0.3046, h * 0.3716);
  580. c.curveTo(w * 0.3046, h * 0.3716, w * 0.3046, h * 0.341, w * 0.2826, h * 0.3594);
  581. c.curveTo(w * 0.2606, h * 0.3778, w * 0.2661, h * 0.4452, w * 0.266, h * 0.4452);
  582. c.quadTo(w * 0.2715, h * 0.4942, w * 0.277, h * 0.5065);
  583. c.curveTo(w * 0.2825, h * 0.5187, w * 0.277, h * 0.5187, w * 0.2935, h * 0.5371);
  584. c.curveTo(w * 0.31, h * 0.5554, w * 0.3375, h * 0.5615, w * 0.3375, h * 0.5616);
  585. c.stroke();
  586. // left shoulder
  587. c.begin();
  588. c.moveTo(w * 0.3829, h * 0.6213);
  589. c.curveTo(w * 0.3829, h * 0.6213, w * 0.405, h * 0.7704, w * 0.2921, h * 0.7888);
  590. c.curveTo(w * 0.2536, h * 0.795, w * 0.1328, h * 0.85, w * 0.1052, h * 0.8745);
  591. c.curveTo(w * 0.0776, h * 0.899, w * 0.0641, h * 0.9316, w * 0.0571, h * 0.9622);
  592. c.quadTo(w * 0.05, h, w * 0.05, h);
  593. c.stroke();
  594. // left hairline
  595. c.begin();
  596. c.moveTo(w * 0.3427, h * 0.4185);
  597. c.curveTo(w * 0.3427, h * 0.4185, w * 0.3427, h * 0.3839, w * 0.3427, h * 0.3593);
  598. c.curveTo(w * 0.3427, h * 0.3348, w * 0.3663, h * 0.3103, w * 0.3718, h * 0.3041);
  599. c.curveTo(w * 0.3773, h * 0.298, w * 0.3822, h * 0.2673, w * 0.3877, h * 0.2551);
  600. c.curveTo(w * 0.3932, h * 0.2429, w * 0.4095, h * 0.2429, w * 0.4259, h * 0.2367);
  601. c.curveTo(w * 0.4424, h * 0.2306, w * 0.4984, h * 0.2357, w * 0.4984, h * 0.2357);
  602. c.stroke();
  603. //shirt
  604. c.begin();
  605. c.moveTo(w * 0.365, h * 0.7427);
  606. c.curveTo(w * 0.365, h * 0.7427, w * 0.3772, h * 0.8076, w * 0.4286, h * 0.8224);
  607. c.curveTo(w * 0.4816, h * 0.8377, w * 0.5028, h * 0.8347, w * 0.5028, h * 0.8347);
  608. c.stroke();
  609. c.begin();
  610. c.moveTo(w * 0.3322, h * 0.7764);
  611. c.curveTo(w * 0.3322, h * 0.7764, w * 0.3556, h * 0.8386, w * 0.4038, h * 0.8684);
  612. c.curveTo(w * 0.4533, h * 0.8991, w * 0.5029, h * 0.8929, w * 0.5029, h * 0.8929);
  613. c.stroke();
  614. c.begin();
  615. c.moveTo(w * 0.2717, h * 0.9);
  616. c.lineTo(w * 0.2717, h);
  617. c.stroke();
  618. c.begin();
  619. c.moveTo(w * 0.1671, h * 0.8991);
  620. c.curveTo(w * 0.1671, h * 0.8991, w * 0.1726, h * 0.9114, w * 0.1836, h * 0.9481);
  621. c.curveTo(w * 0.1946, h * 0.9849, w * 0.2, h, w * 0.2, h);
  622. c.stroke();
  623. //head right
  624. c.begin();
  625. c.moveTo(w * 0.5, h * 0.6721);
  626. c.curveTo(w * 0.6109, h * 0.6721, w * 0.69, h * 0.5648, w * 0.69, h * 0.3962);
  627. c.curveTo(w * 0.69, h * 0.3656, w * 0.6988, h * 0.3473, w * 0.6949, h * 0.3227);
  628. c.curveTo(w * 0.6847, h * 0.2762, w * 0.6876, h * 0.2212, w * 0.668, h * 0.1939);
  629. c.curveTo(w * 0.646, h * 0.1633, w * 0.5618, h * 0.12, w * 0.5, h * 0.12);
  630. c.stroke();
  631. //right ear
  632. c.begin();
  633. c.moveTo(w * 0.6954, h * 0.3716);
  634. c.curveTo(w * 0.6954, h * 0.3716, w * 0.6954, h * 0.341, w * 0.7174, h * 0.3594);
  635. c.curveTo(w * 0.7394, h * 0.3778, w * 0.7339, h * 0.4452, w * 0.734, h * 0.4452);
  636. c.quadTo(w * 0.7285, h * 0.4942, w * 0.723, h * 0.5065);
  637. c.curveTo(w * 0.7175, h * 0.5187, w * 0.723, h * 0.5187, w * 0.7065, h * 0.5371);
  638. c.curveTo(w * 0.69, h * 0.5554, w * 0.6625, h * 0.5615, w * 0.6625, h * 0.5616);
  639. c.stroke();
  640. // right shoulder
  641. c.begin();
  642. c.moveTo(w * 0.6171, h * 0.6213);
  643. c.curveTo(w * 0.6171, h * 0.6213, w * 0.595, h * 0.7704, w * 0.7079, h * 0.7888);
  644. c.curveTo(w * 0.7464, h * 0.795, w * 0.8672, h * 0.85, w * 0.8948, h * 0.8745);
  645. c.curveTo(w * 0.9224, h * 0.899, w * 0.9359, h * 0.9316, w * 0.9429, h * 0.9622);
  646. c.quadTo(w * 0.95, h, w * 0.95, h);
  647. c.stroke();
  648. // right hairline
  649. c.begin();
  650. c.moveTo(w * 0.6573, h * 0.4185);
  651. c.curveTo(w * 0.6573, h * 0.4185, w * 0.6573, h * 0.3839, w * 0.6573, h * 0.3593);
  652. c.curveTo(w * 0.6573, h * 0.3348, w * 0.6337, h * 0.3103, w * 0.6282, h * 0.3041);
  653. c.curveTo(w * 0.6227, h * 0.298, w * 0.6178, h * 0.2673, w * 0.6123, h * 0.2551);
  654. c.curveTo(w * 0.6068, h * 0.2429, w * 0.5905, h * 0.2429, w * 0.5741, h * 0.2367);
  655. c.curveTo(w * 0.5576, h * 0.2306, w * 0.5016, h * 0.2357, w * 0.5016, h * 0.2357);
  656. c.stroke();
  657. //shirt, right
  658. c.begin();
  659. c.moveTo(w * 0.635, h * 0.7427);
  660. c.curveTo(w * 0.635, h * 0.7427, w * 0.6228, h * 0.8076, w * 0.5714, h * 0.8224);
  661. c.curveTo(w * 0.5184, h * 0.8377, w * 0.4972, h * 0.8347, w * 0.4972, h * 0.8347);
  662. c.stroke();
  663. c.begin();
  664. c.moveTo(w * 0.6678, h * 0.7764);
  665. c.curveTo(w * 0.6678, h * 0.7764, w * 0.6444, h * 0.8386, w * 0.5962, h * 0.8684);
  666. c.curveTo(w * 0.5467, h * 0.8991, w * 0.4971, h * 0.8929, w * 0.4971, h * 0.8929);
  667. c.stroke();
  668. c.begin();
  669. c.moveTo(w * 0.7283, h * 0.9);
  670. c.lineTo(w * 0.7283, h);
  671. c.stroke();
  672. c.begin();
  673. c.moveTo(w * 0.8329, h * 0.8991);
  674. c.curveTo(w * 0.8329, h * 0.8991, w * 0.8274, h * 0.9114, w * 0.8164, h * 0.9481);
  675. c.curveTo(w * 0.8054, h * 0.9849, w * 0.8, h, w * 0.8, h);
  676. c.stroke();
  677. c.setStrokeColor(frameColor);
  678. c.begin();
  679. c.moveTo(0, 0);
  680. c.lineTo(w, 0);
  681. c.lineTo(w, h);
  682. c.lineTo(0, h);
  683. c.close();
  684. c.stroke();
  685. };
  686. mxCellRenderer.prototype.defaultShapes[mxShapeMockupUserMale.prototype.cst.SHAPE_MALE_USER] = mxShapeMockupUserMale;
  687. //**********************************************************************************************************************************************************
  688. //User, Female
  689. //**********************************************************************************************************************************************************
  690. /**
  691. * Extends mxShape.
  692. */
  693. function mxShapeMockupUserFemale(bounds, fill, stroke, strokewidth)
  694. {
  695. mxShape.call(this);
  696. this.bounds = bounds;
  697. this.fill = fill;
  698. this.stroke = stroke;
  699. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  700. };
  701. /**
  702. * Extends mxShape.
  703. */
  704. mxUtils.extend(mxShapeMockupUserFemale, mxShape);
  705. mxShapeMockupUserFemale.prototype.cst = {
  706. STROKE_COLOR2 : 'strokeColor2',
  707. SHAPE_FEMALE_USER : 'mxgraph.mockup.containers.userFemale'
  708. };
  709. /**
  710. * Function: paintVertexShape
  711. *
  712. * Paints the vertex shape.
  713. */
  714. mxShapeMockupUserFemale.prototype.paintVertexShape = function(c, x, y, w, h)
  715. {
  716. var bgColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  717. var frameColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#666666');
  718. var insideColor = mxUtils.getValue(this.style, mxShapeMockupUserFemale.prototype.cst.STROKE_COLOR2, '#008cff');
  719. c.translate(x, y);
  720. this.background(c, x, y, w, h, bgColor, frameColor);
  721. c.setShadow(false);
  722. this.otherShapes(c, x, y, w, h, insideColor, frameColor);
  723. };
  724. mxShapeMockupUserFemale.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  725. {
  726. c.setFillColor(bgColor);
  727. c.setStrokeColor(frameColor);
  728. c.begin();
  729. c.moveTo(0, 0);
  730. c.lineTo(w, 0);
  731. c.lineTo(w, h);
  732. c.lineTo(0, h);
  733. c.close();
  734. c.fillAndStroke();
  735. };
  736. mxShapeMockupUserFemale.prototype.otherShapes = function(c, x, y, w, h, insideColor, frameColor)
  737. {
  738. //head left
  739. c.setStrokeColor(insideColor);
  740. c.setLineCap('round');
  741. c.setLineJoin('round');
  742. c.begin();
  743. c.moveTo(w * 0.3148, h * 0.468);
  744. c.curveTo(w * 0.3045, h * 0.3195, w * 0.3176, h * 0.2383, w * 0.3302, h * 0.2069);
  745. c.curveTo(w * 0.3508, h * 0.1557, w * 0.44, h * 0.1156, w * 0.5026, h * 0.1156);
  746. c.stroke();
  747. c.begin();
  748. c.moveTo(w * 0.5029, h * 0.6728);
  749. c.curveTo(w * 0.4616, h * 0.6728, w * 0.4018, h * 0.6177, w * 0.3663, h * 0.5653);
  750. c.stroke();
  751. c.begin();
  752. c.moveTo(w * 0.3108, h * 0.4021);
  753. c.curveTo(w * 0.3108, h * 0.4021, w * 0.3091, h * 0.3765, w * 0.2891, h * 0.3933);
  754. c.curveTo(w * 0.2691, h * 0.4101, w * 0.2782, h * 0.4661, w * 0.2782, h * 0.4661);
  755. c.quadTo(w * 0.2862, h * 0.5067, w * 0.2922, h * 0.5166);
  756. c.curveTo(w * 0.2982, h * 0.5265, w * 0.2929, h * 0.5268, w * 0.3097, h * 0.5412);
  757. c.stroke();
  758. c.begin();
  759. c.moveTo(w * 0.4038, h * 0.6176);
  760. c.curveTo(w * 0.4038, h * 0.6176, w * 0.4324, h * 0.7778, w * 0.3375, h * 0.7963);
  761. c.curveTo(w * 0.3054, h * 0.8026, w * 0.1753, h * 0.8578, w * 0.15, h * 0.8826);
  762. c.curveTo(w * 0.1247, h * 0.9074, w * 0.1126, h * 0.9412, w * 0.1063, h * 0.9722);
  763. c.curveTo(w * 0.10, h * 1.0032, w * 0.1, h, w * 0.1, h);
  764. c.stroke();
  765. c.begin();
  766. c.moveTo(w * 0.6377, h * 0.3365);
  767. c.curveTo(w * 0.5927, h * 0.2634, w * 0.5206, h * 0.2634, w * 0.5206, h * 0.2634);
  768. c.quadTo(w * 0.3769, h * 0.2591, w * 0.3713, h * 0.2659);
  769. c.curveTo(w * 0.3657, h * 0.2727, w * 0.3405, h * 0.3674, w * 0.3405, h * 0.3946);
  770. c.curveTo(w * 0.3405, h * 0.4218, w * 0.3405, h * 0.4602, w * 0.3405, h * 0.4602);
  771. c.quadTo(w * 0.3546, h * 0.6401, w * 0.3546, h * 0.6626);
  772. c.stroke();
  773. c.begin();
  774. c.moveTo(w * 0.2931, h * 0.818);
  775. c.curveTo(w * 0.2931, h * 0.818, w * 0.3224, h * 0.9159, w * 0.3826, h * 0.9677);
  776. c.curveTo(w * 0.4446, h * 1.01, w * 0.5065, h, w * 0.5065, h);
  777. c.stroke();
  778. c.begin();
  779. c.moveTo(w * 0.2995, h * 0.9106);
  780. c.lineTo(w * 0.2995, h);
  781. c.stroke();
  782. c.begin();
  783. c.moveTo(w * 0.2081, h * 0.907);
  784. c.curveTo(w * 0.2081, h * 0.907, w * 0.2131, h * 0.9194, w * 0.2232, h * 0.9565);
  785. c.curveTo(w * 0.2333, h * 0.9936, w * 0.24, h, w * 0.24, h);
  786. c.stroke();
  787. c.begin();
  788. c.moveTo(w * 0.6951, h * 0.4988);
  789. c.curveTo(w * 0.6951, h * 0.4662, w * 0.7042, h * 0.3453, w * 0.7, h * 0.32);
  790. c.curveTo(w * 0.6923, h * 0.273, w * 0.6926, h * 0.2175, w * 0.6727, h * 0.19);
  791. c.curveTo(w * 0.6504, h * 0.159, w * 0.5651, h * 0.1157, w * 0.5025, h * 0.1157);
  792. c.stroke();
  793. c.begin();
  794. c.moveTo(w * 0.5029, h * 0.6728);
  795. c.curveTo(w * 0.5546, h * 0.6728, w * 0.6107, h * 0.6316, w * 0.6461, h * 0.5602);
  796. c.stroke();
  797. c.begin();
  798. c.moveTo(w * 0.696, h * 0.4022);
  799. c.curveTo(w * 0.696, h * 0.4022, w * 0.6983, h * 0.3766, w * 0.7179, h * 0.4106);
  800. c.curveTo(w * 0.7375, h * 0.4278, w * 0.7273, h * 0.4836, w * 0.7273, h * 0.4836);
  801. c.quadTo(w * 0.7184, h * 0.5241, w * 0.7123, h * 0.5338);
  802. c.curveTo(w * 0.7062, h * 0.5436, w * 0.7114, h * 0.544, w * 0.6943, h * 0.558);
  803. c.stroke();
  804. c.begin();
  805. c.moveTo(w * 0.5995, h * 0.6278);
  806. c.curveTo(w * 0.5995, h * 0.6278, w * 0.5724, h * 0.7777, w * 0.6663, h * 0.7963);
  807. c.curveTo(w * 0.6984, h * 0.8026, w * 0.8386, h * 0.8578, w * 0.8638, h * 0.8826);
  808. c.curveTo(w * 0.8891, h * 0.9074, w * 0.9016, h * 0.9412, w * 0.9079, h * 0.9722);
  809. c.curveTo(w * 0.9142, h * 1.0032, w * 0.91, h, w * 0.91, h);
  810. c.stroke();
  811. c.begin();
  812. c.moveTo(w * 0.6545, h * 0.6802);
  813. c.lineTo(w * 0.6545, h * 0.3986);
  814. c.stroke();
  815. c.begin();
  816. c.moveTo(w * 0.7132, h * 0.8078);
  817. c.curveTo(w * 0.7132, h * 0.8078, w * 0.6839, h * 0.916, w * 0.6237, h * 0.9678);
  818. c.curveTo(w * 0.5617, h * 1.01, w * 0.4998, h, w * 0.4998, h);
  819. c.stroke();
  820. c.begin();
  821. c.moveTo(w * 0.7111, h * 0.9106);
  822. c.lineTo(w * 0.7111, h);
  823. c.stroke();
  824. c.begin();
  825. c.moveTo(w * 0.8075, h * 0.907);
  826. c.curveTo(w * 0.8075, h * 0.907, w * 0.8025, h * 0.9194, w * 0.7924, h * 0.9565);
  827. c.curveTo(w * 0.7823, h * 0.9936, w * 0.775, h, w * 0.775, h);
  828. c.stroke();
  829. c.begin();
  830. c.moveTo(w * 0.3148, h * 0.5448);
  831. c.curveTo(w * 0.3148, h * 0.5448, w * 0.32, h * 0.6216, w * 0.3148, h * 0.6677);
  832. c.quadTo(w * 0.2891, h * 0.7343, w * 0.2891, h * 0.7343);
  833. c.lineTo(w * 0.3303, h * 0.7625);
  834. c.lineTo(w * 0.39, h * 0.7625);
  835. c.stroke();
  836. c.begin();
  837. c.moveTo(w * 0.6852, h * 0.5448);
  838. c.curveTo(w * 0.6852, h * 0.5448, w * 0.68, h * 0.6216, w * 0.6852, h * 0.6677);
  839. c.quadTo(w * 0.7109, h * 0.7343, w * 0.7109, h * 0.7343);
  840. c.lineTo(w * 0.6697, h * 0.7625);
  841. c.lineTo(w * 0.62, h * 0.7625);
  842. c.stroke();
  843. c.setStrokeColor(frameColor);
  844. c.begin();
  845. c.moveTo(0, 0);
  846. c.lineTo(w, 0);
  847. c.lineTo(w, h);
  848. c.lineTo(0, h);
  849. c.close();
  850. c.stroke();
  851. };
  852. mxCellRenderer.prototype.defaultShapes[mxShapeMockupUserFemale.prototype.cst.SHAPE_FEMALE_USER] = mxShapeMockupUserFemale;
  853. //**********************************************************************************************************************************************************
  854. //Group
  855. //**********************************************************************************************************************************************************
  856. /**
  857. * Extends mxShape.
  858. */
  859. function mxShapeMockupGroup(bounds, fill, stroke, strokewidth)
  860. {
  861. mxShape.call(this);
  862. this.bounds = bounds;
  863. this.fill = fill;
  864. this.stroke = stroke;
  865. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  866. };
  867. /**
  868. * Extends mxShape.
  869. */
  870. mxUtils.extend(mxShapeMockupGroup, mxShape);
  871. mxShapeMockupGroup.prototype.cst = {
  872. MAIN_TEXT : 'mainText',
  873. TEXT_SIZE : 'textSize',
  874. TEXT_COLOR : 'textColor',
  875. FILL_COLOR2 : 'fillColor2',
  876. SHAPE_GROUP : 'mxgraph.mockup.containers.group'
  877. };
  878. /**
  879. * Function: paintVertexShape
  880. *
  881. * Paints the vertex shape.
  882. */
  883. mxShapeMockupGroup.prototype.paintVertexShape = function(c, x, y, w, h)
  884. {
  885. var groupString = mxUtils.getValue(this.style, mxShapeMockupGroup.prototype.cst.MAIN_TEXT, 'Group').toString();
  886. var fontSize = mxUtils.getValue(this.style, mxShapeMockupGroup.prototype.cst.TEXT_SIZE, '17');
  887. var textWidth = mxUtils.getSizeForString(groupString, fontSize, mxConstants.DEFAULT_FONTFAMILY).width;
  888. if (textWidth === 0)
  889. {
  890. textWidth = Math.max(80, textWidth);
  891. }
  892. c.translate(x, y);
  893. w = Math.max(w, textWidth + 15);
  894. h = Math.max(h, fontSize + 10);
  895. this.background(c, w, h, textWidth, fontSize);
  896. c.setShadow(false);
  897. this.foreground(c, w, h, textWidth, fontSize);
  898. this.buttonText(c, w, h, groupString, fontSize);
  899. };
  900. mxShapeMockupGroup.prototype.background = function(c, w, h, textWidth, fontSize)
  901. {
  902. c.roundrect(0, fontSize * 0.5, w, h - fontSize * 0.5, 5, 5);
  903. c.fillAndStroke();
  904. };
  905. mxShapeMockupGroup.prototype.foreground = function(c, w, h, textWidth, fontSize)
  906. {
  907. var fillColor = mxUtils.getValue(this.style, mxShapeMockupGroup.prototype.cst.FILL_COLOR2, '#000000');
  908. c.setFillColor(fillColor);
  909. c.roundrect(3, 0, textWidth + 6, fontSize * 1.5, fontSize * 0.25, fontSize * 0.25);
  910. c.fill();
  911. };
  912. mxShapeMockupGroup.prototype.buttonText = function(c, w, h, textString, fontSize)
  913. {
  914. var fontColor = mxUtils.getValue(this.style, mxShapeMockupGroup.prototype.cst.TEXT_COLOR, '#ffffff');
  915. c.setFontColor(fontColor);
  916. c.setFontSize(fontSize);
  917. c.text(6, 0, 0, 0, textString, mxConstants.ALIGN_LEFT, mxConstants.ALIGN_TOP, 0, null, 0, 0, 0);
  918. };
  919. mxCellRenderer.prototype.defaultShapes[mxShapeMockupGroup.prototype.cst.SHAPE_GROUP] = mxShapeMockupGroup;
  920. //**********************************************************************************************************************************************************
  921. //Window
  922. //**********************************************************************************************************************************************************
  923. /**
  924. * Extends mxShape.
  925. */
  926. function mxShapeMockupWindow(bounds, fill, stroke, strokewidth)
  927. {
  928. mxShape.call(this);
  929. this.bounds = bounds;
  930. this.fill = fill;
  931. this.stroke = stroke;
  932. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  933. };
  934. /**
  935. * Extends mxShape.
  936. */
  937. mxUtils.extend(mxShapeMockupWindow, mxShape);
  938. mxShapeMockupWindow.prototype.cst = {
  939. MAIN_TEXT : 'mainText',
  940. TEXT_SIZE : 'textSize',
  941. TEXT_COLOR : 'textColor',
  942. STROKE_COLOR2 : 'strokeColor2',
  943. STROKE_COLOR3 : 'strokeColor3',
  944. SHAPE_WINDOW : 'mxgraph.mockup.containers.window'
  945. };
  946. /**
  947. * Function: paintVertexShape
  948. *
  949. * Paints the vertex shape.
  950. */
  951. mxShapeMockupWindow.prototype.paintVertexShape = function(c, x, y, w, h)
  952. {
  953. var bgColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  954. var frameColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#666666');
  955. var closeColor = mxUtils.getValue(this.style, mxShapeMockupWindow.prototype.cst.STROKE_COLOR2, '#008cff');
  956. var insideColor = mxUtils.getValue(this.style, mxShapeMockupWindow.prototype.cst.STROKE_COLOR3, '#c4c4c4');
  957. c.translate(x, y);
  958. h = Math.max(h, 30);
  959. w = Math.max(w, 90);
  960. this.background(c, x, y, w, h, bgColor, frameColor);
  961. c.setShadow(false);
  962. this.otherShapes(c, x, y, w, h, frameColor, insideColor, closeColor);
  963. };
  964. mxShapeMockupWindow.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  965. {
  966. c.setFillColor(bgColor);
  967. c.setStrokeColor(frameColor);
  968. c.rect(0, 0, w, h);
  969. c.fillAndStroke();
  970. };
  971. mxShapeMockupWindow.prototype.otherShapes = function(c, x, y, w, h, frameColor, insideColor, closeColor)
  972. {
  973. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  974. //window buttons
  975. c.setStrokeColor(frameColor);
  976. c.ellipse(w - 75, 5, 20, 20);
  977. c.stroke();
  978. c.ellipse(w - 50, 5, 20, 20);
  979. c.stroke();
  980. c.setStrokeColor(closeColor);
  981. c.ellipse(w - 25, 5, 20, 20);
  982. c.stroke();
  983. c.setStrokeColor(insideColor);
  984. //lines
  985. c.begin();
  986. c.moveTo(0, 30);
  987. c.lineTo(w, 30);
  988. c.stroke();
  989. //text
  990. var windowTitle = mxUtils.getValue(this.style, mxShapeMockupWindow.prototype.cst.MAIN_TEXT, 'Window Title');
  991. var fontColor = mxUtils.getValue(this.style, mxShapeMockupWindow.prototype.cst.TEXT_COLOR, '#666666');
  992. var fontSize = mxUtils.getValue(this.style, mxShapeMockupWindow.prototype.cst.TEXT_SIZE, '17').toString();
  993. c.setFontColor(fontColor);
  994. c.setFontSize(fontSize);
  995. c.text(10, 15, 0, 0, windowTitle, mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  996. c.stroke();
  997. };
  998. mxCellRenderer.prototype.defaultShapes[mxShapeMockupWindow.prototype.cst.SHAPE_WINDOW] = mxShapeMockupWindow;
  999. //**********************************************************************************************************************************************************
  1000. //Horizontal Tab Bar (LEGACY)
  1001. //**********************************************************************************************************************************************************
  1002. /**
  1003. * Extends mxShape.
  1004. */
  1005. function mxShapeMockupHorTabBar(bounds, fill, stroke, strokewidth)
  1006. {
  1007. mxShape.call(this);
  1008. this.bounds = bounds;
  1009. this.fill = fill;
  1010. this.stroke = stroke;
  1011. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1012. };
  1013. /**
  1014. * Extends mxShape.
  1015. */
  1016. mxUtils.extend(mxShapeMockupHorTabBar, mxShape);
  1017. mxShapeMockupHorTabBar.prototype.cst = {
  1018. BLOCK : 'block',
  1019. CONE : 'cone',
  1020. HALF_CONE : 'halfCone',
  1021. ROUND : 'round',
  1022. TEXT_SIZE : 'textSize',
  1023. TAB_NAMES : 'tabs',
  1024. TAB_STYLE : 'tabStyle',
  1025. STYLE_FILLCOLOR2 : 'fillColor2',
  1026. TEXT_COLOR : 'textColor',
  1027. SEL_TEXT_COLOR : 'textColor2',
  1028. SHAPE_HOR_TAB_BAR : 'mxgraph.mockup.containers.horTabBar'
  1029. };
  1030. /**
  1031. * Function: paintVertexShape
  1032. *
  1033. * Paints the vertex shape.
  1034. */
  1035. //TODO tab widths are fixed, so tab text length is a bit of an issue. Cannot be fixed while we use labels for tab names
  1036. mxShapeMockupHorTabBar.prototype.paintVertexShape = function(c, x, y, w, h)
  1037. {
  1038. var fontSize = mxUtils.getValue(this.style, mxShapeMockupHorTabBar.prototype.cst.TEXT_SIZE, '17').toString();
  1039. var tabNames = mxUtils.getValue(this.style, mxShapeMockupHorTabBar.prototype.cst.TAB_NAMES, 'Tab 1,+Tab 2,Tab 3').toString().split(',');
  1040. var tabH = fontSize * 1.5;
  1041. var startOffset = 10;
  1042. var tabOffset = 5;
  1043. var labelOffset = 10;
  1044. var tabCount = tabNames.length;
  1045. var minW = 2 * startOffset + (tabCount - 1) * tabOffset + tabCount * 2 * labelOffset;
  1046. var rSize = 5;
  1047. var labelWidths = new Array();
  1048. var selectedTab = -1;
  1049. for (var i = 0; i < tabCount; i++)
  1050. {
  1051. var currLabel = tabNames[i];
  1052. if(currLabel.charAt(0) === '+')
  1053. {
  1054. currLabel = currLabel.substring(1);
  1055. selectedTab = i;
  1056. }
  1057. currW = mxUtils.getSizeForString(currLabel, fontSize, mxConstants.DEFAULT_FONTFAMILY).width;
  1058. if (currW === 0)
  1059. {
  1060. labelWidths[i] = 40;
  1061. }
  1062. else
  1063. {
  1064. labelWidths[i] = currW;
  1065. };
  1066. minW = minW + labelWidths[i];
  1067. }
  1068. w = Math.max(w, minW);
  1069. h = Math.max(h, tabH + rSize);
  1070. c.translate(x, y);
  1071. this.background(c, w, h, rSize, tabH);
  1072. c.setShadow(false);
  1073. this.backTabs(c, w, h, rSize, tabH, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab);
  1074. this.focusTab(c, w, h, rSize, tabH, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab);
  1075. this.tabText(c, w, h, rSize, tabH, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab, tabNames);
  1076. };
  1077. mxShapeMockupHorTabBar.prototype.background = function(c, w, h, rSize, tabH)
  1078. {
  1079. c.begin();
  1080. c.moveTo(0, tabH + rSize);
  1081. c.arcTo(rSize, rSize, 0, 0, 1, rSize, tabH);
  1082. c.lineTo(w - rSize, tabH);
  1083. c.arcTo(rSize, rSize, 0, 0, 1, w, tabH + rSize);
  1084. c.lineTo(w, h);
  1085. c.lineTo(0, h);
  1086. c.close();
  1087. c.fillAndStroke();
  1088. };
  1089. mxShapeMockupHorTabBar.prototype.backTabs = function(c, w, h, rSize, tabH, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab)
  1090. {
  1091. var tabStyle = mxUtils.getValue(this.style, mxShapeMockupHorTabBar.prototype.cst.TAB_STYLE, mxShapeMockupHorTabBar.prototype.cst.BLOCK);
  1092. var currW = startOffset;
  1093. for (var i=0; i < tabCount; i++)
  1094. {
  1095. var tabW = labelWidths[i] + 2 * labelOffset;
  1096. if (selectedTab !== i)
  1097. {
  1098. if (tabStyle === mxShapeMockupHorTabBar.prototype.cst.BLOCK)
  1099. {
  1100. c.rect(currW, 0, tabW, tabH);
  1101. }
  1102. else if (tabStyle === mxShapeMockupHorTabBar.prototype.cst.CONE)
  1103. {
  1104. c.begin();
  1105. c.moveTo(currW, tabH);
  1106. c.lineTo(currW + labelOffset * 0.5, 0);
  1107. c.lineTo(currW + tabW - labelOffset * 0.5, 0);
  1108. c.lineTo(currW + tabW, tabH);
  1109. }
  1110. else if (tabStyle === mxShapeMockupHorTabBar.prototype.cst.HALF_CONE)
  1111. {
  1112. c.begin();
  1113. c.moveTo(currW, tabH);
  1114. c.lineTo(currW + labelOffset * 0.5, 0);
  1115. c.lineTo(currW + tabW, 0);
  1116. c.lineTo(currW + tabW, tabH);
  1117. }
  1118. else if (tabStyle === mxShapeMockupHorTabBar.prototype.cst.ROUND)
  1119. {
  1120. c.begin();
  1121. c.moveTo(currW - rSize, tabH);
  1122. c.arcTo(rSize, rSize, 0, 0, 0, currW, tabH - rSize);
  1123. c.lineTo(currW, rSize);
  1124. c.arcTo(rSize, rSize, 0, 0, 1, currW + rSize, 0);
  1125. c.lineTo(currW + tabW - rSize, 0);
  1126. c.arcTo(rSize, rSize, 0, 0, 1, currW + tabW, rSize);
  1127. c.lineTo(currW + tabW, tabH - rSize);
  1128. c.arcTo(rSize, rSize, 0, 0, 0, currW + tabW + rSize, tabH);
  1129. }
  1130. c.fillAndStroke();
  1131. }
  1132. currW = currW + tabW + tabOffset;
  1133. }
  1134. };
  1135. mxShapeMockupHorTabBar.prototype.focusTab = function(c, w, h, rSize, tabH, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab)
  1136. {
  1137. var tabStyle = mxUtils.getValue(this.style, mxShapeMockupHorTabBar.prototype.cst.TAB_STYLE, mxShapeMockupHorTabBar.prototype.cst.BLOCK);
  1138. var selectedFill = mxUtils.getValue(this.style, mxShapeMockupHorTabBar.prototype.cst.STYLE_FILLCOLOR2, '#008cff');
  1139. var currW = startOffset;
  1140. c.setStrokeColor(selectedFill);
  1141. c.setFillColor(selectedFill);
  1142. for (var i=0; i <= selectedTab; i++)
  1143. {
  1144. var tabW = labelWidths[i] + 2 * labelOffset;
  1145. if (selectedTab === i)
  1146. {
  1147. if (tabStyle === mxShapeMockupHorTabBar.prototype.cst.BLOCK)
  1148. {
  1149. c.begin();
  1150. c.moveTo(0, tabH + rSize);
  1151. c.arcTo(rSize, rSize, 0, 0, 1, rSize, tabH);
  1152. c.lineTo(currW, tabH);
  1153. c.lineTo(currW, 0);
  1154. c.lineTo(currW + tabW, 0);
  1155. c.lineTo(currW + tabW, tabH);
  1156. c.lineTo(w - rSize, tabH);
  1157. c.arcTo(rSize, rSize, 0, 0, 1, w, tabH + rSize);
  1158. c.close();
  1159. }
  1160. else if (tabStyle === mxShapeMockupHorTabBar.prototype.cst.CONE)
  1161. {
  1162. c.begin();
  1163. c.moveTo(0, tabH + rSize);
  1164. c.arcTo(rSize, rSize, 0, 0, 1, rSize, tabH);
  1165. c.lineTo(currW, tabH);
  1166. c.lineTo(currW + labelOffset * 0.5, 0);
  1167. c.lineTo(currW + tabW - labelOffset * 0.5, 0);
  1168. c.lineTo(currW + tabW, tabH);
  1169. c.lineTo(w - rSize, tabH);
  1170. c.arcTo(rSize, rSize, 0, 0, 1, w, tabH + rSize);
  1171. c.close();
  1172. }
  1173. else if (tabStyle === mxShapeMockupHorTabBar.prototype.cst.HALF_CONE)
  1174. {
  1175. c.begin();
  1176. c.moveTo(0, tabH + rSize);
  1177. c.arcTo(rSize, rSize, 0, 0, 1, rSize, tabH);
  1178. c.lineTo(currW, tabH);
  1179. c.lineTo(currW + labelOffset * 0.5, 0);
  1180. c.lineTo(currW + tabW, 0);
  1181. c.lineTo(currW + tabW, tabH);
  1182. c.lineTo(w - rSize, tabH);
  1183. c.arcTo(rSize, rSize, 0, 0, 1, w, tabH + rSize);
  1184. c.close();
  1185. }
  1186. else if (tabStyle === mxShapeMockupHorTabBar.prototype.cst.ROUND)
  1187. {
  1188. c.begin();
  1189. c.moveTo(0, tabH + rSize);
  1190. c.arcTo(rSize, rSize, 0, 0, 1, rSize, tabH);
  1191. c.lineTo(currW - rSize, tabH);
  1192. c.arcTo(rSize, rSize, 0, 0, 0, currW, tabH - rSize);
  1193. c.lineTo(currW, rSize);
  1194. c.arcTo(rSize, rSize, 0, 0, 1, currW + rSize, 0);
  1195. c.lineTo(currW + tabW - rSize, 0);
  1196. c.arcTo(rSize, rSize, 0, 0, 1, currW + tabW, rSize);
  1197. c.lineTo(currW + tabW, tabH - rSize);
  1198. c.arcTo(rSize, rSize, 0, 0, 0, currW + tabW + rSize, tabH);
  1199. c.lineTo(w - rSize, tabH);
  1200. c.arcTo(rSize, rSize, 0, 0, 1, w, tabH + rSize);
  1201. c.close();
  1202. }
  1203. c.fillAndStroke();
  1204. }
  1205. currW = currW + tabW + tabOffset;
  1206. }
  1207. };
  1208. mxShapeMockupHorTabBar.prototype.tabText = function(c, w, h, rSize, tabH, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab, tabNames)
  1209. {
  1210. var fontColor = mxUtils.getValue(this.style, mxShapeMockupHorTabBar.prototype.cst.TEXT_COLOR, '#666666');
  1211. var selFontColor = mxUtils.getValue(this.style, mxShapeMockupHorTabBar.prototype.cst.SEL_TEXT_COLOR, '#ffffff');
  1212. var fontSize = mxUtils.getValue(this.style, mxShapeMockupHorTabBar.prototype.cst.TEXT_SIZE, '17').toString();
  1213. c.setFontColor(fontColor);
  1214. c.setFontSize(fontSize);
  1215. var currW = startOffset;
  1216. for (var i=0; i < tabCount; i++)
  1217. {
  1218. var currLabel = tabNames[i];
  1219. if (i === selectedTab)
  1220. {
  1221. c.setFontColor(selFontColor);
  1222. }
  1223. if (currLabel.charAt(0) === '+')
  1224. {
  1225. currLabel = currLabel.substring(1);
  1226. }
  1227. var tabW = labelWidths[i] + 2 * labelOffset;
  1228. c.text(currW + labelOffset, tabH * 0.5, 0, 0, currLabel, mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1229. currW = currW + tabW + tabOffset;
  1230. if (i === selectedTab)
  1231. {
  1232. c.setFontColor(fontColor);
  1233. }
  1234. }
  1235. };
  1236. mxCellRenderer.prototype.defaultShapes[mxShapeMockupHorTabBar.prototype.cst.SHAPE_HOR_TAB_BAR] = mxShapeMockupHorTabBar;
  1237. //**********************************************************************************************************************************************************
  1238. //Vertical Tab Bar (LEGACY)
  1239. //**********************************************************************************************************************************************************
  1240. /**
  1241. * Extends mxShape.
  1242. */
  1243. //TODO tab widths are fixed, so tab text length is a bit of an issue. Cannot be fixed while we use labels for tab names
  1244. function mxShapeMockupVerTabBar(bounds, fill, stroke, strokewidth)
  1245. {
  1246. mxShape.call(this);
  1247. this.bounds = bounds;
  1248. this.fill = fill;
  1249. this.stroke = stroke;
  1250. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1251. };
  1252. /**
  1253. * Extends mxShape.
  1254. */
  1255. mxUtils.extend(mxShapeMockupVerTabBar, mxShape);
  1256. mxShapeMockupVerTabBar.prototype.cst = {
  1257. BLOCK : 'block',
  1258. ROUND : 'round',
  1259. TEXT_SIZE : 'textSize',
  1260. TAB_NAMES : 'tabs',
  1261. TAB_STYLE : 'tabStyle',
  1262. STYLE_FILLCOLOR2 : 'fillColor2',
  1263. TEXT_COLOR : 'textColor',
  1264. SEL_TEXT_COLOR : 'textColor2',
  1265. SHAPE_VER_TAB_BAR : 'mxgraph.mockup.containers.verTabBar'
  1266. };
  1267. /**
  1268. * Function: paintVertexShape
  1269. *
  1270. * Paints the vertex shape.
  1271. */
  1272. mxShapeMockupVerTabBar.prototype.paintVertexShape = function(c, x, y, w, h)
  1273. {
  1274. var fontSize = mxUtils.getValue(this.style, mxShapeMockupVerTabBar.prototype.cst.TEXT_SIZE, '17').toString();
  1275. var tabNames = mxUtils.getValue(this.style, mxShapeMockupVerTabBar.prototype.cst.TAB_NAMES, 'Tab 1,+Tab 2,Tab 3').toString().split(',');
  1276. var tabH = fontSize * 1.5;
  1277. var startOffset = 10;
  1278. var tabOffset = 5;
  1279. var labelOffset = 10;
  1280. var tabCount = tabNames.length;
  1281. var rSize = 5;
  1282. var labelWidths = new Array();
  1283. var selectedTab = -1;
  1284. for (var i = 0; i < tabCount; i++)
  1285. {
  1286. var currLabel = tabNames[i];
  1287. if(currLabel.charAt(0) === '+')
  1288. {
  1289. currLabel = currLabel.substring(1);
  1290. selectedTab = i;
  1291. }
  1292. var currW = mxUtils.getSizeForString(currLabel, fontSize, mxConstants.DEFAULT_FONTFAMILY).width;
  1293. if (currW === 0)
  1294. {
  1295. labelWidths[i] = 42;
  1296. }
  1297. else
  1298. {
  1299. labelWidths[i] = currW;
  1300. }
  1301. }
  1302. var tabW = 2 * labelOffset + Math.max.apply(Math, labelWidths);
  1303. var minW = tabW + rSize;
  1304. w = Math.max(w, minW);
  1305. h = Math.max(h, 2 * startOffset + tabCount * tabH + (tabCount - 1) * tabOffset);
  1306. c.translate(x, y);
  1307. this.background(c, w, h, rSize, tabW);
  1308. c.setShadow(false);
  1309. this.backTabs(c, w, h, rSize, tabH, tabW, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab);
  1310. this.focusTab(c, w, h, rSize, tabH, tabW, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab);
  1311. this.tabText(c, w, h, rSize, tabH, tabW, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab, tabNames);
  1312. };
  1313. mxShapeMockupVerTabBar.prototype.background = function(c, w, h, rSize, tabW)
  1314. {
  1315. c.begin();
  1316. c.moveTo(tabW + rSize, h);
  1317. c.arcTo(rSize, rSize, 0, 0, 1, tabW, h - rSize);
  1318. c.lineTo(tabW, rSize);
  1319. c.arcTo(rSize, rSize, 0, 0, 1, tabW + rSize, 0);
  1320. c.lineTo(w, 0);
  1321. c.lineTo(w, h);
  1322. c.close();
  1323. c.fillAndStroke();
  1324. };
  1325. mxShapeMockupVerTabBar.prototype.backTabs = function(c, w, h, rSize, tabH, tabW, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab)
  1326. {
  1327. var tabStyle = mxUtils.getValue(this.style, mxShapeMockupVerTabBar.prototype.cst.TAB_STYLE, mxShapeMockupVerTabBar.prototype.cst.BLOCK);
  1328. var currH = startOffset;
  1329. for (var i=0; i < tabCount; i++)
  1330. {
  1331. if (selectedTab !== i)
  1332. {
  1333. if (tabStyle === mxShapeMockupVerTabBar.prototype.cst.BLOCK)
  1334. {
  1335. c.rect(0, currH, tabW, tabH);
  1336. }
  1337. else if (tabStyle === mxShapeMockupVerTabBar.prototype.cst.ROUND)
  1338. {
  1339. c.begin();
  1340. c.moveTo(tabW, currH + tabH + rSize);
  1341. c.arcTo(rSize, rSize, 0, 0, 0, tabW - rSize, currH + tabH);
  1342. c.lineTo(rSize, currH + tabH);
  1343. c.arcTo(rSize, rSize, 0, 0, 1, 0, currH + tabH - rSize);
  1344. c.lineTo(0, currH + rSize);
  1345. c.arcTo(rSize, rSize, 0, 0, 1, rSize, currH);
  1346. c.lineTo(tabW - rSize, currH);
  1347. c.arcTo(rSize, rSize, 0, 0, 0, tabW, currH - rSize);
  1348. }
  1349. c.fillAndStroke();
  1350. }
  1351. currH = currH + tabH + tabOffset;
  1352. }
  1353. };
  1354. mxShapeMockupVerTabBar.prototype.focusTab = function(c, w, h, rSize, tabH, tabW, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab)
  1355. {
  1356. var tabStyle = mxUtils.getValue(this.style, mxShapeMockupVerTabBar.prototype.cst.TAB_STYLE, mxShapeMockupVerTabBar.prototype.cst.BLOCK);
  1357. var selectedFill = mxUtils.getValue(this.style, mxShapeMockupVerTabBar.prototype.cst.STYLE_FILLCOLOR2, '#008cff');
  1358. if (selectedTab !== -1)
  1359. {
  1360. var currH = startOffset + (tabH + tabOffset) * selectedTab;
  1361. c.setStrokeColor(selectedFill);
  1362. c.setFillColor(selectedFill);
  1363. if (tabStyle === mxShapeMockupVerTabBar.prototype.cst.BLOCK)
  1364. {
  1365. c.begin();
  1366. c.moveTo(tabW + rSize, h);
  1367. c.arcTo(rSize, rSize, 0, 0, 1, tabW, h - rSize);
  1368. c.lineTo(tabW, currH + tabH);
  1369. c.lineTo(0, currH + tabH);
  1370. c.lineTo(0, currH);
  1371. c.lineTo(tabW, currH);
  1372. c.lineTo(tabW, rSize);
  1373. c.arcTo(rSize, rSize, 0, 0, 1, tabW + rSize, 0);
  1374. c.close();
  1375. }
  1376. else if (tabStyle === mxShapeMockupVerTabBar.prototype.cst.ROUND)
  1377. {
  1378. c.begin();
  1379. c.moveTo(tabW + rSize, h);
  1380. c.arcTo(rSize, rSize, 0, 0, 1, tabW, h - rSize);
  1381. c.lineTo(tabW, currH + tabH + rSize);
  1382. c.arcTo(rSize, rSize, 0, 0, 0, tabW - rSize, currH + tabH);
  1383. c.lineTo(rSize, currH + tabH);
  1384. c.arcTo(rSize, rSize, 0, 0, 1, 0, currH + tabH - rSize);
  1385. c.lineTo(0, currH + rSize);
  1386. c.arcTo(rSize, rSize, 0, 0, 1, rSize, currH);
  1387. c.lineTo(tabW - rSize, currH);
  1388. c.arcTo(rSize, rSize, 0, 0, 0, tabW, currH - rSize);
  1389. c.lineTo(tabW, rSize);
  1390. c.arcTo(rSize, rSize, 0, 0, 1, tabW + rSize, 0);
  1391. c.close();
  1392. }
  1393. c.fillAndStroke();
  1394. }
  1395. };
  1396. mxShapeMockupVerTabBar.prototype.tabText = function(c, w, h, rSize, tabH, tabW, startOffset, tabOffset, labelOffset, tabCount, labelWidths, selectedTab, tabNames)
  1397. {
  1398. var fontColor = mxUtils.getValue(this.style, mxShapeMockupVerTabBar.prototype.cst.TEXT_COLOR, '#666666');
  1399. var selFontColor = mxUtils.getValue(this.style, mxShapeMockupVerTabBar.prototype.cst.SEL_TEXT_COLOR, '#ffffff');
  1400. var fontSize = mxUtils.getValue(this.style, mxShapeMockupVerTabBar.prototype.cst.TEXT_SIZE, '17').toString();
  1401. c.setFontColor(fontColor);
  1402. c.setFontSize(fontSize);
  1403. var currH = startOffset;
  1404. for (var i=0; i < tabCount; i++)
  1405. {
  1406. var currLabel = tabNames[i];
  1407. if (i === selectedTab)
  1408. {
  1409. c.setFontColor(selFontColor);
  1410. }
  1411. if (currLabel.charAt(0) === '+')
  1412. {
  1413. currLabel = currLabel.substring(1);
  1414. }
  1415. c.text(tabW * 0.5, currH + tabH * 0.5, 0, 0, currLabel, mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1416. currH = currH + tabH + tabOffset;
  1417. if (i === selectedTab)
  1418. {
  1419. c.setFontColor(fontColor);
  1420. }
  1421. }
  1422. };
  1423. mxCellRenderer.prototype.defaultShapes[mxShapeMockupVerTabBar.prototype.cst.SHAPE_VER_TAB_BAR] = mxShapeMockupVerTabBar;
  1424. //**********************************************************************************************************************************************************
  1425. //Alert Box (LEGACY)
  1426. //**********************************************************************************************************************************************************
  1427. /**
  1428. * Extends mxShape.
  1429. */
  1430. function mxShapeMockupAlertBox(bounds, fill, stroke, strokewidth)
  1431. {
  1432. mxShape.call(this);
  1433. this.bounds = bounds;
  1434. this.fill = fill;
  1435. this.stroke = stroke;
  1436. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1437. };
  1438. /**
  1439. * Extends mxShape.
  1440. */
  1441. mxUtils.extend(mxShapeMockupAlertBox, mxShape);
  1442. mxShapeMockupAlertBox.prototype.cst = {
  1443. MAIN_TEXT : 'mainText',
  1444. SUB_TEXT : 'subText',
  1445. BUTTON_TEXT : 'buttonText',
  1446. TEXT_SIZE : 'textSize',
  1447. TEXT_COLOR : 'textColor',
  1448. STROKE_COLOR2 : 'strokeColor2',
  1449. STROKE_COLOR3 : 'strokeColor3',
  1450. SHAPE_ALERT_BOX : 'mxgraph.mockup.containers.alertBox'
  1451. };
  1452. /**
  1453. * Function: paintVertexShape
  1454. *
  1455. * Paints the vertex shape.
  1456. */
  1457. mxShapeMockupAlertBox.prototype.paintVertexShape = function(c, x, y, w, h)
  1458. {
  1459. var bgColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  1460. var frameColor = mxUtils.getValue(this.style, mxConstants.STYLE_STROKECOLOR, '#666666');
  1461. var closeColor = mxUtils.getValue(this.style, mxShapeMockupAlertBox.prototype.cst.STROKE_COLOR2, '#008cff');
  1462. var insideColor = mxUtils.getValue(this.style, mxShapeMockupAlertBox.prototype.cst.STROKE_COLOR3, '#c4c4c4');
  1463. c.translate(x, y);
  1464. h = Math.max(h, 75);
  1465. w = Math.max(w, 90);
  1466. this.background(c, x, y, w, h, bgColor, frameColor);
  1467. c.setShadow(false);
  1468. this.foreground(c, x, y, w, h, frameColor, insideColor, closeColor);
  1469. };
  1470. mxShapeMockupAlertBox.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  1471. {
  1472. c.setFillColor(bgColor);
  1473. c.setStrokeColor(frameColor);
  1474. c.rect(0, 0, w, h);
  1475. c.fillAndStroke();
  1476. };
  1477. mxShapeMockupAlertBox.prototype.foreground = function(c, x, y, w, h, frameColor, insideColor, closeColor)
  1478. {
  1479. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  1480. c.setStrokeColor(closeColor);
  1481. c.ellipse(w - 25, 5, 20, 20);
  1482. c.stroke();
  1483. c.setStrokeColor(insideColor);
  1484. c.begin();
  1485. c.moveTo(0, 30);
  1486. c.lineTo(w, 30);
  1487. c.stroke();
  1488. //buttons
  1489. var windowTitle = mxUtils.getValue(this.style, mxShapeMockupAlertBox.prototype.cst.MAIN_TEXT, 'Window Title').toString();
  1490. var subText = mxUtils.getValue(this.style, mxShapeMockupAlertBox.prototype.cst.SUB_TEXT, 'Sub Text').toString().split(',');
  1491. var buttonText = mxUtils.getValue(this.style, mxShapeMockupAlertBox.prototype.cst.BUTTON_TEXT, 'OK,Cancel').toString().split(',');
  1492. var fontColor = mxUtils.getValue(this.style, mxShapeMockupAlertBox.prototype.cst.TEXT_COLOR, '#666666');
  1493. var fontSize = mxUtils.getValue(this.style, mxShapeMockupAlertBox.prototype.cst.TEXT_SIZE, '17').toString();
  1494. var buttonCount = buttonText.length;
  1495. var buttonOffset = 10;
  1496. var buttonW = (w - buttonOffset * (buttonCount + 1)) / buttonCount;
  1497. c.setFontColor(fontColor);
  1498. c.setFontSize(fontSize);
  1499. c.text(10, 15, 0, 0, windowTitle, mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1500. var currW = buttonOffset;
  1501. for (var i = 0; i < buttonText.length; i++)
  1502. {
  1503. if (buttonText[i] !== '')
  1504. {
  1505. c.rect(currW, h - 10 - fontSize * 1.5, buttonW, fontSize * 1.5);
  1506. c.stroke();
  1507. c.text(currW + buttonW * 0.5, h - 10 - fontSize * 0.75, 0, 0, buttonText[i], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1508. }
  1509. currW = currW + buttonW + buttonOffset;
  1510. }
  1511. for (var i = 0; i < subText.length; i++)
  1512. {
  1513. c.text(w * 0.5, 30 + fontSize * (i * 1.5 + 0.75), 0, 0, subText[i], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  1514. }
  1515. c.stroke();
  1516. };
  1517. mxCellRenderer.prototype.defaultShapes[mxShapeMockupAlertBox.prototype.cst.SHAPE_ALERT_BOX] = mxShapeMockupAlertBox;
  1518. //**********************************************************************************************************************************************************
  1519. //Rounded rectangle (adjustable rounding)
  1520. //**********************************************************************************************************************************************************
  1521. /**
  1522. * Extends mxShape.
  1523. */
  1524. function mxShapeMockupContainersRRect(bounds, fill, stroke, strokewidth)
  1525. {
  1526. mxShape.call(this);
  1527. this.bounds = bounds;
  1528. this.fill = fill;
  1529. this.stroke = stroke;
  1530. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1531. };
  1532. /**
  1533. * Extends mxShape.
  1534. */
  1535. mxUtils.extend(mxShapeMockupContainersRRect, mxShape);
  1536. mxShapeMockupContainersRRect.prototype.cst = {
  1537. RRECT : 'mxgraph.mockup.containers.rrect',
  1538. R_SIZE : 'rSize'
  1539. };
  1540. /**
  1541. * Function: paintVertexShape
  1542. *
  1543. * Paints the vertex shape.
  1544. */
  1545. mxShapeMockupContainersRRect.prototype.paintVertexShape = function(c, x, y, w, h)
  1546. {
  1547. c.translate(x, y);
  1548. var rSize = parseInt(mxUtils.getValue(this.style, mxShapeMockupContainersRRect.prototype.cst.R_SIZE, '10'));
  1549. c.roundrect(0, 0, w, h, rSize);
  1550. c.fillAndStroke();
  1551. };
  1552. mxCellRenderer.registerShape(mxShapeMockupContainersRRect.prototype.cst.RRECT, mxShapeMockupContainersRRect);
  1553. //**********************************************************************************************************************************************************
  1554. //Anchor (a dummy shape without visuals used for anchoring)
  1555. //**********************************************************************************************************************************************************
  1556. /**
  1557. * Extends mxShape.
  1558. */
  1559. function mxShapeMockupContainersAnchor(bounds, fill, stroke, strokewidth)
  1560. {
  1561. mxShape.call(this);
  1562. this.bounds = bounds;
  1563. };
  1564. /**
  1565. * Extends mxShape.
  1566. */
  1567. mxUtils.extend(mxShapeMockupContainersAnchor, mxShape);
  1568. mxShapeMockupContainersAnchor.prototype.cst = {
  1569. ANCHOR : 'mxgraph.mockup.containers.anchor'
  1570. };
  1571. /**
  1572. * Function: paintVertexShape
  1573. *
  1574. * Paints the vertex shape.
  1575. */
  1576. mxShapeMockupContainersAnchor.prototype.paintVertexShape = function(c, x, y, w, h)
  1577. {
  1578. };
  1579. mxCellRenderer.registerShape(mxShapeMockupContainersAnchor.prototype.cst.ANCHOR, mxShapeMockupContainersAnchor);
  1580. //**********************************************************************************************************************************************************
  1581. //Top Button
  1582. //**********************************************************************************************************************************************************
  1583. /**
  1584. * Extends mxShape.
  1585. */
  1586. function mxShapeMockupContrainersTopButton(bounds, fill, stroke, strokewidth)
  1587. {
  1588. mxShape.call(this);
  1589. this.bounds = bounds;
  1590. this.fill = fill;
  1591. this.stroke = stroke;
  1592. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1593. };
  1594. /**
  1595. * Extends mxShape.
  1596. */
  1597. mxUtils.extend(mxShapeMockupContrainersTopButton, mxShape);
  1598. mxShapeMockupContrainersTopButton.prototype.cst = {
  1599. TOP_BUTTON : 'mxgraph.mockup.containers.topButton',
  1600. R_SIZE : 'rSize'
  1601. };
  1602. /**
  1603. * Function: paintVertexShape
  1604. *
  1605. * Paints the vertex shape.
  1606. */
  1607. mxShapeMockupContrainersTopButton.prototype.paintVertexShape = function(c, x, y, w, h)
  1608. {
  1609. c.translate(x, y);
  1610. var rSize = parseInt(mxUtils.getValue(this.style, mxShapeMockupContrainersTopButton.prototype.cst.R_SIZE, '10'));
  1611. c.begin();
  1612. c.moveTo(0, rSize);
  1613. c.arcTo(rSize, rSize, 0, 0, 1, rSize, 0);
  1614. c.lineTo(w - rSize, 0);
  1615. c.arcTo(rSize, rSize, 0, 0, 1, w, rSize);
  1616. c.lineTo(w, h);
  1617. c.lineTo(0, h);
  1618. c.close();
  1619. c.fillAndStroke();
  1620. };
  1621. mxCellRenderer.registerShape(mxShapeMockupContrainersTopButton.prototype.cst.TOP_BUTTON, mxShapeMockupContrainersTopButton);
  1622. //**********************************************************************************************************************************************************
  1623. //Left Button
  1624. //**********************************************************************************************************************************************************
  1625. /**
  1626. * Extends mxShape.
  1627. */
  1628. function mxShapeMockupContainersLeftButton(bounds, fill, stroke, strokewidth)
  1629. {
  1630. mxShape.call(this);
  1631. this.bounds = bounds;
  1632. this.fill = fill;
  1633. this.stroke = stroke;
  1634. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1635. };
  1636. /**
  1637. * Extends mxShape.
  1638. */
  1639. mxUtils.extend(mxShapeMockupContainersLeftButton, mxShape);
  1640. mxShapeMockupContainersLeftButton.prototype.cst = {
  1641. LEFT_BUTTON : 'mxgraph.mockup.containers.leftButton',
  1642. R_SIZE : 'rSize'
  1643. };
  1644. /**
  1645. * Function: paintVertexShape
  1646. *
  1647. * Paints the vertex shape.
  1648. */
  1649. mxShapeMockupContainersLeftButton.prototype.paintVertexShape = function(c, x, y, w, h)
  1650. {
  1651. c.translate(x, y);
  1652. var rSize = parseInt(mxUtils.getValue(this.style, mxShapeMockupContainersLeftButton.prototype.cst.R_SIZE, '10'));
  1653. c.begin();
  1654. c.moveTo(w, 0);
  1655. c.lineTo(w, h);
  1656. c.lineTo(rSize, h);
  1657. c.arcTo(rSize, rSize, 0, 0, 1, 0, h - rSize);
  1658. c.lineTo(0, rSize);
  1659. c.arcTo(rSize, rSize, 0, 0, 1, rSize, 0);
  1660. c.close();
  1661. c.fillAndStroke();
  1662. };
  1663. mxCellRenderer.registerShape(mxShapeMockupContainersLeftButton.prototype.cst.LEFT_BUTTON, mxShapeMockupContainersLeftButton);
  1664. //**********************************************************************************************************************************************************
  1665. //rect with margins
  1666. //**********************************************************************************************************************************************************
  1667. /**
  1668. * Extends mxShape.
  1669. */
  1670. function mxShapeMockupContainersMarginRect(bounds, fill, stroke, strokewidth)
  1671. {
  1672. mxShape.call(this);
  1673. this.bounds = bounds;
  1674. this.fill = fill;
  1675. this.stroke = stroke;
  1676. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1677. };
  1678. /**
  1679. * Extends mxShape.
  1680. */
  1681. mxUtils.extend(mxShapeMockupContainersMarginRect, mxShape);
  1682. mxShapeMockupContainersMarginRect.prototype.cst = {
  1683. SHAPE_MARGIN_RECT : 'mxgraph.mockup.containers.marginRect',
  1684. MARGIN : 'rectMargin',
  1685. MARGIN_TOP : 'rectMarginTop',
  1686. MARGIN_LEFT : 'rectMarginLeft',
  1687. MARGIN_BOTTOM : 'rectMarginBottom',
  1688. MARGIN_RIGHT : 'rectMarginRight'
  1689. };
  1690. /**
  1691. * Function: paintVertexShape
  1692. *
  1693. * Paints the vertex shape.
  1694. */
  1695. mxShapeMockupContainersMarginRect.prototype.paintVertexShape = function(c, x, y, w, h)
  1696. {
  1697. c.translate(x, y);
  1698. this.background(c, x, y, w, h);
  1699. };
  1700. mxShapeMockupContainersMarginRect.prototype.background = function(c, x, y, w, h, state)
  1701. {
  1702. var margin = parseFloat(mxUtils.getValue(this.style, mxShapeMockupContainersMarginRect.prototype.cst.MARGIN, '0'));
  1703. var marginTop = parseFloat(mxUtils.getValue(this.style, mxShapeMockupContainersMarginRect.prototype.cst.MARGIN_TOP, '0'));
  1704. var marginLeft = parseFloat(mxUtils.getValue(this.style, mxShapeMockupContainersMarginRect.prototype.cst.MARGIN_LEFT, '0'));
  1705. var marginBottom = parseFloat(mxUtils.getValue(this.style, mxShapeMockupContainersMarginRect.prototype.cst.MARGIN_BOTTOM, '0'));
  1706. var marginRight = parseFloat(mxUtils.getValue(this.style, mxShapeMockupContainersMarginRect.prototype.cst.MARGIN_RIGHT, '0'));
  1707. var x1 = margin + marginLeft;
  1708. var y1 = margin + marginTop;
  1709. var w1 = w - marginRight - x1 - margin;
  1710. var h1 = h - marginBottom - y1 - margin;
  1711. if (w1 >0 && h1 > 0)
  1712. {
  1713. c.begin();
  1714. c.roundrect(x1, y1, w1, h1, 10, 10);
  1715. c.fillAndStroke();
  1716. }
  1717. };
  1718. mxCellRenderer.prototype.defaultShapes[mxShapeMockupContainersMarginRect.prototype.cst.SHAPE_MARGIN_RECT] = mxShapeMockupContainersMarginRect;
  1719. //**********************************************************************************************************************************************************
  1720. //rect with margins (not rounded)
  1721. //**********************************************************************************************************************************************************
  1722. /**
  1723. * Extends mxShape.
  1724. */
  1725. function mxShapeMockupContainersMarginRect2(bounds, fill, stroke, strokewidth)
  1726. {
  1727. mxShape.call(this);
  1728. this.bounds = bounds;
  1729. this.fill = fill;
  1730. this.stroke = stroke;
  1731. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  1732. };
  1733. /**
  1734. * Extends mxShape.
  1735. */
  1736. mxUtils.extend(mxShapeMockupContainersMarginRect2, mxShape);
  1737. mxShapeMockupContainersMarginRect2.prototype.cst = {
  1738. SHAPE_MARGIN_RECT : 'mxgraph.mockup.containers.marginRect2',
  1739. MARGIN : 'rectMargin',
  1740. MARGIN_TOP : 'rectMarginTop',
  1741. MARGIN_LEFT : 'rectMarginLeft',
  1742. MARGIN_BOTTOM : 'rectMarginBottom',
  1743. MARGIN_RIGHT : 'rectMarginRight'
  1744. };
  1745. /**
  1746. * Function: paintVertexShape
  1747. *
  1748. * Paints the vertex shape.
  1749. */
  1750. mxShapeMockupContainersMarginRect2.prototype.paintVertexShape = function(c, x, y, w, h)
  1751. {
  1752. c.translate(x, y);
  1753. this.background(c, x, y, w, h);
  1754. };
  1755. mxShapeMockupContainersMarginRect2.prototype.background = function(c, x, y, w, h, state)
  1756. {
  1757. var margin = parseFloat(mxUtils.getValue(this.style, mxShapeMockupContainersMarginRect2.prototype.cst.MARGIN, '0'));
  1758. var marginTop = parseFloat(mxUtils.getValue(this.style, mxShapeMockupContainersMarginRect2.prototype.cst.MARGIN_TOP, '0'));
  1759. var marginLeft = parseFloat(mxUtils.getValue(this.style, mxShapeMockupContainersMarginRect2.prototype.cst.MARGIN_LEFT, '0'));
  1760. var marginBottom = parseFloat(mxUtils.getValue(this.style, mxShapeMockupContainersMarginRect2.prototype.cst.MARGIN_BOTTOM, '0'));
  1761. var marginRight = parseFloat(mxUtils.getValue(this.style, mxShapeMockupContainersMarginRect2.prototype.cst.MARGIN_RIGHT, '0'));
  1762. var x1 = margin + marginLeft;
  1763. var y1 = margin + marginTop;
  1764. var w1 = w - marginRight - x1 - margin;
  1765. var h1 = h - marginBottom - y1 - margin;
  1766. if (w1 >0 && h1 > 0)
  1767. {
  1768. c.begin();
  1769. c.rect(x1, y1, w1, h1);
  1770. c.fillAndStroke();
  1771. }
  1772. };
  1773. mxCellRenderer.prototype.defaultShapes[mxShapeMockupContainersMarginRect2.prototype.cst.SHAPE_MARGIN_RECT] = mxShapeMockupContainersMarginRect2;