Clover coverage report - PMD - 3.7 Coverage timestamp: Wed May 31 2006 09:25:59 EDT FRAMES NO FRAMES |
file stats: | LOC: | 103 |  | Methods: | 3
| NCLOC: | 79 |  | Classes: | 1
Source file | Conditionals | Statements | Methods | TOTAL
VBHTMLRenderer.java | 0% | 0% | 0% | 0% |

1 |  | /**
2 |  | * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3 |  | */
4 |  | package net.sourceforge.pmd.renderers;
5 |  |
6 |  | import net.sourceforge.pmd.PMD;
7 |  | import net.sourceforge.pmd.Report;
8 |  | import net.sourceforge.pmd.IRuleViolation;
9 |  |
10 |  | import java.util.Iterator;
11 |  |
12 |  | /**
13 |  | * @author Vladimir
14 |  | * @version $Revision: 1.12 $ $Date: 2006/04/05 14:02:19 $
15 |  | */
16 |  | public class VBHTMLRenderer extends AbstractRenderer implements Renderer {
17 |  |
18 | 0 | public String render(Report report) {
19 | 0 | if (report.isEmpty()) {
20 | 0 | return "";
21 |  | }
22 |  |
23 | 0 | StringBuffer sb = new StringBuffer(header());
24 | 0 | String filename = null;
25 | 0 | String lineSep = PMD.EOL;
26 |  |
27 | 0 | boolean colorize = false;
28 |  |
29 | 0 | for (Iterator iter = report.iterator(); iter.hasNext();) {
30 | 0 | IRuleViolation rv = (IRuleViolation) iter.next();
31 | 0 | if (!rv.getFilename().equals(filename)) { // New File
32 | 0 | if (filename != null) {
33 | 0 | sb.append("</table></br>");
34 | 0 | colorize = false;
35 |  | }
36 | 0 | filename = rv.getFilename();
37 | 0 | sb.append("<table border=\"0\" width=\"80%\">");
38 | 0 | sb.append("<tr id=TableHeader><td colspan=\"2\"><font class=title>&nbsp;").append(filename).append("</font></tr>");
39 | 0 | sb.append(lineSep);
40 |  | }
41 |  |
42 | 0 | if (colorize) {
43 | 0 | sb.append("<tr id=RowColor1>");
44 |  | } else {
45 | 0 | sb.append("<tr id=RowColor2>");
46 |  | }
47 |  |
48 | 0 | colorize = !colorize;
49 | 0 | sb.append("<td width=\"50\" align=\"right\"><font class=body>" + rv.getBeginLine() + "&nbsp;&nbsp;&nbsp;</font></td>");
50 | 0 | sb.append("<td><font class=body>" + rv.getDescription() + "</font></td>");
51 | 0 | sb.append("</tr>");
52 | 0 | sb.append(lineSep);
53 |  | }
54 | 0 | if (filename != null) {
55 | 0 | sb.append("</table>");
56 |  | }
57 | 0 | sb.append("<br>");
58 |  |
59 |  | // output the problems
60 | 0 | Iterator iter = report.errors();
61 | 0 | if (iter.hasNext()) {
62 | 0 | sb.append("<table border=\"0\" width=\"80%\">");
63 | 0 | sb.append("<tr id=TableHeader><td><font class=title>&nbsp;Problems found</font></td></tr>");
64 | 0 | colorize = false;
65 | 0 | while (iter.hasNext()) {
66 | 0 | if (colorize) {
67 | 0 | sb.append("<tr id=RowColor1>");
68 |  | } else {
69 | 0 | sb.append("<tr id=RowColor2>");
70 |  | }
71 | 0 | colorize = !colorize;
72 | 0 | sb.append("<td><font class=body>").append(iter.next()).append("\"</font></td></tr>");
73 |  | }
74 | 0 | sb.append("</table>");
75 |  | }
76 |  |
77 | 0 | sb.append(footer());
78 |  |
79 | 0 | return sb.toString();
80 |  | }
81 |  |
82 | 0 | private String header() {
83 | 0 | StringBuffer sb = new StringBuffer();
84 | 0 | sb.append("<html><head><title>PMD</title></head>");
85 | 0 | sb.append("<style type=\"text/css\">");
86 | 0 | sb.append("<!--" + PMD.EOL);
87 | 0 | sb.append("body { background-color: white; font-family:verdana, arial, helvetica, geneva; font-size: 16px; font-style: italic; color: black; }" + PMD.EOL);
88 | 0 | sb.append(".title { font-family: verdana, arial, helvetica,geneva; font-size: 12px; font-weight:bold; color: white; }" + PMD.EOL);
89 | 0 | sb.append(".body { font-family: verdana, arial, helvetica, geneva; font-size: 12px; font-weight:plain; color: black; }" + PMD.EOL);
90 | 0 | sb.append("#TableHeader { background-color: #003366; }" + PMD.EOL);
91 | 0 | sb.append("#RowColor1 { background-color: #eeeeee; }" + PMD.EOL);
92 | 0 | sb.append("#RowColor2 { background-color: white; }" + PMD.EOL);
93 | 0 | sb.append("-->");
94 | 0 | sb.append("</style>");
95 | 0 | sb.append("<body><center>");
96 | 0 | return sb.toString();
97 |  | }
98 |  |
99 | 0 | private String footer() {
100 | 0 | return "</center></body></html>";
101 |  | }
102 |  |
103 |  | }