src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractModuleIndexWriter.java
author pmuthuswamy
Wed, 19 Sep 2018 12:14:53 +0530
changeset 51797 3efead10e303
parent 49551 0d4786e42471
child 52644 43efb4ca6d6c
permissions -rw-r--r--
8210047: some pages contain content outside of landmark region Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 45157
diff changeset
     2
 * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     4
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    10
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    15
 * accompanied this code).
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    16
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    20
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    23
 * questions.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    24
 */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    25
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    27
45157
f5f796453339 8178043: Support grouping modules in unified javadoc
bpatel
parents: 40587
diff changeset
    28
import java.util.Collection;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    29
import java.util.Map;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    30
import java.util.Set;
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40303
diff changeset
    31
import java.util.SortedMap;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    32
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    33
import javax.lang.model.element.ModuleElement;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    34
import javax.lang.model.element.PackageElement;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    35
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
    36
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    37
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    38
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    39
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    40
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 47846
diff changeset
    41
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 47846
diff changeset
    42
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    43
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    44
import jdk.javadoc.internal.doclets.toolkit.Content;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    45
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    46
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    47
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    48
/**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    49
 * Abstract class to generate the module overview files in
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    50
 * Frame and Non-Frame format. This will be sub-classed to
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    51
 * generate module-overview-frame.html as well as module-overview-summary.html.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    52
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    53
 *  <p><b>This is NOT part of any supported API.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    54
 *  If you write code that depends on this, you do so at your own risk.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    55
 *  This code and its internal interfaces are subject to change or
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    56
 *  deletion without notice.</b>
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    57
 *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    58
 * @author Bhavesh Patel
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    59
 */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    60
