8222395: Refactor the abstract classes of package and module index writer
Reviewed-by: hannesw
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java Tue Apr 16 11:00:48 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,253 +0,0 @@
-/*
- * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.javadoc.internal.doclets.formats.html;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedMap;
-
-import javax.lang.model.element.ModuleElement;
-import javax.lang.model.element.PackageElement;
-
-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.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
-import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
-
-/**
- * Abstract class to generate the module overview files.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Bhavesh Patel
- */
-public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
-
- /**
- * Modules to be documented.
- */
- protected SortedMap<ModuleElement, Set<PackageElement>> modules;
-
- protected Navigation navBar;
-
- /**
- * Constructor. Also initializes the modules variable.
- *
- * @param configuration The current configuration
- * @param filename Name of the module index file to be generated.
- */
- public AbstractModuleIndexWriter(HtmlConfiguration configuration,
- DocPath filename) {
- super(configuration, filename);
- modules = configuration.modulePackages;
- this.navBar = new Navigation(null, configuration, fixedNavDiv, PageMode.OVERVIEW, path);
- }
-
- /**
- * Adds the navigation bar header to the documentation tree.
- *
- * @param header the document tree to which the navigation bar header will be added
- */
- protected abstract void addNavigationBarHeader(Content header);
-
- /**
- * Adds the navigation bar footer to the documentation tree.
- *
- * @param footer the document tree to which the navigation bar footer will be added
- */
- protected abstract void addNavigationBarFooter(Content footer);
-
- /**
- * Adds the overview header to the documentation tree.
- *
- * @param main the document tree to which the overview header will be added
- */
- protected abstract void addOverviewHeader(Content main);
-
- /**
- * Adds the modules list to the documentation tree.
- *
- * @param main the document tree to which the modules list will be added
- */
- protected abstract void addModulesList(Content main);
-
- /**
- * Adds the module packages list to the documentation tree.
- *
- * @param modules the set of modules
- * @param text caption for the table
- * @param tableSummary summary for the table
- * @param main the document tree to which the modules list will be added
- * @param mdle the module being documented
- */
- protected abstract void addModulePackagesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
- String tableSummary, Content main, ModuleElement mdle);
-
- /**
- * Generate and prints the contents in the module index file.
- *
- * @param title the title of the window
- * @param description the content for the description META tag
- * @throws DocFileIOException if there is a problem building the module index file
- */
- protected void buildModuleIndexFile(String title, String description)
- throws DocFileIOException {
- String windowOverview = resources.getText(title);
- Content body = getBody(getWindowTitle(windowOverview));
- Content header = HtmlTree.HEADER();
- addNavigationBarHeader(header);
- Content main = HtmlTree.MAIN();
- addOverviewHeader(main);
- addIndex(header, main);
- addOverview(main);
- Content footer = HtmlTree.FOOTER();
- addNavigationBarFooter(footer);
- body.add(header);
- body.add(main);
- body.add(footer);
- printHtmlDocument(
- configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle),
- description,
- body);
- }
-
- /**
- * Generate and prints the contents in the module packages index file.
- *
- * @param title the title of the window.
- * @param description the content for the description META tag
- * @param mdle the name of the module being documented
- * @throws DocFileIOException if there is an exception building the module packages index file
- */
- protected void buildModulePackagesIndexFile(String title, String description,
- ModuleElement mdle) throws DocFileIOException {
- String windowOverview = resources.getText(title);
- Content body = getBody(getWindowTitle(windowOverview));
- Content header = HtmlTree.HEADER();
- addNavigationBarHeader(header);
- Content main = HtmlTree.MAIN();
- addOverviewHeader(main);
- addModulePackagesIndex(header, main, mdle);
- addOverview(main);
- Content footer = HtmlTree.FOOTER();
- addNavigationBarFooter(footer);
- body.add(header);
- body.add(main);
- body.add(footer);
- printHtmlDocument(
- configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle),
- description,
- body);
- }
-
- /**
- * Default to no overview, override to add overview.
- *
- * @param main the document tree to which the overview will be added
- */
- protected void addOverview(Content main) { }
-
- /**
- * Adds the module index to the documentation tree.
- *
- * @param header the document tree to which the navigational links will be added
- * @param main the document tree to which the modules list will be added
- */
- protected void addIndex(Content header, Content main) {
- addIndexContents(configuration.modules, "doclet.Module_Summary",
- resources.getText("doclet.Member_Table_Summary",
- resources.getText("doclet.Module_Summary"),
- resources.getText("doclet.modules")), header, main);
- }
-
- /**
- * Adds the module packages index to the documentation tree.
- *
- * @param header the document tree to which the navigational links will be added
- * @param main the document tree to which the module packages list will be added
- * @param mdle the module being documented
- */
- protected void addModulePackagesIndex(Content header, Content main, ModuleElement mdle) {
- addModulePackagesIndexContents("doclet.Module_Summary",
- resources.getText("doclet.Member_Table_Summary",
- resources.getText("doclet.Module_Summary"),
- resources.getText("doclet.modules")), header, main, mdle);
- }
-
- /**
- * Adds module index contents. Call appropriate methods from
- * the sub-classes. Adds it to the body HtmlTree
- *
- * @param modules the modules to be documented
- * @param text string which will be used as the heading
- * @param tableSummary summary for the table
- * @param header the document tree to which the navigational links will be added
- * @param main the document tree to which the modules list will be added
- */
- protected void addIndexContents(Collection<ModuleElement> modules, String text,
- String tableSummary, Content header, Content main) {
- addModulesList(main);
- }
-
- /**
- * Adds module packages index contents. Call appropriate methods from
- * the sub-classes. Adds it to the body HtmlTree
- *
- * @param text string which will be used as the heading
- * @param tableSummary summary for the table
- * @param header the document tree to which the navigational links will be added
- * @param main the document tree to which the module packages list will be added
- * @param mdle the module being documented
- */
- protected void addModulePackagesIndexContents(String text,
- String tableSummary, Content header, Content main, ModuleElement mdle) {
- addModulePackagesList(modules, text, tableSummary, main, mdle);
- }
-
- /**
- * Adds the doctitle to the documentation tree, if it is specified on the command line.
- *
- * @param body the document tree to which the title will be added
- */
- protected void addConfigurationTitle(Content body) {
- if (configuration.doctitle.length() > 0) {
- Content title = new RawHtml(configuration.doctitle);
- Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
- HtmlStyle.title, title);
- Content div = HtmlTree.DIV(HtmlStyle.header, heading);
- body.add(div);
- }
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractOverviewIndexWriter.java Tue Apr 16 17:56:53 2019 +0530
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.javadoc.internal.doclets.formats.html;
+
+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.toolkit.Content;
+import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
+import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
+
+/**
+ * Abstract class to generate the overview files.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ *
+ */
+public abstract class AbstractOverviewIndexWriter extends HtmlDocletWriter {
+
+ protected Navigation navBar;
+
+ /**
+ * Constructs the AbstractOverviewIndexWriter.
+ *
+ * @param configuration The current configuration
+ * @param filename Name of the module index file to be generated.
+ */
+ public AbstractOverviewIndexWriter(HtmlConfiguration configuration,
+ DocPath filename) {
+ super(configuration, filename);
+ this.navBar = new Navigation(null, configuration, fixedNavDiv, PageMode.OVERVIEW, path);
+ }
+
+ /**
+ * Adds the top text (from the -top option), the upper
+ * navigation bar, and then the title (from the"-title"
+ * option), at the top of page.
+ *
+ * @param header the documentation tree to which the navigation bar header will be added
+ */
+ protected void addNavigationBarHeader(Content header) {
+ addTop(header);
+ navBar.setUserHeader(getUserHeaderFooter(true));
+ header.add(navBar.getContent(true));
+ }
+
+ /**
+ * Adds the lower navigation bar and the bottom text
+ * (from the -bottom option) at the bottom of page.
+ *
+ * @param footer the documentation tree to which the navigation bar footer will be added
+ */
+ protected void addNavigationBarFooter(Content footer) {
+ navBar.setUserFooter(getUserHeaderFooter(false));
+ footer.add(navBar.getContent(false));
+ addBottom(footer);
+ }
+
+ /**
+ * Adds the overview summary comment for this documentation. Add one line
+ * summary at the top of the page and generate a link to the description,
+ * which is added at the end of this page.
+ *
+ * @param main the documentation tree to which the overview header will be added
+ */
+ protected void addOverviewHeader(Content main) {
+ addConfigurationTitle(main);
+ if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
+ HtmlTree div = new HtmlTree(HtmlTag.DIV);
+ div.setStyle(HtmlStyle.contentContainer);
+ addOverviewComment(div);
+ main.add(div);
+ }
+ }
+
+ /**
+ * Adds the overview comment as provided in the file specified by the
+ * "-overview" option on the command line.
+ *
+ * @param htmltree the documentation tree to which the overview comment will
+ * be added
+ */
+ protected void addOverviewComment(Content htmltree) {
+ if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
+ addInlineComment(configuration.overviewElement, htmltree);
+ }
+ }
+
+ /**
+ * Generate and prints the contents in the index file.
+ *
+ * @param title the title of the window
+ * @param description the content for the description META tag
+ * @throws DocFileIOException if there is a problem building the package index file
+ */
+ protected void buildOverviewIndexFile(String title, String description)
+ throws DocFileIOException {
+ String windowOverview = resources.getText(title);
+ Content body = getBody(getWindowTitle(windowOverview));
+ Content header = HtmlTree.HEADER();
+ addNavigationBarHeader(header);
+ Content main = HtmlTree.MAIN();
+ addOverviewHeader(main);
+ addIndex(main);
+ Content footer = HtmlTree.FOOTER();
+ addNavigationBarFooter(footer);
+ body.add(header);
+ body.add(main);
+ body.add(footer);
+ printHtmlDocument(
+ configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle),
+ description, body);
+ }
+
+ /**
+ * Adds the index to the documentation tree.
+ *
+ * @param main the document tree to which the packages/modules list will be added
+ */
+ protected abstract void addIndex(Content main);
+
+ /**
+ * Adds the doctitle to the documentation tree, if it is specified on the command line.
+ *
+ * @param body the document tree to which the title will be added
+ */
+ protected void addConfigurationTitle(Content body) {
+ if (configuration.doctitle.length() > 0) {
+ Content title = new RawHtml(configuration.doctitle);
+ Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
+ HtmlStyle.title, title);
+ Content div = HtmlTree.DIV(HtmlStyle.header, heading);
+ body.add(div);
+ }
+ }
+}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractPackageIndexWriter.java Tue Apr 16 11:00:48 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.javadoc.internal.doclets.formats.html;
-
-import java.util.*;
-
-import javax.lang.model.element.PackageElement;
-
-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.toolkit.Content;
-import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
-import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
-
-/**
- * Abstract class to generate the overview files. This will be sub-classed to
- * generate overview-summary.html.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- *
- * @author Atul M Dambalkar
- * @author Bhavesh Patel (Modified)
- */
-public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
-
- /**
- * A Set of Packages to be documented.
- */
- protected SortedSet<PackageElement> packages;
-
- protected Navigation navBar;
-
- /**
- * Constructor. Also initializes the packages variable.
- *
- * @param configuration The current configuration
- * @param filename Name of the package index file to be generated.
- */
- public AbstractPackageIndexWriter(HtmlConfiguration configuration,
- DocPath filename) {
- super(configuration, filename);
- packages = configuration.packages;
- this.navBar = new Navigation(null, configuration, fixedNavDiv, PageMode.OVERVIEW, path);
- }
-
- /**
- * Adds the navigation bar header to the documentation tree.
- *
- * @param header the document tree to which the navigation bar header will be added
- */
- protected abstract void addNavigationBarHeader(Content header);
-
- /**
- * Adds the navigation bar footer to the documentation tree.
- *
- * @param body the document tree to which the navigation bar footer will be added
- */
- protected abstract void addNavigationBarFooter(Content body);
-
- /**
- * Adds the overview header to the documentation tree.
- *
- * @param footer the document tree to which the overview header will be added
- */
- protected abstract void addOverviewHeader(Content footer);
-
- /**
- * Adds the packages list to the documentation tree.
- *
- * @param main the document tree to which the packages list will be added
- */
- protected abstract void addPackagesList(Content main);
-
- /**
- * Generate and prints the contents in the package index file.
- *
- * @param title the title of the window
- * @param description the content for the description META tag
- * @throws DocFileIOException if there is a problem building the package index file
- */
- protected void buildPackageIndexFile(String title, String description)
- throws DocFileIOException {
- String windowOverview = resources.getText(title);
- Content body = getBody(getWindowTitle(windowOverview));
- Content header = HtmlTree.HEADER();
- addNavigationBarHeader(header);
- Content main = HtmlTree.MAIN();
- addOverviewHeader(main);
- addIndex(header, main);
- addOverview(main);
- Content footer = HtmlTree.FOOTER();
- addNavigationBarFooter(footer);
- body.add(header);
- body.add(main);
- body.add(footer);
- printHtmlDocument(
- configuration.metakeywords.getOverviewMetaKeywords(title, configuration.doctitle),
- description, body);
- }
-
- /**
- * Default to no overview, override to add overview.
- *
- * @param main the document tree to which the overview will be added
- */
- protected void addOverview(Content main) { }
-
- /**
- * Adds the package index to the documentation tree.
- *
- * @param header the document tree to which the navigation links will be added
- * @param main the document tree to which the packages list will be added
- */
- protected void addIndex(Content header, Content main) {
- addIndexContents(header, main);
- }
-
- /**
- * Adds package index contents. Call appropriate methods from
- * the sub-classes. Adds it to the body HtmlTree
- *
- * @param header the document tree to which navigation links will be added
- * @param main the document tree to which the packages list will be added
- */
- protected void addIndexContents(Content header, Content main) {
- if (!packages.isEmpty()) {
- HtmlTree htmlTree = HtmlTree.NAV();
- htmlTree.setStyle(HtmlStyle.indexNav);
- HtmlTree ul = new HtmlTree(HtmlTag.UL);
- addAllClassesLink(ul);
- if (configuration.showModules && configuration.modules.size() > 1) {
- addAllModulesLink(ul);
- }
- htmlTree.add(ul);
- header.add(htmlTree);
- addPackagesList(main);
- }
- }
-
- /**
- * Adds the doctitle to the documentation tree, if it is specified on the command line.
- *
- * @param body the document tree to which the title will be added
- */
- protected void addConfigurationTitle(Content body) {
- if (configuration.doctitle.length() > 0) {
- Content title = new RawHtml(configuration.doctitle);
- Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING,
- HtmlStyle.title, title);
- Content div = HtmlTree.DIV(HtmlStyle.header, heading);
- body.add(div);
- }
- }
-
- /**
- * Do nothing. This will be overridden.
- *
- * @param div the document tree to which the all classes link will be added
- */
- protected void addAllClassesLink(Content div) {
- }
-
- /**
- * Do nothing. This will be overridden.
- *
- * @param div the document tree to which the all modules link will be added
- */
- protected void addAllModulesLink(Content div) {
- }
-}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java Tue Apr 16 11:00:48 2019 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java Tue Apr 16 17:56:53 2019 +0530
@@ -53,15 +53,22 @@
*
* @author Bhavesh Patel
*/
-public class ModuleIndexWriter extends AbstractModuleIndexWriter {
+public class ModuleIndexWriter extends AbstractOverviewIndexWriter {
+
+ /**
+ * Modules to be documented.
+ */
+ protected SortedSet<ModuleElement> modules;
/**
* Construct the ModuleIndexWriter.
+ *
* @param configuration the configuration object
* @param filename the name of the generated file
*/
public ModuleIndexWriter(HtmlConfiguration configuration, DocPath filename) {
super(configuration, filename);
+ modules = configuration.modules;
}
/**
@@ -73,46 +80,23 @@
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
DocPath filename = DocPaths.INDEX;
ModuleIndexWriter mdlgen = new ModuleIndexWriter(configuration, filename);
- mdlgen.buildModuleIndexFile("doclet.Window_Overview_Summary", "module index");
- }
-
- /**
- * Add the module index.
- *
- * @param header the documentation tree to which the navigational links will be added
- * @param main the documentation tree to which the modules list will be added
- */
- @Override
- protected void addIndex(Content header, Content main) {
- addIndexContents(header, main);
+ mdlgen.buildOverviewIndexFile("doclet.Window_Overview_Summary", "module index");
}
/**
- * Adds module index contents.
+ * Adds the list of modules.
*
- * @param header the document tree to which the navigational links will be added
- * @param main the document tree to which the modules list will be added
- */
- protected void addIndexContents(Content header, Content main) {
- addModulesList(main);
- }
-
- /**
- * Add the list of modules.
- *
- * @param main the content tree to which the module list will be added
+ * @param main the documentation tree to which the modules list will be added
*/
@Override
- protected void addModulesList(Content main) {
+ protected void addIndex(Content main) {
Map<String, SortedSet<ModuleElement>> groupModuleMap
- = configuration.group.groupModules(configuration.modules);
+ = configuration.group.groupModules(modules);
if (!groupModuleMap.keySet().isEmpty()) {
- String tableSummary = resources.getText("doclet.Member_Table_Summary",
- resources.getText("doclet.Module_Summary"), resources.getText("doclet.modules"));
- TableHeader header = new TableHeader(contents.moduleLabel, contents.descriptionLabel);
+ TableHeader tableHeader = new TableHeader(contents.moduleLabel, contents.descriptionLabel);
Table table = new Table(HtmlStyle.overviewSummary)
- .setHeader(header)
+ .setHeader(tableHeader)
.setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast)
.setDefaultTab(resources.getText("doclet.All_Modules"))
.setTabScript(i -> "show(" + i + ");")
@@ -126,7 +110,7 @@
}
}
- for (ModuleElement mdle : configuration.modules) {
+ for (ModuleElement mdle : modules) {
if (!mdle.isUnnamed()) {
if (!(configuration.nodeprecated && utils.isDeprecated(mdle))) {
Content moduleLinkContent = getModuleLink(mdle, new StringContent(mdle.getQualifiedName().toString()));
@@ -145,67 +129,4 @@
}
}
}
-
- /**
- * Adds the overview summary comment for this documentation. Add one line
- * summary at the top of the page and generate a link to the description,
- * which is added at the end of this page.
- *
- * @param main the documentation tree to which the overview header will be added
- */
- @Override
- protected void addOverviewHeader(Content main) {
- addConfigurationTitle(main);
- if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
- HtmlTree div = new HtmlTree(HtmlTag.DIV);
- div.setStyle(HtmlStyle.contentContainer);
- addOverviewComment(div);
- main.add(div);
- }
- }
-
- /**
- * Adds the overview comment as provided in the file specified by the
- * "-overview" option on the command line.
- *
- * @param htmltree the documentation tree to which the overview comment will
- * be added
- */
- protected void addOverviewComment(Content htmltree) {
- if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
- addInlineComment(configuration.overviewElement, htmltree);
- }
- }
-
- /**
- * Adds the top text (from the -top option), the upper
- * navigation bar, and then the title (from the"-title"
- * option), at the top of page.
- *
- * @param header the documentation tree to which the navigation bar header will be added
- */
- @Override
- protected void addNavigationBarHeader(Content header) {
- addTop(header);
- navBar.setUserHeader(getUserHeaderFooter(true));
- header.add(navBar.getContent(true));
- }
-
- /**
- * Adds the lower navigation bar and the bottom text
- * (from the -bottom option) at the bottom of page.
- *
- * @param footer the documentation tree to which the navigation bar footer will be added
- */
- @Override
- protected void addNavigationBarFooter(Content footer) {
- navBar.setUserFooter(getUserHeaderFooter(false));
- footer.add(navBar.getContent(false));
- addBottom(footer);
- }
-
- @Override
- protected void addModulePackagesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
- String tableSummary, Content main, ModuleElement mdle) {
- }
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java Tue Apr 16 11:00:48 2019 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java Tue Apr 16 17:56:53 2019 +0530
@@ -52,7 +52,12 @@
* @author Atul M Dambalkar
* @author Bhavesh Patel (Modified)
*/
-public class PackageIndexWriter extends AbstractPackageIndexWriter {
+public class PackageIndexWriter extends AbstractOverviewIndexWriter {
+
+ /**
+ * A Set of Packages to be documented.
+ */
+ protected SortedSet<PackageElement> packages;
/**
* Construct the PackageIndexWriter. Also constructs the grouping
@@ -65,6 +70,7 @@
*/
public PackageIndexWriter(HtmlConfiguration configuration, DocPath filename) {
super(configuration, filename);
+ packages = configuration.packages;
}
/**
@@ -76,26 +82,16 @@
public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
DocPath filename = DocPaths.INDEX;
PackageIndexWriter packgen = new PackageIndexWriter(configuration, filename);
- packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", "package index");
+ packgen.buildOverviewIndexFile("doclet.Window_Overview_Summary", "package index");
}
/**
- * Depending upon the grouping information and their titles, add
- * separate table indices for each package group.
+ * Adds the packages list to the documentation tree.
*
- * @param header the documentation tree to which the navigational links will be added
* @param main the documentation tree to which the packages list will be added
*/
@Override
- protected void addIndex(Content header, Content main) {
- addIndexContents(header, main);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void addPackagesList(Content main) {
+ protected void addIndex(Content main) {
Map<String, SortedSet<PackageElement>> groupPackageMap
= configuration.group.groupPackages(packages);
@@ -134,62 +130,4 @@
}
}
}
-
- /**
- * Adds the overview summary comment for this documentation. Add one line
- * summary at the top of the page and generate a link to the description,
- * which is added at the end of this page.
- *
- * @param main the documentation tree to which the overview header will be added
- */
- @Override
- protected void addOverviewHeader(Content main) {
- addConfigurationTitle(main);
- if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
- HtmlTree div = new HtmlTree(HtmlTag.DIV);
- div.setStyle(HtmlStyle.contentContainer);
- addOverviewComment(div);
- main.add(div);
- }
- }
-
- /**
- * Adds the overview comment as provided in the file specified by the
- * "-overview" option on the command line.
- *
- * @param htmltree the documentation tree to which the overview comment will
- * be added
- */
- protected void addOverviewComment(Content htmltree) {
- if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
- addInlineComment(configuration.overviewElement, htmltree);
- }
- }
-
- /**
- * Adds the top text (from the -top option), the upper
- * navigation bar, and then the title (from the"-title"
- * option), at the top of page.
- *
- * @param header the documentation tree to which the navigation bar header will be added
- */
- @Override
- protected void addNavigationBarHeader(Content header) {
- addTop(header);
- navBar.setUserHeader(getUserHeaderFooter(true));
- header.add(navBar.getContent(true));
- }
-
- /**
- * Adds the lower navigation bar and the bottom text
- * (from the -bottom option) at the bottom of page.
- *
- * @param footer the documentation tree to which the navigation bar footer will be added
- */
- @Override
- protected void addNavigationBarFooter(Content footer) {
- navBar.setUserFooter(getUserHeaderFooter(false));
- footer.add(navBar.getContent(false));
- addBottom(footer);
- }
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Tue Apr 16 11:00:48 2019 +0000
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets.properties Tue Apr 16 17:56:53 2019 +0530
@@ -98,7 +98,6 @@
doclet.From=From
doclet.Uses_Summary=Uses
doclet.Provides_Summary=Provides
-doclet.Module_Summary=Module Summary
doclet.Interface_Summary=Interface Summary
doclet.Annotation_Types_Summary=Annotation Types Summary
doclet.Enum_Summary=Enum Summary