src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java
author hannesw
Thu, 28 Jun 2018 01:46:03 +0200
changeset 50856 1857ca5aca37
parent 50167 cc705c956798
child 51797 3efead10e303
permissions -rw-r--r--
8190876: javadoc search on "java.se" shows "java.se" the last one among other modules Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
50167
cc705c956798 8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents: 49551
diff changeset
     2
 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
    28
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
    29
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import java.util.*;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9606
diff changeset
    31
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    32
import javax.lang.model.element.PackageElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    33
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
    34
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    35
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    36
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    37
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    38
import jdk.javadoc.internal.doclets.toolkit.Content;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
    39
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    40
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    41
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
    42
import jdk.javadoc.internal.doclets.toolkit.util.Group;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * Generate the package index page "overview-summary.html" for the right-hand
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * frame. A click on the package name on this page will update the same frame
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14260
diff changeset
    47
 * with the "package-summary.html" file for the clicked package.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    49
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    50
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    51
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    52
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    53
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
 * @author Atul M Dambalkar
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2212
diff changeset
    55
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
public class PackageIndexWriter extends AbstractPackageIndexWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
    60
     * HTML tree for main tag.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
    61
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
    62
    private final HtmlTree htmlTree = HtmlTree.MAIN();
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
    63
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
    64
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     * Construct the PackageIndexWriter. Also constructs the grouping
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     * information as provided on the command line by "-group" option. Stores
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     * the order of groups specified by the user.
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     *
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
    69
     * @param configuration the configuration for this doclet
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
    70
     * @param filename the path of the page to be generated
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     * @see Group
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 45157
diff changeset
    73
    public PackageIndexWriter(HtmlConfiguration configuration, DocPath filename) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
        super(configuration, filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     * Generate the package index page for the right-hand frame.
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     * @param configuration the current configuration of the doclet.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
    81
     * @throws DocFileIOException if there is a problem generating the package index page
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 45157
diff changeset
    83
    public static void generate(HtmlConfiguration configuration) throws DocFileIOException {
40500
f293dbb81a53 8162353: javadoc should provide a way to disable use of frames
jjg
parents: 40303
diff changeset
    84
        DocPath filename = DocPaths.overviewSummary(configuration.frames);
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
    85
        PackageIndexWriter packgen = new PackageIndexWriter(configuration, filename);
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
    86
        packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    90
     * Depending upon the grouping information and their titles, add
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    91
     * separate table indices for each package group.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    93
     * @param body the documentation tree to which the index will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
    95
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    96
    protected void addIndex(Content body) {
47447
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
    97
        addIndexContents(body);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    98
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    99
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   100
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   101
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   102
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
   103
    @Override
47447
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
   104
    protected void addPackagesList(Content body) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   105
        Map<String, SortedSet<PackageElement>> groupPackageMap
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   106
                = configuration.group.groupPackages(packages);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   107
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   108
        if (!groupPackageMap.keySet().isEmpty()) {
47447
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
   109
            String tableSummary = configuration.getText("doclet.Member_Table_Summary",
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
   110
                    configuration.getText("doclet.Package_Summary"), configuration.getText("doclet.packages"));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   111
            Table table =  new Table(configuration.htmlVersion, HtmlStyle.overviewSummary)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   112
                    .setSummary(tableSummary)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   113
                    .setHeader(getPackageTableHeader())
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   114
                    .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   115
                    .setDefaultTab(resources.getText("doclet.All_Packages"))
50167
cc705c956798 8196201: Generate pages to list all classes and all packages in javadoc output
bpatel
parents: 49551
diff changeset
   116
                    .setTabScript(i -> "show(" + i + ");")
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   117
                    .setTabId(i -> (i == 0) ? "t0" : ("t" + (1 << (i - 1))));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   118
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   119
            // add the tabs in command-line order
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   120
            for (String groupName : configuration.group.getGroupList()) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   121
                Set<PackageElement> groupPackages = groupPackageMap.get(groupName);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   122
                if (groupPackages != null) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   123
                    table.addTab(groupName, groupPackages::contains);
47447
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
   124
                }
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
   125
            }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   126
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   127
            for (PackageElement pkg : configuration.packages) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   128
                if (!pkg.isUnnamed()) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   129
                    if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   130
                        Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   131
                        Content summaryContent = new ContentBuilder();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   132
                        addSummaryComment(pkg, summaryContent);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   133
                        table.addRow(pkg, packageLinkContent, summaryContent);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   134
                    }
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   135
                }
