< prev index next >
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Navigation.java
Print this page
@@ -23,11 +23,10 @@
* questions.
*/
package jdk.javadoc.internal.doclets.formats.html.markup;
import java.util.ArrayList;
-import java.util.Deque;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import javax.lang.model.element.Element;
@@ -37,10 +36,11 @@
import javax.lang.model.element.TypeElement;
import jdk.javadoc.internal.doclets.formats.html.AbstractMemberWriter;
import jdk.javadoc.internal.doclets.formats.html.Contents;
import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration;
+import jdk.javadoc.internal.doclets.formats.html.HtmlOptions;
import jdk.javadoc.internal.doclets.formats.html.MarkerComments;
import jdk.javadoc.internal.doclets.formats.html.SectionName;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder;
import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
@@ -60,10 +60,11 @@
* notice.</b>
*/
public class Navigation {
private final HtmlConfiguration configuration;
+ private final HtmlOptions options;
private final Element element;
private final Contents contents;
private final DocPath path;
private final DocPath pathToRoot;
private final Links links;
@@ -131,10 +132,11 @@
* @param page the kind of page being documented
* @param path the DocPath object
*/
public Navigation(Element element, HtmlConfiguration configuration, PageMode page, DocPath path) {
this.configuration = configuration;
+ this.options = configuration.getOptions();
this.element = element;
this.contents = configuration.contents;
this.documentedPage = page;
this.path = path;
this.pathToRoot = path.parent().invert();
@@ -199,41 +201,41 @@
* @param tree the content tree to which the main navigation will added
*/
private void addMainNavLinks(Content tree) {
switch (documentedPage) {
case OVERVIEW:
- addActivePageLink(tree, contents.overviewLabel, configuration.createoverview);
+ addActivePageLink(tree, contents.overviewLabel, options.createOverview);
addModuleLink(tree);
addPackageLink(tree);
addPageLabel(tree, contents.classLabel, true);
- addPageLabel(tree, contents.useLabel, configuration.classuse);
+ addPageLabel(tree, contents.useLabel, options.classUse);
addTreeLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
break;
case MODULE:
addOverviewLink(tree);
addActivePageLink(tree, contents.moduleLabel, configuration.showModules);
addPackageLink(tree);
addPageLabel(tree, contents.classLabel, true);
- addPageLabel(tree, contents.useLabel, configuration.classuse);
+ addPageLabel(tree, contents.useLabel, options.classUse);
addTreeLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
break;
case PACKAGE:
addOverviewLink(tree);
addModuleOfElementLink(tree);
addActivePageLink(tree, contents.packageLabel, true);
addPageLabel(tree, contents.classLabel, true);
- if (configuration.classuse) {
+ if (options.classUse) {
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_USE,
contents.useLabel, "", ""));
}
- if (configuration.createtree) {
+ if (options.createTree) {
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_TREE,
contents.treeLabel, "", ""));
}
addDeprecatedLink(tree);
addIndexLink(tree);
@@ -242,15 +244,15 @@
case CLASS:
addOverviewLink(tree);
addModuleOfElementLink(tree);
addPackageSummaryLink(tree);
addActivePageLink(tree, contents.classLabel, true);
- if (configuration.classuse) {
+ if (options.classUse) {
addContentToTree(tree, links.createLink(DocPaths.CLASS_USE.resolve(path.basename()),
contents.useLabel));
}
- if (configuration.createtree) {
+ if (options.createTree) {
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_TREE,
contents.treeLabel, "", ""));
}
addDeprecatedLink(tree);
addIndexLink(tree);
@@ -264,11 +266,11 @@
addPageLabel(tree, contents.classLabel, true);
} else {
addPackageOfElementLink(tree);
addContentToTree(tree, navLinkClass);
}
- addActivePageLink(tree, contents.useLabel, configuration.classuse);
+ addActivePageLink(tree, contents.useLabel, options.classUse);
if (element instanceof PackageElement) {
addContentToTree(tree, links.createLink(DocPaths.PACKAGE_TREE, contents.treeLabel));
} else {
addContentToTree(tree, configuration.utils.isEnclosingPackageIncluded((TypeElement) element)
? links.createLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), contents.treeLabel)
@@ -286,12 +288,12 @@
} else {
addModuleOfElementLink(tree);
addPackageSummaryLink(tree);
}
addPageLabel(tree, contents.classLabel, true);
- addPageLabel(tree, contents.useLabel, configuration.classuse);
- addActivePageLink(tree, contents.treeLabel, configuration.createtree);
+ addPageLabel(tree, contents.useLabel, options.classUse);
+ addActivePageLink(tree, contents.treeLabel, options.createTree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
break;
case DEPRECATED:
@@ -299,25 +301,25 @@
case HELP:
addOverviewLink(tree);
addModuleLink(tree);
addPackageLink(tree);
addPageLabel(tree, contents.classLabel, true);
- addPageLabel(tree, contents.useLabel, configuration.classuse);
+ addPageLabel(tree, contents.useLabel, options.classUse);
addTreeLink(tree);
if (documentedPage == PageMode.DEPRECATED) {
- addActivePageLink(tree, contents.deprecatedLabel, !(configuration.nodeprecated
- || configuration.nodeprecatedlist));
+ addActivePageLink(tree, contents.deprecatedLabel, !(options.noDeprecated
+ || options.noDeprecatedList));
} else {
addDeprecatedLink(tree);
}
if (documentedPage == PageMode.INDEX) {
- addActivePageLink(tree, contents.indexLabel, configuration.createindex);
+ addActivePageLink(tree, contents.indexLabel, options.createIndex);
} else {
addIndexLink(tree);
}
if (documentedPage == PageMode.HELP) {
- addActivePageLink(tree, contents.helpLabel, !configuration.nohelp);
+ addActivePageLink(tree, contents.helpLabel, !options.noHelp);
} else {
addHelpLink(tree);
}
break;
case ALLCLASSES:
@@ -327,22 +329,22 @@
case SYSTEMPROPERTIES:
addOverviewLink(tree);
addModuleLink(tree);
addPackageLink(tree);
addPageLabel(tree, contents.classLabel, true);
- addPageLabel(tree, contents.useLabel, configuration.classuse);
+ addPageLabel(tree, contents.useLabel, options.classUse);
addTreeLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
break;
case DOCFILE:
addOverviewLink(tree);
addModuleOfElementLink(tree);
addContentToTree(tree, navLinkPackage);
addPageLabel(tree, contents.classLabel, true);
- addPageLabel(tree, contents.useLabel, configuration.classuse);
+ addPageLabel(tree, contents.useLabel, options.classUse);
addTreeLink(tree);
addDeprecatedLink(tree);
addIndexLink(tree);
addHelpLink(tree);
break;
@@ -781,11 +783,11 @@
tree.add(HtmlTree.LI(label));
}
}
private void addOverviewLink(Content tree) {
- if (configuration.createoverview) {
+ if (options.createOverview) {
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.INDEX),
contents.overviewLabel, "", "")));
}
}
@@ -847,39 +849,39 @@
private void addPackageSummaryLink(Content tree) {
tree.add(HtmlTree.LI(links.createLink(DocPaths.PACKAGE_SUMMARY, contents.packageLabel)));
}
private void addTreeLink(Content tree) {
- if (configuration.createtree) {
+ if (options.createTree) {
List<PackageElement> packages = new ArrayList<>(configuration.getSpecifiedPackageElements());
DocPath docPath = packages.size() == 1 && configuration.getSpecifiedTypeElements().isEmpty()
? pathToRoot.resolve(configuration.docPaths.forPackage(packages.get(0)).resolve(DocPaths.PACKAGE_TREE))
: pathToRoot.resolve(DocPaths.OVERVIEW_TREE);
tree.add(HtmlTree.LI(links.createLink(docPath, contents.treeLabel, "", "")));
}
}
private void addDeprecatedLink(Content tree) {
- if (!(configuration.nodeprecated || configuration.nodeprecatedlist)) {
+ if (!(options.noDeprecated || options.noDeprecatedList)) {
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST),
contents.deprecatedLabel, "", "")));
}
}
private void addIndexLink(Content tree) {
- if (configuration.createindex) {
+ if (options.createIndex) {
tree.add(HtmlTree.LI(links.createLink(pathToRoot.resolve(
- (configuration.splitindex
+ (options.splitIndex
? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1))
: DocPaths.INDEX_ALL)),
contents.indexLabel, "", "")));
}
}
private void addHelpLink(Content tree) {
- if (!configuration.nohelp) {
- String helpfile = configuration.helpfile;
+ if (!options.noHelp) {
+ String helpfile = options.helpFile;
DocPath helpfilenm;
if (helpfile.isEmpty()) {
helpfilenm = DocPaths.HELP_DOC;
} else {
DocFile file = DocFile.createFileForInput(configuration, helpfile);
@@ -906,11 +908,11 @@
*
* @param top true if the top navigation bar is to be printed
* @return the navigation contents
*/
public Content getContent(boolean top) {
- if (configuration.nonavbar) {
+ if (options.noNavbar) {
return new ContentBuilder();
}
Content tree = HtmlTree.NAV();
HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
Content skipNavLinks = contents.getContent("doclet.Skip_navigation_links");
@@ -951,11 +953,11 @@
HtmlTree ulNavDetail = new HtmlTree(HtmlTag.UL);
ulNavDetail.setStyle(HtmlStyle.subNavList);
addDetailLinks(ulNavDetail);
div.add(ulNavDetail);
subDiv.add(div);
- if (top && configuration.createindex) {
+ if (top && options.createIndex) {
addSearch(subDiv);
}
tree.add(subDiv);
if (top) {
tree.add(Position.TOP.endOfNav());
< prev index next >