package jdk.javadoc.internal.doclets.formats.html;
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import javax.lang.model.element.Element;
import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.ElementFilter;
import com.sun.source.doctree.DocTree;
import jdk.javadoc.doclet.DocletEnvironment.ModuleMode;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.ModuleSummaryWriter;
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryWriter {
protected ModuleElement mdle;
private final ModuleMode moduleMode;
private final Map<ModuleElement, Content> requires
= new TreeMap<>(utils.makeModuleComparator());
private final Map<ModuleElement, Content> indirectModules
= new TreeMap<>(utils.makeModuleComparator());
class PackageEntry {
Set<ModuleElement> exportedTo;
Set<ModuleElement> openedTo;
}
private final Map<PackageElement, PackageEntry> packages = new TreeMap<>(utils.makePackageComparator());
private final Map<ModuleElement, SortedSet<PackageElement>> indirectPackages
= new TreeMap<>(utils.makeModuleComparator());
private final Map<ModuleElement, SortedSet<PackageElement>> indirectOpenPackages
= new TreeMap<>(utils.makeModuleComparator());
private final SortedSet<TypeElement> uses
= new TreeSet<>(utils.makeAllClassesComparator());
private final Map<TypeElement, Content> usesTrees
= new TreeMap<>(utils.makeAllClassesComparator());
private final Map<TypeElement, SortedSet<TypeElement>> provides
= new TreeMap<>(utils.makeAllClassesComparator());
private final Map<TypeElement, Content> providesTrees
= new TreeMap<>(utils.makeAllClassesComparator());
protected HtmlTree mainTree = HtmlTree.MAIN();
protected HtmlTree sectionTree = HtmlTree.SECTION();
private final Navigation navBar;
public ModuleWriterImpl(HtmlConfiguration configuration, ModuleElement mdle) {
super(configuration, configuration.docPaths.moduleSummary(mdle));
this.mdle = mdle;
this.moduleMode = configuration.docEnv.getModuleMode();
this.navBar = new Navigation(mdle, configuration, fixedNavDiv, PageMode.MODULE, path);
computeModulesData();
}
@Override
public Content (String heading) {
HtmlTree bodyTree = getBody(true, getWindowTitle(mdle.getQualifiedName().toString()));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: bodyTree;
addTop(htmlTree);
navBar.setDisplaySummaryModuleDescLink(!utils.getFullBody(mdle).isEmpty() && !configuration.nocomment);
navBar.setDisplaySummaryModulesLink(display(requires) || display(indirectModules));
navBar.setDisplaySummaryPackagesLink(display(packages) || display(indirectPackages)
|| display(indirectOpenPackages));
navBar.setDisplaySummaryServicesLink(displayServices(uses, usesTrees) || displayServices(provides.keySet(), providesTrees));
navBar.setUserHeader(getUserHeaderFooter(true));
htmlTree.addContent(navBar.getContent(true));
if (configuration.allowTag(HtmlTag.HEADER)) {
bodyTree.addContent(htmlTree);
}
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.setStyle(HtmlStyle.header);
Content annotationContent = new HtmlTree(HtmlTag.P);
addAnnotationInfo(mdle, annotationContent);
div.addContent(annotationContent);
Content label = mdle.isOpen() && (configuration.docEnv.getModuleMode() == ModuleMode.ALL)
? contents.openModuleLabel : contents.moduleLabel;
Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
HtmlStyle.title, label);
tHeading.addContent(Contents.SPACE);
Content moduleHead = new RawHtml(heading);
tHeading.addContent(moduleHead);
div.addContent(tHeading);
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(div);
} else {
bodyTree.addContent(div);
}
return bodyTree;
}
@Override
public Content () {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.setStyle(HtmlStyle.contentContainer);
return div;
}
@Override
public Content () {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
return li;
}
@Override
public Content getSummaryTree(Content summaryContentTree) {
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, summaryContentTree);
return ul;
}
public void computeModulesData() {
CommentHelper ch = utils.getCommentHelper(mdle);
Map<ModuleElement, String> dependentModules = utils.getDependentModules(mdle);
dependentModules.forEach((module, mod) -> {
if (shouldDocument(module)) {
indirectModules.put(module, new StringContent(mod));
}
});
(ElementFilter.requiresIn(mdle.getDirectives())).forEach((directive) -> {
ModuleElement m = directive.getDependency();
if (shouldDocument(m)) {
if (moduleMode == ModuleMode.ALL || directive.isTransitive()) {
requires.put(m, new StringContent(utils.getModifiers(directive)));
} else {
dependentModules.remove(m);
}
indirectModules.remove(m);
}
});
for (PackageElement pkg : utils.getModulePackageMap().getOrDefault(mdle, Collections.emptySet())) {
if (shouldDocument(pkg) && (mdle.isOpen() || moduleMode == ModuleMode.ALL)) {
PackageEntry e = new PackageEntry();
if (mdle.isOpen()) {
e.openedTo = Collections.emptySet();
}
packages.put(pkg, e);
}
};
for (ModuleElement.ExportsDirective directive : ElementFilter.exportsIn(mdle.getDirectives())) {
PackageElement p = directive.getPackage();
if (shouldDocument(p)) {
List<? extends ModuleElement> targetMdles = directive.getTargetModules();
if (moduleMode == ModuleMode.ALL || targetMdles == null) {
PackageEntry packageEntry = packages.computeIfAbsent(p, pkg -> new PackageEntry());
SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
if (targetMdles != null) {
mdleList.addAll(targetMdles);
}
packageEntry.exportedTo = mdleList;
}
}
}
for (ModuleElement.OpensDirective directive : ElementFilter.opensIn(mdle.getDirectives())) {
PackageElement p = directive.getPackage();
if (shouldDocument(p)) {
List<? extends ModuleElement> targetMdles = directive.getTargetModules();
if (moduleMode == ModuleMode.ALL || targetMdles == null) {
PackageEntry packageEntry = packages.computeIfAbsent(p, pkg -> new PackageEntry());
SortedSet<ModuleElement> mdleList = new TreeSet<>(utils.makeModuleComparator());
if (targetMdles != null) {
mdleList.addAll(targetMdles);
}
packageEntry.openedTo = mdleList;
}
}
}
dependentModules.forEach((module, mod) -> {
SortedSet<PackageElement> exportPkgList = new TreeSet<>(utils.makePackageComparator());
(ElementFilter.exportsIn(module.getDirectives())).forEach((directive) -> {
PackageElement pkg = directive.getPackage();
if (shouldDocument(pkg)) {
if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) {
exportPkgList.add(pkg);
}
}
});
if (!exportPkgList.isEmpty()) {
indirectPackages.put(module, exportPkgList);
}
SortedSet<PackageElement> openPkgList = new TreeSet<>(utils.makePackageComparator());
if (module.isOpen()) {
openPkgList.addAll(utils.getModulePackageMap().getOrDefault(module, Collections.emptySet()));
} else {
(ElementFilter.opensIn(module.getDirectives())).forEach((directive) -> {
PackageElement pkg = directive.getPackage();
if (shouldDocument(pkg)) {
if (moduleMode == ModuleMode.ALL || directive.getTargetModules() == null) {
openPkgList.add(pkg);
}
}
});
}
if (!openPkgList.isEmpty()) {
indirectOpenPackages.put(module, openPkgList);
}
});
(ElementFilter.usesIn(mdle.getDirectives())).forEach((directive) -> {
TypeElement u = directive.getService();
if (shouldDocument(u)) {
uses.add(u);
}
});
(ElementFilter.providesIn(mdle.getDirectives())).forEach((directive) -> {
TypeElement u = directive.getService();
if (shouldDocument(u)) {
List<? extends TypeElement> implList = directive.getImplementations();
SortedSet<TypeElement> implSet = new TreeSet<>(utils.makeAllClassesComparator());
implSet.addAll(implList);
provides.put(u, implSet);
}
});
(utils.getBlockTags(mdle, DocTree.Kind.PROVIDES)).forEach((tree) -> {
TypeElement t = ch.getServiceType(configuration, tree);
if (t != null) {
providesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false));
}
});
(utils.getBlockTags(mdle, DocTree.Kind.USES)).forEach((tree) -> {
TypeElement t = ch.getServiceType(configuration, tree);
if (t != null) {
usesTrees.put(t, commentTagsToContent(tree, mdle, ch.getDescription(configuration, tree), false));
}
});
}
public boolean shouldDocument(Element element) {
return (moduleMode == ModuleMode.ALL || utils.isIncluded(element));
}
public boolean display(Set<? extends Element> section) {
return section != null && !section.isEmpty();
}
public boolean display(Map<? extends Element, ?> section) {
return section != null && !section.isEmpty();
}
private boolean displayServices(Set<TypeElement> typeElements,
Map<TypeElement, Content> tagsMap) {
return typeElements != null &&
typeElements.stream().anyMatch((v) -> displayServiceDirective(v, tagsMap));
}
private boolean displayServiceDirective(TypeElement typeElement,
Map<TypeElement, Content> tagsMap) {
return moduleMode == ModuleMode.ALL || tagsMap.containsKey(typeElement);
}
public void (Content startMarker, SectionName markerAnchor, Content heading,
Content htmltree) {
htmltree.addContent(startMarker);
htmltree.addContent(links.createAnchor(markerAnchor));
htmltree.addContent(HtmlTree.HEADING(HtmlTag.H3, heading));
}
private Table (Content caption, String tableSummary, HtmlStyle tableStyle,
TableHeader tableHeader) {
return new Table(configuration.htmlVersion, tableStyle)
.setSummary(tableSummary)
.setCaption(caption)
.setHeader(tableHeader)
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast);
}
private Table (Content caption, String tableSummary, HtmlStyle tableStyle,
TableHeader tableHeader) {
return new Table(configuration.htmlVersion, tableStyle)
.setSummary(tableSummary)
.setCaption(caption)
.setHeader(tableHeader)
.setRowScopeColumn(1)
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast);
}
@Override
public void addModulesSummary(Content summaryContentTree) {
if (display(requires) || display(indirectModules)) {
TableHeader requiresTableHeader =
new TableHeader(contents.modifierLabel, contents.moduleLabel,
contents.descriptionLabel);
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
addSummaryHeader(HtmlConstants.START_OF_MODULES_SUMMARY, SectionName.MODULES,
contents.navModules, li);
if (display(requires)) {
String text = resources.getText("doclet.Requires_Summary");
String tableSummary = resources.getText("doclet.Member_Table_Summary",
text,
resources.getText("doclet.modules"));
Content caption = getTableCaption(new StringContent(text));
Table table = getTable3(caption, tableSummary, HtmlStyle.requiresSummary,
requiresTableHeader);
addModulesList(requires, table);
li.addContent(table.toContent());
}
if (display(indirectModules)) {
String amrText = resources.getText("doclet.Indirect_Requires_Summary");
String amrTableSummary = resources.getText("doclet.Member_Table_Summary",
amrText,
configuration.getText("doclet.modules"));
Content amrCaption = getTableCaption(new StringContent(amrText));
Table amrTable = getTable3(amrCaption, amrTableSummary, HtmlStyle.requiresSummary,
requiresTableHeader);
addModulesList(indirectModules, amrTable);
li.addContent(amrTable.toContent());
}
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
summaryContentTree.addContent(ul);
}
}
private void addModulesList(Map<ModuleElement, Content> mdleMap, Table table) {
for (ModuleElement m : mdleMap.keySet()) {
Content modifiers = mdleMap.get(m);
Content moduleLink = getModuleLink(m, new StringContent(m.getQualifiedName()));
Content moduleSummary = new ContentBuilder();
addSummaryComment(m, moduleSummary);
table.addRow(modifiers, moduleLink, moduleSummary);
}
}
@Override
public void addPackagesSummary(Content summaryContentTree) {
if (display(packages)
|| display(indirectPackages) || display(indirectOpenPackages)) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
addSummaryHeader(HtmlConstants.START_OF_PACKAGES_SUMMARY, SectionName.PACKAGES,
contents.navPackages, li);
if (display(packages)) {
String tableSummary = resources.getText("doclet.Member_Table_Summary",
resources.getText("doclet.Packages_Summary"),
resources.getText("doclet.packages"));
addPackageSummary(tableSummary, li);
}
TableHeader indirectPackagesHeader =
new TableHeader(contents.fromLabel, contents.packagesLabel);
if (display(indirectPackages)) {
String aepText = resources.getText("doclet.Indirect_Exports_Summary");
String aepTableSummary = resources.getText("doclet.Indirect_Packages_Table_Summary",
aepText,
resources.getText("doclet.modules"),
resources.getText("doclet.packages"));
Table aepTable = getTable2(new StringContent(aepText), aepTableSummary,
HtmlStyle.packagesSummary, indirectPackagesHeader);
addIndirectPackages(aepTable, indirectPackages);
li.addContent(aepTable.toContent());
}
if (display(indirectOpenPackages)) {
String aopText = resources.getText("doclet.Indirect_Opens_Summary");
String aopTableSummary = resources.getText("doclet.Indirect_Packages_Table_Summary",
aopText,
resources.getText("doclet.modules"),
resources.getText("doclet.packages"));
Table aopTable = getTable2(new StringContent(aopText), aopTableSummary,
HtmlStyle.packagesSummary, indirectPackagesHeader);
addIndirectPackages(aopTable, indirectOpenPackages);
li.addContent(aopTable.toContent());
}
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
summaryContentTree.addContent(ul);
}
}
public void addPackageSummary(String tableSummary, HtmlTree li) {
Table table = new Table(configuration.htmlVersion, HtmlStyle.packagesSummary)
.setSummary(tableSummary)
.setDefaultTab(resources.getText("doclet.All_Packages"))
.addTab(resources.getText("doclet.Exported_Packages_Summary"), this::isExported)
.addTab(resources.getText("doclet.Opened_Packages_Summary"), this::isOpened)
.addTab(resources.getText("doclet.Concealed_Packages_Summary"), this::isConcealed)
.setTabScript(i -> String.format("show(%d);", i));
int numExports = 0;
int numUnqualifiedExports = 0;
int numOpens = 0;
int numUnqualifiedOpens = 0;
for (PackageEntry e : packages.values()) {
if (e.exportedTo != null) {
numExports++;
if (e.exportedTo.isEmpty()) {
numUnqualifiedExports++;
}
}
if (e.openedTo != null) {
numOpens++;
if (e.openedTo.isEmpty()) {
numUnqualifiedOpens++;
}
}
}
boolean showExportedTo = numExports > 0 && (numOpens > 0 || numUnqualifiedExports < packages.size());
boolean showOpenedTo = numOpens > 0 && (numExports > 0 || numUnqualifiedOpens < packages.size());
List<Content> colHeaders = new ArrayList<>();
List<HtmlStyle> colStyles = new ArrayList<>();
colHeaders.add(contents.packageLabel);
colStyles.add(HtmlStyle.colFirst);
if (showExportedTo) {
colHeaders.add(contents.exportedTo);
colStyles.add(HtmlStyle.colSecond);
}
if (showOpenedTo) {
colHeaders.add(contents.openedTo);
colStyles.add(HtmlStyle.colSecond);
}
colHeaders.add(contents.descriptionLabel);
colStyles.add(HtmlStyle.colLast);
table.setHeader(new TableHeader(colHeaders).styles(colStyles))
.setColumnStyles(colStyles);
for (Map.Entry<PackageElement, PackageEntry> e : packages.entrySet()) {
PackageElement pkg = e.getKey();
PackageEntry entry = e.getValue();
List<Content> row = new ArrayList<>();
Content pkgLinkContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
row.add(pkgLinkContent);
if (showExportedTo) {
row.add(getPackageExportOpensTo(entry.exportedTo));
}
if (showOpenedTo) {
row.add(getPackageExportOpensTo(entry.openedTo));
}
Content summary = new ContentBuilder();
addSummaryComment(pkg, summary);
row.add(summary);
table.addRow(pkg, row);
}
li.addContent(table.toContent());
if (table.needsScript()) {
mainBodyScript.append(table.getScript());
}
}
private boolean isExported(Element e) {
PackageEntry entry = packages.get((PackageElement) e);
return (entry != null) && (entry.exportedTo != null);
}
private boolean isOpened(Element e) {
PackageEntry entry = packages.get((PackageElement) e);
return (entry != null) && (entry.openedTo != null);
}
private boolean isConcealed(Element e) {
PackageEntry entry = packages.get((PackageElement) e);
return (entry != null) && (entry.exportedTo == null) && (entry.openedTo == null);
}
private Content getPackageExportOpensTo(Set<ModuleElement> modules) {
if (modules == null) {
return new StringContent(resources.getText("doclet.None"));
} else if (modules.isEmpty()) {
return new StringContent(resources.getText("doclet.All_Modules"));
} else {
Content list = new ContentBuilder();
for (ModuleElement m : modules) {
if (!list.isEmpty()) {
list.addContent(new StringContent(", "));
}
list.addContent(getModuleLink(m, new StringContent(m.getQualifiedName())));
}
return list;
}
}
public void addIndirectPackages(Table table, Map<ModuleElement, SortedSet<PackageElement>> ip) {
for (Map.Entry<ModuleElement, SortedSet<PackageElement>> entry : ip.entrySet()) {
ModuleElement m = entry.getKey();
SortedSet<PackageElement> pkgList = entry.getValue();
Content moduleLinkContent = getModuleLink(m, new StringContent(m.getQualifiedName()));
Content list = new ContentBuilder();
String sep = "";
for (PackageElement pkg : pkgList) {
list.addContent(sep);
list.addContent(getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))));
sep = " ";
}
table.addRow(moduleLinkContent, list);
}
}
@Override
public void addServicesSummary(Content summaryContentTree) {
boolean haveUses = displayServices(uses, usesTrees);
boolean haveProvides = displayServices(provides.keySet(), providesTrees);
if (haveProvides || haveUses) {
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.setStyle(HtmlStyle.blockList);
addSummaryHeader(HtmlConstants.START_OF_SERVICES_SUMMARY, SectionName.SERVICES,
contents.navServices, li);
TableHeader usesProvidesTableHeader =
new TableHeader(contents.typeLabel, contents.descriptionLabel);
if (haveProvides) {
String label = resources.getText("doclet.Provides_Summary");
String tableSummary = resources.getText("doclet.Member_Table_Summary",
label,
resources.getText("doclet.types"));
Table table = getTable2(new StringContent(label), tableSummary, HtmlStyle.providesSummary,
usesProvidesTableHeader);
addProvidesList(table);
if (!table.isEmpty()) {
li.addContent(table.toContent());
}
}
if (haveUses){
String label = resources.getText("doclet.Uses_Summary");
String tableSummary = resources.getText("doclet.Member_Table_Summary",
label,
resources.getText("doclet.types"));
Table table = getTable2(new StringContent(label), tableSummary, HtmlStyle.usesSummary,
usesProvidesTableHeader);
addUsesList(table);
if (!table.isEmpty()) {
li.addContent(table.toContent());
}
}
HtmlTree ul = HtmlTree.UL(HtmlStyle.blockList, li);
summaryContentTree.addContent(ul);
}
}
public void addUsesList(Table table) {
Content typeLinkContent;
Content description;
for (TypeElement t : uses) {
if (!displayServiceDirective(t, usesTrees)) {
continue;
}
typeLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, t));
Content summary = new ContentBuilder();
if (display(usesTrees)) {
description = usesTrees.get(t);
if (description != null && !description.isEmpty()) {
summary.addContent(HtmlTree.DIV(HtmlStyle.block, description));
} else {
addSummaryComment(t, summary);
}
} else {
summary.addContent(Contents.SPACE);
}
table.addRow(typeLinkContent, summary);
}
}
public void addProvidesList(Table table) {
SortedSet<TypeElement> implSet;
Content description;
for (Map.Entry<TypeElement, SortedSet<TypeElement>> entry : provides.entrySet()) {
TypeElement srv = entry.getKey();
if (!displayServiceDirective(srv, providesTrees)) {
continue;
}
implSet = entry.getValue();
Content srvLinkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, srv));
Content desc = new ContentBuilder();
if (display(providesTrees)) {
description = providesTrees.get(srv);
desc.addContent((description != null && !description.isEmpty())
? HtmlTree.DIV(HtmlStyle.block, description)
: Contents.SPACE);
} else {
desc.addContent(Contents.SPACE);
}
if (moduleMode == ModuleMode.ALL && !implSet.isEmpty()) {
desc.addContent(new HtmlTree(HtmlTag.BR));
desc.addContent("(");
HtmlTree implSpan = HtmlTree.SPAN(HtmlStyle.implementationLabel, contents.implementation);
desc.addContent(implSpan);
desc.addContent(Contents.SPACE);
String sep = "";
for (TypeElement impl : implSet) {
desc.addContent(sep);
desc.addContent(getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.PACKAGE, impl)));
sep = ", ";
}
desc.addContent(")");
}
table.addRow(srvLinkContent, desc);
}
}
public void addDeprecationInfo(Content div) {
List<? extends DocTree> deprs = utils.getBlockTags(mdle, DocTree.Kind.DEPRECATED);
if (utils.isDeprecated(mdle)) {
CommentHelper ch = utils.getCommentHelper(mdle);
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
deprDiv.setStyle(HtmlStyle.deprecationBlock);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(mdle));
deprDiv.addContent(deprPhrase);
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
if (!commentTags.isEmpty()) {
addInlineDeprecatedComment(mdle, deprs.get(0), deprDiv);
}
}
div.addContent(deprDiv);
}
}
@Override
public void addModuleDescription(Content moduleContentTree) {
if (!utils.getFullBody(mdle).isEmpty()) {
Content tree = configuration.allowTag(HtmlTag.SECTION) ? HtmlTree.SECTION() : moduleContentTree;
addDeprecationInfo(tree);
tree.addContent(HtmlConstants.START_OF_MODULE_DESCRIPTION);
tree.addContent(links.createAnchor(SectionName.MODULE_DESCRIPTION));
addInlineComment(mdle, tree);
if (configuration.allowTag(HtmlTag.SECTION)) {
moduleContentTree.addContent(tree);
}
}
}
@Override
public void addModuleTags(Content moduleContentTree) {
Content tree = (configuration.allowTag(HtmlTag.SECTION))
? HtmlTree.SECTION()
: moduleContentTree;
addTagsInfo(mdle, tree);
if (configuration.allowTag(HtmlTag.SECTION)) {
moduleContentTree.addContent(tree);
}
}
@Override
public void addModuleContent(Content contentTree, Content moduleContentTree) {
if (configuration.allowTag(HtmlTag.MAIN)) {
mainTree.addContent(moduleContentTree);
contentTree.addContent(mainTree);
} else {
contentTree.addContent(moduleContentTree);
}
}
@Override
public void (Content contentTree) {
Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
? HtmlTree.FOOTER()
: contentTree;
navBar.setUserFooter(getUserHeaderFooter(false));
htmlTree.addContent(navBar.getContent(false));
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
contentTree.addContent(htmlTree);
}
}
@Override
public void printDocument(Content contentTree) throws DocFileIOException {
printHtmlDocument(configuration.metakeywords.getMetaKeywordsForModule(mdle),
true, contentTree);
}
public void addPackageDeprecationInfo(Content li, PackageElement pkg) {
List<? extends DocTree> deprs;
if (utils.isDeprecated(pkg)) {
deprs = utils.getDeprecatedTrees(pkg);
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
deprDiv.setStyle(HtmlStyle.deprecationBlock);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(pkg));
deprDiv.addContent(deprPhrase);
if (!deprs.isEmpty()) {
CommentHelper ch = utils.getCommentHelper(pkg);
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
if (!commentTags.isEmpty()) {
addInlineDeprecatedComment(pkg, deprs.get(0), deprDiv);
}
}
li.addContent(deprDiv);
}
}
}