47447
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
   136
            }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   137
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   138
            Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table.toContent());
47447
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
   139
            if (configuration.allowTag(HtmlTag.MAIN)) {
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
   140
                htmlTree.addContent(div);
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
   141
            } else {
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
   142
                body.addContent(div);
9887d1bc3e9c 8183037: Overview summary page should have a table with tabs for groups
bpatel
parents: 47427
diff changeset
   143
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   144
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   145
            if (table.needsScript()) {
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   146
                getMainBodyScript().append(table.getScript());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   152
     * Adds the overview summary comment for this documentation. Add one line
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     * summary at the top of the page and generate a link to the description,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   154
     * which is added at the end of this page.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   155
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   156
     * @param body the documentation tree to which the overview header will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
   158
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   159
    protected void addOverviewHeader(Content body) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   160
        addConfigurationTitle(body);
41452
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 41157
diff changeset
   161
        if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
43755
ae42964e27e3 8173302: Move the Description up on module and package index page
ksrini
parents: 41452
diff changeset
   162
            HtmlTree div = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   163
            div.setStyle(HtmlStyle.contentContainer);
43755
ae42964e27e3 8173302: Move the Description up on module and package index page
ksrini
parents: 41452
diff changeset
   164
            addOverviewComment(div);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   165
            if (configuration.allowTag(HtmlTag.MAIN)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   166
                htmlTree.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   167
            } else {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   168
                body.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   169
            }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   174
     * Adds the overview comment as provided in the file specified by the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   175
     * "-overview" option on the command line.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   176
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   177
     * @param htmltree the documentation tree to which the overview comment will
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   178
     *                 be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   180
    protected void addOverviewComment(Content htmltree) {
41452
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 41157
diff changeset
   181
        if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 31751
diff changeset
   182
            addInlineComment(configuration.overviewElement, htmltree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
    /**
44195
5860769fe2f4 8175799: module summary page shows duplicated output
bpatel
parents: 43755
diff changeset
   187
     * For HTML 5, add the htmlTree to the body. For HTML 4, do nothing.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   188
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   189
     * @param body the documentation tree to which the overview will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
   191
    @Override
44195
5860769fe2f4 8175799: module summary page shows duplicated output
bpatel
parents: 43755
diff changeset
   192
    protected void addOverview(Content body) {
5860769fe2f4 8175799: module summary page shows duplicated output
bpatel
parents: 43755
diff changeset
   193
        if (configuration.allowTag(HtmlTag.MAIN)) {
5860769fe2f4 8175799: module summary page shows duplicated output
bpatel
parents: 43755
diff changeset
   194
            body.addContent(htmlTree);
5860769fe2f4 8175799: module summary page shows duplicated output
bpatel
parents: 43755
diff changeset
   195
        }
5860769fe2f4 8175799: module summary page shows duplicated output
bpatel
parents: 43755
diff changeset
   196
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   199
     * Adds the top text (from the -top option), the upper
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
     * navigation bar, and then the title (from the"-title"
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
     * option), at the top of page.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   202
     *
31751
ec251536a004 8080880: some docs cleanup for langtools
avstepan
parents: 29957
diff changeset
   203
     * @param body the documentation tree to which the navigation bar header will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
   205
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   206
    protected void addNavigationBarHeader(Content body) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   207
        Content tree = (configuration.allowTag(HtmlTag.HEADER))
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   208
                ? HtmlTree.HEADER()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   209
                : body;
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   210
        addTop(tree);
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 47847
diff changeset
   211
        navBar.setUserHeader(getUserHeaderFooter(true));
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 47847
diff changeset
   212
        tree.addContent(navBar.getContent(true));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   213
        if (configuration.allowTag(HtmlTag.HEADER)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   214
            body.addContent(tree);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   215
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   219
     * Adds the lower navigation bar and the bottom text
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
     * (from the -bottom option) at the bottom of page.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   221
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
   222
     * @param body the documentation tree to which the navigation bar footer will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40500
diff changeset
   224
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   225
    protected void addNavigationBarFooter(Content body) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   226
        Content tree = (configuration.allowTag(HtmlTag.FOOTER))
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   227
                ? HtmlTree.FOOTER()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   228
                : body;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 47847
diff changeset
   229
        navBar.setUserFooter(getUserHeaderFooter(false));
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 47847
diff changeset
   230
        tree.addContent(navBar.getContent(false));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   231
        addBottom(tree);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   232
        if (configuration.allowTag(HtmlTag.FOOTER)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47447
diff changeset
   233
            body.addContent(tree);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   234
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
}