public abstract class AbstractModuleIndexWriter extends HtmlDocletWriter {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    61
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    62
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    63
     * Modules to be documented.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    64
     */
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40303
diff changeset
    65
    protected SortedMap<ModuleElement, Set<PackageElement>> modules;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    66
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 47846
diff changeset
    67
    protected Navigation navBar;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 47846
diff changeset
    68
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    69
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    70
     * Constructor. Also initializes the modules variable.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    71
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    72
     * @param configuration  The current configuration
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    73
     * @param filename Name of the module index file to be generated.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    74
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 45157
diff changeset
    75
    public AbstractModuleIndexWriter(HtmlConfiguration configuration,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36526
diff changeset
    76
                                      DocPath filename) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    77
        super(configuration, filename);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    78
        modules = configuration.modulePackages;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 47846
diff changeset
    79
        this.navBar = new Navigation(null, configuration, fixedNavDiv, PageMode.OVERVIEW, path);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    80
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    81
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    82
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    83
     * Adds the navigation bar header to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    84
     *
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
    85
     * @param header the document tree to which the navigation bar header will be added
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    86
     */
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
    87
    protected abstract void addNavigationBarHeader(Content header);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    88
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    89
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    90
     * Adds the navigation bar footer to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    91
     *
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
    92
     * @param footer the document tree to which the navigation bar footer will be added
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    93
     */
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
    94
    protected abstract void addNavigationBarFooter(Content footer);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    95
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    96
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    97
     * Adds the overview header to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
    98
     *
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
    99
     * @param main the document tree to which the overview header will be added
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   100
     */
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   101
    protected abstract void addOverviewHeader(Content main);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   102
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   103
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   104
     * Adds the modules list to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   105
     *
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   106
     * @param main the document tree to which the modules list will be added
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   107
     */
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   108
    protected abstract void addModulesList(Content main);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   109
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   110
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   111
     * Adds the module packages list to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   112
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   113
     * @param modules the set of modules
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   114
     * @param text caption for the table
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   115
     * @param tableSummary summary for the table
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   116
     * @param main the document tree to which the modules list will be added
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   117
     * @param mdle the module being documented
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   118
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   119
    protected abstract void addModulePackagesList(Map<ModuleElement, Set<PackageElement>> modules, String text,
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   120
            String tableSummary, Content main, ModuleElement mdle);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   121
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   122
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   123
     * Generate and prints the contents in the module index file. Call appropriate
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   124
     * methods from the sub-class in order to generate Frame or Non
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   125
     * Frame format.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   126
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   127
     * @param title the title of the window.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   128
     * @param includeScript boolean set true if windowtitle script is to be included
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   129
     * @throws DocFileIOException if there is a problem building the module index file
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   130
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   131
    protected void buildModuleIndexFile(String title, boolean includeScript) throws DocFileIOException {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   132
        String windowOverview = configuration.getText(title);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   133
        Content body = getBody(includeScript, getWindowTitle(windowOverview));
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   134
        Content header = createTagIfAllowed(HtmlTag.HEADER, HtmlTree::HEADER, ContentBuilder::new);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   135
        addNavigationBarHeader(header);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   136
        Content main = createTagIfAllowed(HtmlTag.MAIN, HtmlTree::MAIN, ContentBuilder::new);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   137
        addOverviewHeader(main);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   138
        addIndex(header, main);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   139
        addOverview(main);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   140
        Content footer = createTagIfAllowed(HtmlTag.FOOTER, HtmlTree::FOOTER, ContentBuilder::new);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   141
        addNavigationBarFooter(footer);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   142
        body.addContent(header);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   143
        body.addContent(main);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   144
        body.addContent(footer);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   145
        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   146
                configuration.doctitle), includeScript, body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   147
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   148
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   149
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   150
     * Generate and prints the contents in the module packages index file. Call appropriate
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   151
     * methods from the sub-class in order to generate Frame or Non
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   152
     * Frame format.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   153
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   154
     * @param title the title of the window.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   155
     * @param includeScript boolean set true if windowtitle script is to be included
40508
74ef30d16fb9 8159305: Enhance the javadoc tool to support module related options
ksrini
parents: 40303
diff changeset
   156
     * @param mdle the name of the module being documented
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   157
     * @throws DocFileIOException if there is an exception building the module packages index file
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   158
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   159
    protected void buildModulePackagesIndexFile(String title,
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   160
            boolean includeScript, ModuleElement mdle) throws DocFileIOException {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   161
        String windowOverview = configuration.getText(title);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   162
        Content body = getBody(includeScript, getWindowTitle(windowOverview));
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   163
        Content header = createTagIfAllowed(HtmlTag.HEADER, HtmlTree::HEADER, ContentBuilder::new);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   164
        addNavigationBarHeader(header);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   165
        Content main = createTagIfAllowed(HtmlTag.MAIN, HtmlTree::MAIN, ContentBuilder::new);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   166
        addOverviewHeader(main);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   167
        addModulePackagesIndex(header, main, mdle);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   168
        addOverview(main);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   169
        Content footer = createTagIfAllowed(HtmlTag.FOOTER, HtmlTree::FOOTER, ContentBuilder::new);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   170
        addNavigationBarFooter(footer);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   171
        body.addContent(header);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   172
        body.addContent(main);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   173
        body.addContent(footer);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   174
        printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   175
                configuration.doctitle), includeScript, body);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   176
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   177
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   178
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   179
     * Default to no overview, override to add overview.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   180
     *
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   181
     * @param main the document tree to which the overview will be added
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   182
     */
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   183
    protected void addOverview(Content main) { }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   184
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   185
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   186
     * Adds the frame or non-frame module index to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   187
     *
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   188
     * @param header the document tree to which the navigational links will be added
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   189
     * @param main the document tree to which the modules list will be added
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   190
     */
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   191
    protected void addIndex(Content header, Content main) {
45157
f5f796453339 8178043: Support grouping modules in unified javadoc
bpatel
parents: 40587
diff changeset
   192
        addIndexContents(configuration.modules, "doclet.Module_Summary",
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   193
                configuration.getText("doclet.Member_Table_Summary",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   194
                configuration.getText("doclet.Module_Summary"),
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   195
                configuration.getText("doclet.modules")), header, main);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   196
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   197
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   198
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   199
     * Adds the frame or non-frame module packages index to the documentation tree.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   200
     *
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   201
     * @param header the document tree to which the navigational links will be added
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   202
     * @param main the document tree to which the module packages list will be added
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   203
     * @param mdle the module being documented
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   204
     */
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   205
    protected void addModulePackagesIndex(Content header, Content main, ModuleElement mdle) {
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   206
        addModulePackagesIndexContents("doclet.Module_Summary",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   207
                configuration.getText("doclet.Member_Table_Summary",
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   208
                configuration.getText("doclet.Module_Summary"),
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   209
                configuration.getText("doclet.modules")), header, main, mdle);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   210
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   211
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   212
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   213
     * Adds module index contents. Call appropriate methods from
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   214
     * the sub-classes. Adds it to the body HtmlTree
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   215
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   216
     * @param modules the modules to be documented
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   217
     * @param text string which will be used as the heading
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   218
     * @param tableSummary summary for the table
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   219
     * @param header the document tree to which the navgational links will be added
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   220
     * @param main the document tree to which the modules list will be added
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   221
     */
45157
f5f796453339 8178043: Support grouping modules in unified javadoc
bpatel
parents: 40587
diff changeset
   222
    protected void addIndexContents(Collection<ModuleElement> modules, String text,
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   223
            String tableSummary, Content header, Content main) {
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   224
        HtmlTree htmlTree = (HtmlTree)createTagIfAllowed(HtmlTag.NAV, HtmlTree::NAV, () -> new HtmlTree(HtmlTag.DIV));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   225
        htmlTree.setStyle(HtmlStyle.indexNav);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   226
        HtmlTree ul = new HtmlTree(HtmlTag.UL);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   227
        addAllClassesLink(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   228
        addAllPackagesLink(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   229
        htmlTree.addContent(ul);
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   230
        header.addContent(htmlTree);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   231
        addModulesList(main);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   232
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   233
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   234
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   235
     * Adds module packages index contents. Call appropriate methods from
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   236
     * the sub-classes. Adds it to the body HtmlTree
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   237
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   238
     * @param text string which will be used as the heading
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   239
     * @param tableSummary summary for the table
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   240
     * @param header the document tree to which the navigational links will be added
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   241
     * @param main the document tree to which the module packages list will be added
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   242
     * @param mdle the module being documented
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   243
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   244
    protected void addModulePackagesIndexContents(String text,
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   245
            String tableSummary, Content header, Content main, ModuleElement mdle) {
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   246
        HtmlTree htmlTree = (HtmlTree)createTagIfAllowed(HtmlTag.NAV, HtmlTree::NAV, () -> new HtmlTree(HtmlTag.DIV));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   247
        htmlTree.setStyle(HtmlStyle.indexNav);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   248
        HtmlTree ul = new HtmlTree(HtmlTag.UL);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   249
        addAllClassesLink(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   250
        addAllPackagesLink(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   251
        addAllModulesLink(ul);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   252
        htmlTree.addContent(ul);
51797
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   253
        header.addContent(htmlTree);
3efead10e303 8210047: some pages contain content outside of landmark region
pmuthuswamy
parents: 49551
diff changeset
   254
        addModulePackagesList(modules, text, tableSummary, main, mdle);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   255
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   256
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   257
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   258
     * Adds the doctitle to the documentation tree, if it is specified on the command line.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   259
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   260
     * @param body the document tree to which the title will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   261
     */
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   262
    protected void addConfigurationTitle(Content body) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   263
        if (configuration.doctitle.length() > 0) {
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   264
            Content title = new RawHtml(configuration.doctitle);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   265
            Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING,
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   266
                    HtmlStyle.title, title);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   267
            Content div = HtmlTree.DIV(HtmlStyle.header, heading);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   268
            body.addContent(div);
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   269
        }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   270
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   271
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   272
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   273
     * Do nothing. This will be overridden in ModuleIndexFrameWriter.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   274
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   275
     * @param div the document tree to which the all classes link will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   276
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   277
    protected void addAllClassesLink(Content div) { }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   278
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   279
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   280
     * Do nothing. This will be overridden in ModuleIndexFrameWriter.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   281
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   282
     * @param div the document tree to which the all packages link will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   283
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   284
    protected void addAllPackagesLink(Content div) { }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   285
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   286
    /**
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   287
     * Do nothing. This will be overridden in ModulePackageIndexFrameWriter.
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   288
     *
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   289
     * @param div the document tree to which the all modules link will be added
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   290
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   291
    protected void addAllModulesLink(Content div) { }
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents:
diff changeset
   292
}