View Javadoc

1   package net.sourceforge.pmd.renderers;
2   
3   import java.io.IOException;
4   import java.io.Writer;
5   
6   import net.sourceforge.pmd.Report;
7   import net.sourceforge.pmd.dfa.report.ReportHTMLPrintVisitor;
8   import net.sourceforge.pmd.dfa.report.ReportTree;
9   
10  public class YAHTMLRenderer extends AbstractRenderer {
11  
12      private String outputDir;
13  
14      public YAHTMLRenderer() {
15          // TODO output destination
16      }
17  
18      public YAHTMLRenderer(String outputDir) {
19          this.outputDir = outputDir;
20      };
21  
22      public void render(Writer writer, Report report) throws IOException {
23          ReportTree tree = report.getViolationTree();
24          tree.getRootNode().accept(new ReportHTMLPrintVisitor(outputDir==null?"..":outputDir));
25          writer.write("<h3 align=\"center\">The HTML files are located " + 
26                  (outputDir==null?"above the project directory":("in '" + outputDir + '\'')) +
27                  ".</h3>");
28  
29      }
30  
31  }