| 1 | |
package net.sf.statcvs.pages; |
| 2 | |
|
| 3 | |
import java.util.Iterator; |
| 4 | |
import java.util.List; |
| 5 | |
|
| 6 | |
import net.sf.statcvs.Messages; |
| 7 | |
import net.sf.statcvs.charts.ChartImage; |
| 8 | |
import net.sf.statcvs.charts.ModuleEvolutionChartMaker; |
| 9 | |
import net.sf.statcvs.charts.ModuleSizePieChartMaker; |
| 10 | |
import net.sf.statcvs.charts.LOCChartMaker.AllModulesLOCChartMaker; |
| 11 | |
import net.sf.statcvs.model.Repository; |
| 12 | |
import net.sf.statcvs.output.ReportConfig; |
| 13 | |
import net.sf.statcvs.reports.ModuleTableReport; |
| 14 | |
import net.sf.statcvs.reports.TableReport; |
| 15 | |
import net.sf.statcvs.util.ModuleUtil; |
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
public class ModulesPageMaker { |
| 23 | |
private final ReportConfig config; |
| 24 | |
private final Repository repository; |
| 25 | |
|
| 26 | 0 | public ModulesPageMaker(final ReportConfig config) { |
| 27 | 0 | this.config = config; |
| 28 | 0 | this.repository = config.getRepository(); |
| 29 | 0 | } |
| 30 | |
|
| 31 | |
public NavigationNode toFile() { |
| 32 | 0 | final ChartImage allDirLOCChart = new AllModulesLOCChartMaker(this.config, 6).toFile(); |
| 33 | 0 | final Page page = this.config.createPage("modules", Messages.getString("MODULES_SIZES_TITLE"), Messages.getString("MODULES_SIZES_SUBTITLE")); |
| 34 | 0 | final List moduleIds = ModuleUtil.getConfigModules(); |
| 35 | 0 | final Iterator mod = moduleIds.iterator(); |
| 36 | 0 | while (mod.hasNext()) { |
| 37 | 0 | final String moduleId = (String) mod.next(); |
| 38 | 0 | final String pattern = ModuleUtil.getConfigModuleRegexp(moduleId); |
| 39 | 0 | final String name = ModuleUtil.getConfigModuleName(moduleId); |
| 40 | 0 | page.addAttribute(name, pattern); |
| 41 | |
} |
| 42 | |
|
| 43 | 0 | page.addSection(Messages.getString("MODULES_CURRENT_SIZES_TITLE")); |
| 44 | 0 | final ChartImage dirSizesChart = new ModuleSizePieChartMaker("modules_sizes", this.config, Messages.getString("PIE_MODSIZE_TITLE"), Messages |
| 45 | |
.getString("PIE_MODSIZE_SUBTITLE"), "modules_sizes.png").toFile(); |
| 46 | 0 | page.add(dirSizesChart); |
| 47 | |
|
| 48 | 0 | final TableReport table = new ModuleTableReport(this.repository); |
| 49 | |
|
| 50 | |
|
| 51 | 0 | page.addSection(Messages.getString("MODULES_LOC_TITLE")); |
| 52 | 0 | page.add(allDirLOCChart); |
| 53 | 0 | page.addSection(Messages.getString("MODULES_EVO_TITLE")); |
| 54 | 0 | final ChartImage modEvoChart = new ModuleEvolutionChartMaker("modules_evolution", this.config, Messages.getString("MODULE_EVO_TITLE"), |
| 55 | |
"modules_evolution.png").toFile(); |
| 56 | 0 | page.add(modEvoChart); |
| 57 | 0 | page.addSection(Messages.getString("MODULES_STATS_TITLE")); |
| 58 | 0 | page.add(table); |
| 59 | |
|
| 60 | 0 | return page; |
| 61 | |
} |
| 62 | |
} |