View Javadoc

1   package net.sf.statcvs.pages;
2   
3   import net.sf.statcvs.charts.ChartImage;
4   import net.sf.statcvs.charts.DirectoryPieChartMaker.DirectorySizesChartMaker;
5   import net.sf.statcvs.charts.LOCChartMaker.AllDirectoriesLOCChartMaker;
6   import net.sf.statcvs.model.Repository;
7   import net.sf.statcvs.output.ReportConfig;
8   import net.sf.statcvs.reports.DirectoriesTableReport;
9   import net.sf.statcvs.reports.TableReport;
10  
11  /**
12   * @author anja
13   * @author Richard Cyganiak (richard@cyganiak.de)
14   * @version $Id: DirectorySizesPageMaker.java,v 1.5 2008/04/02 11:22:14 benoitx Exp $
15   */
16  public class DirectorySizesPageMaker {
17      private final ReportConfig config;
18      private final Repository repository;
19  
20      public DirectorySizesPageMaker(final ReportConfig config) {
21          this.config = config;
22          this.repository = config.getRepository();
23      }
24  
25      public NavigationNode toFile() {
26          final ChartImage allDirLOCChart = new AllDirectoriesLOCChartMaker(this.config, 6).toFile();
27          final ChartImage dirSizesChart = new DirectorySizesChartMaker(this.config).toFile();
28          final TableReport table = new DirectoriesTableReport(this.repository);
29  
30          final Page page = this.config.createPage("dir_sizes", "Directory Sizes", "Directory Sizes");
31          page.addAttribute("Total Directories", this.repository.getDirectories().size());
32          page.add(allDirLOCChart);
33          page.addSection("Directory Statistics");
34          page.add(table);
35          page.add(dirSizesChart);
36          return page;
37      }
38  }