Search in sources :

Example 1 with Menu

use of org.apache.maven.doxia.site.decoration.Menu in project maven-plugins by apache.

the class DocumentModelBuilder method getDocumentTOC.

/**
     * Extract a DocumentTOC from a DecorationModel.
     *
     * @param decorationModel a DecorationModel. May be null.
     * @return a DocumentTOC, always non-null.
     */
private static DocumentTOC getDocumentTOC(DecorationModel decorationModel) {
    final DocumentTOC toc = new DocumentTOC();
    if (decorationModel != null && decorationModel.getMenus() != null) {
        for (final Menu menu : decorationModel.getMenus()) {
            for (final MenuItem item : menu.getItems()) {
                final DocumentTOCItem documentTOCItem = new DocumentTOCItem();
                documentTOCItem.setName(item.getName());
                documentTOCItem.setRef(item.getHref());
                toc.addItem(documentTOCItem);
            }
        }
    }
    return toc;
}
Also used : DocumentTOC(org.apache.maven.doxia.document.DocumentTOC) DocumentTOCItem(org.apache.maven.doxia.document.DocumentTOCItem) MenuItem(org.apache.maven.doxia.site.decoration.MenuItem) Menu(org.apache.maven.doxia.site.decoration.Menu)

Example 2 with Menu

use of org.apache.maven.doxia.site.decoration.Menu in project maven-plugins by apache.

the class SiteMap method extract.

private void extract(DecorationModel decoration, Sink sink, Locale locale) {
    sink.head();
    sink.title();
    sink.text(i18n.getString("site-plugin", locale, "site.sitemap.title"));
    sink.title_();
    sink.head_();
    sink.body();
    sink.section1();
    sink.sectionTitle1();
    sink.text(i18n.getString("site-plugin", locale, "site.sitemap.section.title"));
    sink.sectionTitle1_();
    sink.paragraph();
    sink.text(i18n.getString("site-plugin", locale, "site.sitemap.description"));
    sink.paragraph_();
    for (Menu menu : decoration.getMenus()) {
        sink.section3();
        sink.sectionTitle3();
        sink.text(menu.getName());
        sink.sectionTitle3_();
        sink.horizontalRule();
        extractItems(menu.getItems(), sink);
        sink.section3_();
    }
    sink.section1_();
    sink.body_();
}
Also used : Menu(org.apache.maven.doxia.site.decoration.Menu)

Aggregations

Menu (org.apache.maven.doxia.site.decoration.Menu)2 DocumentTOC (org.apache.maven.doxia.document.DocumentTOC)1 DocumentTOCItem (org.apache.maven.doxia.document.DocumentTOCItem)1 MenuItem (org.apache.maven.doxia.site.decoration.MenuItem)1