use of org.apache.maven.reporting.MavenReport in project maven-plugins by apache.
the class AbstractSiteRenderingMojo method populateItemRefs.
private void populateItemRefs(List<MenuItem> items, Locale locale, Map<String, MavenReport> reportsByOutputName) {
for (Iterator<MenuItem> i = items.iterator(); i.hasNext(); ) {
MenuItem item = i.next();
if (item.getRef() != null) {
MavenReport report = reportsByOutputName.get(item.getRef());
if (report != null) {
if (item.getName() == null) {
item.setName(report.getName(locale));
}
if (item.getHref() == null || item.getHref().length() == 0) {
item.setHref(report.getOutputName() + ".html");
}
} else {
getLog().warn("Unrecognised reference: '" + item.getRef() + "'");
i.remove();
}
}
populateItemRefs(item.getItems(), locale, reportsByOutputName);
}
}
use of org.apache.maven.reporting.MavenReport in project maven-plugins by apache.
the class CategorySummaryDocumentRenderer method renderDocument.
public void renderDocument(Writer writer, Renderer renderer, SiteRenderingContext siteRenderingContext) throws RendererException, FileNotFoundException {
SiteRendererSink sink = new SiteRendererSink(renderingContext);
if (log != null) {
sink.enableLogging(new MojoLogWrapper(log));
}
sink.head();
sink.title();
sink.text(title);
sink.title_();
sink.head_();
sink.body();
sink.section1();
sink.sectionTitle1();
sink.text(title);
sink.sectionTitle1_();
sink.paragraph();
sink.text(desc1 + " ");
sink.link("http://maven.apache.org");
sink.text("Maven");
sink.link_();
sink.text(" " + desc2);
sink.paragraph_();
sink.section2();
sink.sectionTitle2();
Locale locale = siteRenderingContext.getLocale();
sink.text(i18n.getString("site-plugin", locale, "report.category.sectionTitle"));
sink.sectionTitle2_();
sink.table();
sink.tableRows(new int[] { Sink.JUSTIFY_LEFT, Sink.JUSTIFY_LEFT }, false);
String name = i18n.getString("site-plugin", locale, "report.category.column.document");
String description = i18n.getString("site-plugin", locale, "report.category.column.description");
sink.tableRow();
sink.tableHeaderCell();
sink.text(name);
sink.tableHeaderCell_();
sink.tableHeaderCell();
sink.text(description);
sink.tableHeaderCell_();
sink.tableRow_();
if (categoryReports != null) {
for (MavenReport report : categoryReports) {
sink.tableRow();
sink.tableCell();
sink.link(report.getOutputName() + ".html");
sink.text(report.getName(locale));
sink.link_();
sink.tableCell_();
sink.tableCell();
sink.text(report.getDescription(locale));
sink.tableCell_();
sink.tableRow_();
}
}
sink.tableRows_();
sink.table_();
sink.section2_();
sink.section1_();
sink.body_();
sink.flush();
sink.close();
renderer.generateDocument(writer, sink, siteRenderingContext);
}
Aggregations