src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
author bpatel
Tue, 06 Feb 2018 18:28:23 -0800
changeset 48756 ce608a09a666
parent 48654 36f58bd6269f
child 48759 ffa68af7da87
permissions -rw-r--r--
8196027: Remove "Prev" and "Next" links from the javadoc navigation Reviewed-by: jjg, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 47850
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: 29957
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: 47449
diff changeset
    28
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
    29
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
    30
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    31
import java.util.*;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9606
diff changeset
    32
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    33
import javax.lang.model.element.ModuleElement;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    34
import javax.lang.model.element.PackageElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    35
import javax.lang.model.element.TypeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    36
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    37
import com.sun.source.doctree.DocTree;
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
    38
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    39
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    40
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    41
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    42
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    43
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    44
import jdk.javadoc.internal.doclets.toolkit.Content;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    45
import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    46
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
    47
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    48
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    49
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 * Class to generate file for each package contents in the right-hand
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 * frame. This will list all the Class Kinds in the package. A click on any
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
 * class-kind will update the frame with the clicked class-kind page.
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    56
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    57
 *  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: 14258
diff changeset
    58
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    59
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    60
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
 * @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: 1787
diff changeset
    62
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
public class PackageWriterImpl extends HtmlDocletWriter
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
    implements PackageSummaryWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     * The package being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    70
    protected PackageElement packageElement;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    73
     * The HTML tree for main tag.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    74
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    75
    protected HtmlTree mainTree = HtmlTree.MAIN();
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    76
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    77
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    78
     * The HTML tree for section tag.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    79
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    80
    protected HtmlTree sectionTree = HtmlTree.SECTION();
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    81
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    82
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     * Constructor to construct PackageWriter object and to generate
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     * "package-summary.html" file in the respective package directory.
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * For example for package "java.lang" this will generate file
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * "package-summary.html" file in the "java/lang" directory. It will also
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     * create "java/lang" directory in the current or the destination directory
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14265
diff changeset
    88
     * if it doesn't exist.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
     * @param configuration the configuration of the doclet.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    91
     * @param packageElement    PackageElement under consideration.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     */
