mxMockupContainers.js 67 KB

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