use of org.apache.maven.doxia.site.decoration.MenuItem 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;
}
use of org.apache.maven.doxia.site.decoration.MenuItem 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.doxia.site.decoration.MenuItem in project maven-plugins by apache.
the class SiteMap method extractItems.
private static void extractItems(List<MenuItem> items, Sink sink) {
if (items == null || items.isEmpty()) {
return;
}
sink.list();
for (MenuItem item : items) {
sink.listItem();
sink.link(relativePath(item.getHref()));
sink.text(item.getName());
sink.link_();
extractItems(item.getItems(), sink);
sink.listItem_();
}
sink.list_();
}
Aggregations