1/**2 * Copyright (c) 2006-2018, JGraph Holdings Ltd3 */4//**********************************************************************************************************************************************************5// Issue6//**********************************************************************************************************************************************************7/**8* Extends mxShape.9*/10function mxAtlassianJiraIssue(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.dx = 0.5;18};1920/**21* Extends mxShape.22*/23mxUtils.extend(mxAtlassianJiraIssue, mxRectangleShape);2425mxAtlassianJiraIssue.prototype.customProperties = [26 {name: 'issueType', dispName: 'Issue Type', type: 'enum', 27 enumList: [{val: 'story', dispName: 'Story'}, 28 {val: 'task', dispName: 'Task'}, 29 {val: 'subTask', dispName: 'Sub-Task'}, 30 {val: 'feature', dispName: 'Feature'}, 31 {val: 'bug', dispName: 'Bug'}, 32 {val: 'techTask', dispName: 'Tech Task'}, 33 {val: 'epic', dispName: 'Epic'}, 34 {val: 'improvement', dispName: 'Improvement'}, 35 {val: 'fault', dispName: 'Fault'}, 36 {val: 'change', dispName: 'Change'}, 37 {val: 'access', dispName: 'Access'}, 38 {val: 'purchase', dispName: 'Purchase'}, 39 {val: 'itHelp', dispName: 'IT Help'}] 40 },41 {name: 'issuePriority', dispName: 'Issue Priority', type: 'enum', 42 enumList: [{val: 'blocker', dispName: 'Blocker'}, 43 {val: 'critical', dispName: 'Critical'}, 44 {val: 'major', dispName: 'Major'}, 45 {val: 'minor', dispName: 'Minor'}, 46 {val: 'trivial', dispName: 'Trivial'}] 47 },48 {name: 'issueStatus', dispName: 'Issue Status', type: 'enum', 49 enumList: [{val: 'todo', dispName: 'TODO'}, 50 {val: 'inProgress', dispName: 'In Progress'}, 51 {val: 'inReview', dispName: 'In Review'}, 52 {val: 'done', dispName: 'Done'}] 53 }54];5556mxAtlassianJiraIssue.prototype.cst = {ISSUE : 'mxgraph.atlassian.issue'};5758/**59* Function: paintVertexShape60* 61* Paints the vertex shape.62*/63mxAtlassianJiraIssue.prototype.paintForeground = function(c, x, y, w, h)64{65 c.translate(x, y);6667 var issueType = mxUtils.getValue(this.style, 'issueType', 'task');68 var issuePriority = mxUtils.getValue(this.style, 'issuePriority', 'minor');69 var issueStatus = mxUtils.getValue(this.style, 'issueStatus', 'todo');7071 c.setStrokeColor('none');72 73 switch (issueType) {74 case 'story':75 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.story');76 77 if (stencil != null)78 {79 c.setFillColor('#61B659');80 stencil.drawShape(c, this, 5, 5, 10, 10);81 }82 83 break;84 case 'task':85 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.task');86 87 if (stencil != null)88 {89 c.setFillColor('#5EA3E4');90 stencil.drawShape(c, this, 5, 5, 10, 10);91 }92 93 break;94 case 'subTask':95 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.subtask');96 97 if (stencil != null)98 {99 c.setFillColor('#5EA3E4');100 stencil.drawShape(c, this, 5, 5, 10, 10);101 }102 103 break;104 case 'feature':105 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.new_feature');106 107 if (stencil != null)108 {109 c.setFillColor('#61B659');110 stencil.drawShape(c, this, 5, 5, 10, 10);111 }112 113 break;114 case 'bug':115 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.bug');116 117 if (stencil != null)118 {119 c.setFillColor('#CE0000');120 stencil.drawShape(c, this, 5, 5, 10, 10);121 }122 123 break;124 case 'techTask':125 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.tech_task');126 127 if (stencil != null)128 {129 c.setFillColor('#999C95');130 stencil.drawShape(c, this, 5, 5, 10, 10);131 }132 133 break;134 case 'epic':135 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.epic');136 137 if (stencil != null)138 {139 c.setFillColor('#9E4ADD');140 stencil.drawShape(c, this, 5, 5, 10, 10);141 }142 143 break;144 case 'improvement':145 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.improvement');146 147 if (stencil != null)148 {149 c.setFillColor('#61B659');150 stencil.drawShape(c, this, 5, 5, 10, 10);151 }152 153 break;154 case 'fault':155 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.fault');156 157 if (stencil != null)158 {159 c.setFillColor('#F8902F');160 stencil.drawShape(c, this, 5, 5, 10, 10);161 }162 163 break;164 case 'change':165 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.change');166 167 if (stencil != null)168 {169 c.setFillColor('#9E4ADD');170 stencil.drawShape(c, this, 5, 5, 10, 10);171 }172 173 break;174 case 'access':175 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.access');176 177 if (stencil != null)178 {179 c.setFillColor('#F8902F');180 stencil.drawShape(c, this, 5, 5, 10, 10);181 }182 183 break;184 case 'purchase':185 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.purchase');186 187 if (stencil != null)188 {189 c.setFillColor('#61B659');190 stencil.drawShape(c, this, 5, 5, 10, 10);191 }192 193 break;194 case 'itHelp':195 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.it_help');196 197 if (stencil != null)198 {199 c.setFillColor('#5EA3E4');200 stencil.drawShape(c, this, 5, 5, 10, 10);201 }202 203 break;204 }205206 switch (issuePriority) {207 case 'blocker':208 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.no');209 210 if (stencil != null)211 {212 c.setFillColor('#CE0000');213 stencil.drawShape(c, this, 85, 5, 10, 10);214 }215 break;216 case 'critical':217 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.critical');218 219 if (stencil != null)220 {221 c.setFillColor('#CE0000');222 stencil.drawShape(c, this, 86, 3, 8, 14);223 }224 break;225 case 'major':226 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.double_up');227 228 if (stencil != null)229 {230 c.setFillColor('#CE0000');231 stencil.drawShape(c, this, 85, 5, 10, 10);232 }233 break;234 case 'minor':235 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.double');236 237 if (stencil != null)238 {239 c.setFillColor('#2A8735');240 stencil.drawShape(c, this, 85, 5, 10, 10);241 }242 break;243 case 'trivial':244 var stencil = mxStencilRegistry.getStencil('mxgraph.atlassian.single');245 246 if (stencil != null)247 {248 c.setFillColor('#9AA1B2');249 stencil.drawShape(c, this, 85, 5, 10, 10);250 }251 break;252 }253254 c.setFillColor('#FFFFFD');255 c.setFontColor('#4E6B89');256 257 switch (issueStatus) {258 case 'todo':259 c.rect(w - 45, 5, 40, 20);260 c.fill();261 262 c.text(w - 25, 15, 0, 0, 'TO DO', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);263 break;264 case 'inProgress':265 c.rect(w - 85, 5, 80, 20);266 c.fill();267 268 c.text(w - 45, 15, 0, 0, 'IN PROGRESS', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);269 break;270 case 'inReview':271 c.rect(w - 75, 5, 70, 20);272 c.fill();273 274 c.text(w - 40, 15, 0, 0, 'IN REVIEW', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);275 break;276 case 'done':277 c.rect(w - 45, 5, 40, 20);278 c.fill();279 280 c.text(w - 25, 15, 0, 0, 'DONE', mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);281 break;282 default:283 var tw = mxUtils.getValue(this.style, 'issueStatusWidth', issueStatus.length * 6.5);284 c.rect(w - tw - 5, 5, tw, 20);285 c.fill();286 c.text(w - 7, 15, 0, 0, issueStatus, mxConstants.ALIGN_RIGHT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);287 }288};289290mxCellRenderer.registerShape(mxAtlassianJiraIssue.prototype.cst.ISSUE, mxAtlassianJiraIssue);