48756
ce608a09a666 8196027: Remove "Prev" and "Next" links from the javadoc navigation
bpatel
parents: 48654
diff changeset
    93
    public PackageWriterImpl(HtmlConfiguration configuration, PackageElement packageElement) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    94
        super(configuration, DocPath
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    95
                .forPackage(packageElement)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    96
                .resolve(DocPaths.PACKAGE_SUMMARY));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    97
        this.packageElement = packageElement;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   103
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   104
    public Content getPackageHeader(String heading) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   105
        HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageElement)));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   106
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   107
                ? HtmlTree.HEADER()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   108
                : bodyTree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   109
        addTop(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   110
        addNavLinks(true, htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   111
        if (configuration.allowTag(HtmlTag.HEADER)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   112
            bodyTree.addContent(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   113
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   114
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   115
        div.setStyle(HtmlStyle.header);
40503
cb34fd6e8071 8135291: [javadoc] broken link in Package com.sun.tools.jconsole
bpatel
parents: 40303
diff changeset
   116
        if (configuration.showModules) {
42824
89b14017e8d6 8133896: Update javax.lang.model APIs
jlahoda
parents: 42816
diff changeset
   117
            ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(packageElement);
44196
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42824
diff changeset
   118
            Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInPackage, contents.moduleLabel);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   119
            Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   120
            moduleNameDiv.addContent(Contents.SPACE);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   121
            moduleNameDiv.addContent(getModuleLink(mdle,
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   122
                    new StringContent(mdle.getQualifiedName().toString())));
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   123
            div.addContent(moduleNameDiv);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   124
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   125
        Content annotationContent = new HtmlTree(HtmlTag.P);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   126
        addAnnotationInfo(packageElement, annotationContent);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   127
        div.addContent(annotationContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   128
        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   129
                HtmlStyle.title, contents.packageLabel);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   130
        tHeading.addContent(Contents.SPACE);
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17561
diff changeset
   131
        Content packageHead = new StringContent(heading);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   132
        tHeading.addContent(packageHead);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   133
        div.addContent(tHeading);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   134
        if (configuration.allowTag(HtmlTag.MAIN)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   135
            mainTree.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   136
        } else {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   137
            bodyTree.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   138
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   139
        return bodyTree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   140
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   145
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   146
    public Content getContentHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   147
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   148
        div.setStyle(HtmlStyle.contentContainer);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   149
        return div;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
    /**
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   153
     * Add the package deprecation information to the documentation tree.
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   154
     *
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   155
     * @param div the content tree to which the deprecation information will be added
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   156
     */
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   157
    public void addDeprecationInfo(Content div) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   158
        List<? extends DocTree> deprs = utils.getBlockTags(packageElement, DocTree.Kind.DEPRECATED);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   159
        if (utils.isDeprecated(packageElement)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   160
            CommentHelper ch = utils.getCommentHelper(packageElement);
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   161
            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   162
            deprDiv.setStyle(HtmlStyle.deprecationBlock);
42816
3638773ff1b0 8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents: 41453
diff changeset
   163
            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(packageElement));
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   164
            deprDiv.addContent(deprPhrase);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   165
            if (!deprs.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   166
                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   167
                if (!commentTags.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   168
                    addInlineDeprecatedComment(packageElement, deprs.get(0), deprDiv);
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   169
                }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   170
            }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   171
            div.addContent(deprDiv);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   172
        }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   173
    }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   174
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   175
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   178
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   179
    public Content getSummaryHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   180
        HtmlTree ul = new HtmlTree(HtmlTag.UL);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   181
        ul.setStyle(HtmlStyle.blockList);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   182
        return ul;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   183
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   184
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   185
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   186
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   187
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   188
    @Override
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   189
    public void addInterfaceSummary(SortedSet<TypeElement> interfaces, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   190
        String label = resources.getText("doclet.Interface_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   191
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   192
                        resources.getText("doclet.Interface_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   193
                        resources.getText("doclet.interfaces"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   194
        TableHeader tableHeader= new TableHeader(contents.interfaceLabel, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   195
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   196
        addClassesSummary(interfaces, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   197
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   198
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   199
    /**
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   200
     * {@inheritDoc}
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   201
     */
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   202
    @Override
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   203
    public void addClassSummary(SortedSet<TypeElement> classes, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   204
        String label = resources.getText("doclet.Class_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   205
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   206
                        resources.getText("doclet.Class_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   207
                        resources.getText("doclet.classes"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   208
        TableHeader tableHeader= new TableHeader(contents.classLabel, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   209
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   210
        addClassesSummary(classes, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   211
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   212
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   213
    /**
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   214
     * {@inheritDoc}
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   215
     */
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   216
    @Override
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   217
    public void addEnumSummary(SortedSet<TypeElement> enums, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   218
        String label = resources.getText("doclet.Enum_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   219
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   220
                        resources.getText("doclet.Enum_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   221
                        resources.getText("doclet.enums"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   222
        TableHeader tableHeader= new TableHeader(contents.enum_, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   223
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   224
        addClassesSummary(enums, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   225
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   226
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   227
    /**
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   228
     * {@inheritDoc}
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   229
     */
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   230
    @Override
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   231
    public void addExceptionSummary(SortedSet<TypeElement> exceptions, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   232
        String label = resources.getText("doclet.Exception_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   233
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   234
                        resources.getText("doclet.Exception_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   235
                        resources.getText("doclet.exceptions"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   236
        TableHeader tableHeader= new TableHeader(contents.exception, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   237
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   238
        addClassesSummary(exceptions, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   239
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   240
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   241
    /**
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   242
     * {@inheritDoc}
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   243
     */
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   244
    @Override
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   245
    public void addErrorSummary(SortedSet<TypeElement> errors, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   246
        String label = resources.getText("doclet.Error_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   247
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   248
                        resources.getText("doclet.Error_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   249
                        resources.getText("doclet.errors"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   250
        TableHeader tableHeader= new TableHeader(contents.error, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   251
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   252
        addClassesSummary(errors, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   253
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   254
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   255
    /**
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   256
     * {@inheritDoc}
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   257
     */
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   258
    @Override
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   259
    public void addAnnotationTypeSummary(SortedSet<TypeElement> annoTypes, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   260
        String label = resources.getText("doclet.Annotation_Types_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   261
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   262
                        resources.getText("doclet.Annotation_Types_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   263
                        resources.getText("doclet.annotationtypes"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   264
        TableHeader tableHeader= new TableHeader(contents.annotationType, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   265
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   266
        addClassesSummary(annoTypes, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   267
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   268
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   269
    public void addClassesSummary(SortedSet<TypeElement> classes, String label,
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   270
            String tableSummary, TableHeader tableHeader, Content summaryContentTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   271
        if(!classes.isEmpty()) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   272
            Table table = new Table(configuration.htmlVersion, HtmlStyle.typeSummary)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   273
                    .setSummary(tableSummary)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   274
                    .setCaption(getTableCaption(new StringContent(label)))
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   275
                    .setHeader(tableHeader)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   276
                    .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   277
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   278
            for (TypeElement klass : classes) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   279
                if (!utils.isCoreClass(klass) || !configuration.isGeneratedDoc(klass)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   280
                    continue;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   281
                }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   282
                Content classLink = getLink(new LinkInfoImpl(
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   283
                        configuration, LinkInfoImpl.Kind.PACKAGE, klass));
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   284
                ContentBuilder description = new ContentBuilder();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   285
                if (utils.isDeprecated(klass)) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   286
                    description.addContent(getDeprecatedPhrase(klass));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   287
                    List<? extends DocTree> tags = utils.getDeprecatedTrees(klass);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   288
                    if (!tags.isEmpty()) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   289
                        addSummaryDeprecatedComment(klass, tags.get(0), description);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   290
                    }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   291
                } else {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   292
                    addSummaryComment(klass, description);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   293
                }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   294
                table.addRow(classLink, description);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   295
            }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47449
diff changeset
   296
            Content li = HtmlTree.LI(HtmlStyle.blockList, table.toContent());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   297
            summaryContentTree.addContent(li);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   304
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   305
    public void addPackageDescription(Content packageContentTree) {
41453
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   306
        if (!utils.getBody(packageElement).isEmpty()) {
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   307
            Content tree = configuration.allowTag(HtmlTag.SECTION) ? sectionTree : packageContentTree;
47850
4a28dc8a86c2 8190821: Introduce a new Links builder class
jjg
parents: 47846
diff changeset
   308
            tree.addContent(links.createAnchor(SectionName.PACKAGE_DESCRIPTION));
41453
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   309
            addDeprecationInfo(tree);
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   310
            addInlineComment(packageElement, tree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   317
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   318
    public void addPackageTags(Content packageContentTree) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   319
        Content htmlTree = (configuration.allowTag(HtmlTag.SECTION))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   320
                ? sectionTree
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   321
                : packageContentTree;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   322
        addTagsInfo(packageElement, htmlTree);
41453
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   323
        if (configuration.allowTag(HtmlTag.SECTION)) {
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   324
            packageContentTree.addContent(sectionTree);
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   325
        }
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   326
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   327
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   328
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   329
     * {@inheritDoc}
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   330
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   331
    @Override
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   332
    public void addPackageContent(Content contentTree, Content packageContentTree) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   333
        if (configuration.allowTag(HtmlTag.MAIN)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   334
            mainTree.addContent(packageContentTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   335
            contentTree.addContent(mainTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   336
        } else {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   337
            contentTree.addContent(packageContentTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   338
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   339
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   340
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   341
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   342
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   343
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   344
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   345
    public void addPackageFooter(Content contentTree) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   346
        Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   347
                ? HtmlTree.FOOTER()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   348
                : contentTree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   349
        addNavLinks(false, htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   350
        addBottom(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   351
        if (configuration.allowTag(HtmlTag.FOOTER)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   352
            contentTree.addContent(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   353
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   354
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   355
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   356
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   357
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   358
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   359
    @Override
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   360
    public void printDocument(Content contentTree) throws DocFileIOException {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   361
        printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement),
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   362
                true, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   366
     * Get "Use" link for this pacakge in the navigation bar.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   367
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   368
     * @return a content tree for the class use link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   370
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   371
    protected Content getNavLinkClassUse() {
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 47850
diff changeset
   372
        Content useLink = links.createLink(DocPaths.PACKAGE_USE,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   373
                contents.useLabel, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   374
        Content li = HtmlTree.LI(useLink);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   375
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   379
     * Get "Tree" link in the navigation bar. This will be link to the package
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
     * tree file.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   381
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   382
     * @return a content tree for the tree link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   384
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   385
    protected Content getNavLinkTree() {
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 47850
diff changeset
   386
        Content useLink = links.createLink(DocPaths.PACKAGE_TREE,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   387
                contents.treeLabel, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   388
        Content li = HtmlTree.LI(useLink);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   389
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
    /**
37943
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   393
     * Get the module link.
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   394
     *
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   395
     * @return a content tree for the module link
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   396
     */
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   397
    @Override
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   398
    protected Content getNavLinkModule() {
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   399
        Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   400
                contents.moduleLabel);
37943
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   401
        Content li = HtmlTree.LI(linkContent);
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   402
        return li;
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   403
    }
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   404
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   405
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
     * Highlight "Package" in the navigation bar, as this is the package page.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   407
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   408
     * @return a content tree for the package link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   410
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   411
    protected Content getNavLinkPackage() {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   412
        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.packageLabel);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   413
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
}