Search in sources :

Example 11 with MavenReport

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);
    }
}
Also used : MavenReport(org.apache.maven.reporting.MavenReport) MenuItem(org.apache.maven.doxia.site.decoration.MenuItem)

Example 12 with MavenReport

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);
}
Also used : Locale(java.util.Locale) MavenReport(org.apache.maven.reporting.MavenReport) MojoLogWrapper(org.apache.maven.doxia.tools.MojoLogWrapper) SiteRendererSink(org.apache.maven.doxia.siterenderer.sink.SiteRendererSink)

Aggregations

MavenReport (org.apache.maven.reporting.MavenReport)12 ArrayList (java.util.ArrayList)7 File (java.io.File)5 MavenReportExecution (org.apache.maven.reporting.exec.MavenReportExecution)4 List (java.util.List)3 DocumentRenderer (org.apache.maven.doxia.siterenderer.DocumentRenderer)3 SiteRenderingContext (org.apache.maven.doxia.siterenderer.SiteRenderingContext)3 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)3 StringWriter (java.io.StringWriter)2 LinkedHashMap (java.util.LinkedHashMap)2 RenderingContext (org.apache.maven.doxia.siterenderer.RenderingContext)2 PluginDescriptor (org.apache.maven.plugin.descriptor.PluginDescriptor)2 MavenReportExecutor (org.apache.maven.reporting.exec.MavenReportExecutor)2 MavenReportExecutorRequest (org.apache.maven.reporting.exec.MavenReportExecutorRequest)2 ComponentLookupException (org.codehaus.plexus.component.repository.exception.ComponentLookupException)2 IOException (java.io.IOException)1 Locale (java.util.Locale)1 ResourceBundle (java.util.ResourceBundle)1 DocumentTOCItem (org.apache.maven.doxia.document.DocumentTOCItem)1 IndexingSink (org.apache.maven.doxia.index.IndexingSink)1