src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
author jjg
Wed, 25 Oct 2017 17:16:18 -0700
changeset 47449 afa66f3c34c1
parent 47427 251676148c62
child 47846 4e78aba768f0
permissions -rw-r--r--
8189841: Error in alternate row coloring in package-summary files Reviewed-by: bpatel, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
44196
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42824
diff changeset
     2
 * Copyright (c) 1997, 2017, 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
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    28
import java.util.*;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9606
diff changeset
    29
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
    30
import javax.lang.model.element.ModuleElement;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    31
import javax.lang.model.element.PackageElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    32
import javax.lang.model.element.TypeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    33
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    34
import com.sun.source.doctree.DocTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    35
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    36
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    37
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    38
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    39
import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    40
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    41
import jdk.javadoc.internal.doclets.toolkit.Content;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    42
import jdk.javadoc.internal.doclets.toolkit.PackageSummaryWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    43
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
    44
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    45
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    46
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 * Class to generate file for each package contents in the right-hand
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * frame. This will list all the Class Kinds in the package. A click on any
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 * class-kind will update the frame with the clicked class-kind page.
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    53
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    54
 *  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
    55
 *  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
    56
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    57
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 * @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
    59
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
public class PackageWriterImpl extends HtmlDocletWriter
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    implements PackageSummaryWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     * The prev package name in the alpha-order list.
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    67
    protected PackageElement prev;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
     * The next package name in the alpha-order list.
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    72
    protected PackageElement next;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * The package being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    77
    protected PackageElement packageElement;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    80
     * The HTML tree for main tag.
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
    protected HtmlTree mainTree = HtmlTree.MAIN();
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    83
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    84
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    85
     * The HTML tree for section tag.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    86
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    87
    protected HtmlTree sectionTree = HtmlTree.SECTION();
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    88
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
    89
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
     * Constructor to construct PackageWriter object and to generate
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     * "package-summary.html" file in the respective package directory.
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     * For example for package "java.lang" this will generate file
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
     * "package-summary.html" file in the "java/lang" directory. It will also
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     * 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
    95
     * if it doesn't exist.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     * @param configuration the configuration of the doclet.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    98
     * @param packageElement    PackageElement under consideration.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     * @param prev          Previous package in the sorted array.
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
     * @param next            Next package in the sorted array.
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 44196
diff changeset
   102
    public PackageWriterImpl(HtmlConfiguration configuration,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   103
            PackageElement packageElement, PackageElement prev, PackageElement next) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   104
        super(configuration, DocPath
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   105
                .forPackage(packageElement)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   106
                .resolve(DocPaths.PACKAGE_SUMMARY));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
        this.prev = prev;
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
        this.next = next;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   109
        this.packageElement = packageElement;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   115
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   116
    public Content getPackageHeader(String heading) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   117
        HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getPackageName(packageElement)));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   118
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   119
                ? HtmlTree.HEADER()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   120
                : bodyTree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   121
        addTop(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   122
        addNavLinks(true, htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   123
        if (configuration.allowTag(HtmlTag.HEADER)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   124
            bodyTree.addContent(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   125
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   126
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   127
        div.addStyle(HtmlStyle.header);
40503
cb34fd6e8071 8135291: [javadoc] broken link in Package com.sun.tools.jconsole
bpatel
parents: 40303
diff changeset
   128
        if (configuration.showModules) {
42824
89b14017e8d6 8133896: Update javax.lang.model APIs
jlahoda
parents: 42816
diff changeset
   129
            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
   130
            Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInPackage, contents.moduleLabel);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   131
            Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   132
            moduleNameDiv.addContent(Contents.SPACE);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   133
            moduleNameDiv.addContent(getModuleLink(mdle,
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   134
                    new StringContent(mdle.getQualifiedName().toString())));
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   135
            div.addContent(moduleNameDiv);
3b41f1c69604 8142968: Module System implementation
alanb
parents: 35426
diff changeset
   136
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   137
        Content annotationContent = new HtmlTree(HtmlTag.P);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   138
        addAnnotationInfo(packageElement, annotationContent);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   139
        div.addContent(annotationContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   140
        Content tHeading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   141
                HtmlStyle.title, contents.packageLabel);
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   142
        tHeading.addContent(Contents.SPACE);
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17561
diff changeset
   143
        Content packageHead = new StringContent(heading);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   144
        tHeading.addContent(packageHead);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   145
        div.addContent(tHeading);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   146
        if (configuration.allowTag(HtmlTag.MAIN)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   147
            mainTree.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   148
        } else {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   149
            bodyTree.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   150
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   151
        return bodyTree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   152
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   157
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   158
    public Content getContentHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   159
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   160
        div.addStyle(HtmlStyle.contentContainer);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   161
        return div;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
    /**
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   165
     * 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
   166
     *
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   167
     * @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
   168
     */
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   169
    public void addDeprecationInfo(Content div) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   170
        List<? extends DocTree> deprs = utils.getBlockTags(packageElement, DocTree.Kind.DEPRECATED);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   171
        if (utils.isDeprecated(packageElement)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   172
            CommentHelper ch = utils.getCommentHelper(packageElement);
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   173
            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
47272
e0d686cdf608 8183511: improve style for deprecated text
bpatel
parents: 47216
diff changeset
   174
            deprDiv.addStyle(HtmlStyle.deprecationBlock);
42816
3638773ff1b0 8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents: 41453
diff changeset
   175
            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
   176
            deprDiv.addContent(deprPhrase);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   177
            if (!deprs.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   178
                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   179
                if (!commentTags.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   180
                    addInlineDeprecatedComment(packageElement, deprs.get(0), deprDiv);
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   181
                }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   182
            }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   183
            div.addContent(deprDiv);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   184
        }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   185
    }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   186
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9068
diff changeset
   187
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   190
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   191
    public Content getSummaryHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   192
        HtmlTree ul = new HtmlTree(HtmlTag.UL);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   193
        ul.addStyle(HtmlStyle.blockList);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   194
        return ul;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   195
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   196
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   197
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   198
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   199
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   200
    @Override
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   201
    public void addInterfaceSummary(SortedSet<TypeElement> interfaces, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   202
        String label = resources.getText("doclet.Interface_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   203
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   204
                        resources.getText("doclet.Interface_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   205
                        resources.getText("doclet.interfaces"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   206
        TableHeader tableHeader= new TableHeader(contents.interfaceLabel, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   207
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   208
        addClassesSummary(interfaces, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   209
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   210
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   211
    /**
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   212
     * {@inheritDoc}
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   213
     */
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   214
    @Override
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   215
    public void addClassSummary(SortedSet<TypeElement> classes, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   216
        String label = resources.getText("doclet.Class_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   217
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   218
                        resources.getText("doclet.Class_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   219
                        resources.getText("doclet.classes"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   220
        TableHeader tableHeader= new TableHeader(contents.classLabel, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   221
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   222
        addClassesSummary(classes, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   223
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   224
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   225
    /**
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   226
     * {@inheritDoc}
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   227
     */
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   228
    @Override
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   229
    public void addEnumSummary(SortedSet<TypeElement> enums, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   230
        String label = resources.getText("doclet.Enum_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   231
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   232
                        resources.getText("doclet.Enum_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   233
                        resources.getText("doclet.enums"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   234
        TableHeader tableHeader= new TableHeader(contents.enum_, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   235
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   236
        addClassesSummary(enums, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   237
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   238
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   239
    /**
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   240
     * {@inheritDoc}
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   241
     */
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   242
    @Override
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   243
    public void addExceptionSummary(SortedSet<TypeElement> exceptions, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   244
        String label = resources.getText("doclet.Exception_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   245
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   246
                        resources.getText("doclet.Exception_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   247
                        resources.getText("doclet.exceptions"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   248
        TableHeader tableHeader= new TableHeader(contents.exception, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   249
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   250
        addClassesSummary(exceptions, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   251
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   252
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   253
    /**
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   254
     * {@inheritDoc}
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   255
     */
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   256
    @Override
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   257
    public void addErrorSummary(SortedSet<TypeElement> errors, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   258
        String label = resources.getText("doclet.Error_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   259
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   260
                        resources.getText("doclet.Error_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   261
                        resources.getText("doclet.errors"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   262
        TableHeader tableHeader= new TableHeader(contents.error, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   263
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   264
        addClassesSummary(errors, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   265
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   266
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   267
    /**
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   268
     * {@inheritDoc}
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   269
     */
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   270
    @Override
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   271
    public void addAnnotationTypeSummary(SortedSet<TypeElement> annoTypes, Content summaryContentTree) {
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   272
        String label = resources.getText("doclet.Annotation_Types_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   273
        String tableSummary = resources.getText("doclet.Member_Table_Summary",
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   274
                        resources.getText("doclet.Annotation_Types_Summary"),
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   275
                        resources.getText("doclet.annotationtypes"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   276
        TableHeader tableHeader= new TableHeader(contents.annotationType, contents.descriptionLabel);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   277
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   278
        addClassesSummary(annoTypes, label, tableSummary, tableHeader, summaryContentTree);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   279
    }
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   280
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   281
    /**
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   282
     * {@inheritDoc}
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   283
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   284
    public void addClassesSummary(SortedSet<TypeElement> classes, String label,
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   285
            String tableSummary, TableHeader tableHeader, Content summaryContentTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   286
        if(!classes.isEmpty()) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
   287
            Content caption = getTableCaption(new RawHtml(label));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   288
            Content table = (configuration.isOutputHtml5())
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   289
                    ? HtmlTree.TABLE(HtmlStyle.typeSummary, caption)
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   290
                    : HtmlTree.TABLE(HtmlStyle.typeSummary, tableSummary, caption);
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   291
            table.addContent(tableHeader.toContent());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   292
            Content tbody = new HtmlTree(HtmlTag.TBODY);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   293
            boolean altColor = false;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   294
            for (TypeElement klass : classes) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   295
                if (!utils.isCoreClass(klass) ||
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   296
                    !configuration.isGeneratedDoc(klass)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   297
                    continue;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   298
                }
47449
afa66f3c34c1 8189841: Error in alternate row coloring in package-summary files
jjg
parents: 47427
diff changeset
   299
                altColor = !altColor;
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   300
                Content classContent = getLink(new LinkInfoImpl(
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   301
                        configuration, LinkInfoImpl.Kind.PACKAGE, klass));
41157
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40587
diff changeset
   302
                Content thClass = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, classContent);
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40587
diff changeset
   303
                HtmlTree tr = HtmlTree.TR(thClass);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   304
                tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   305
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   306
                HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   307
                tdClassDescription.addStyle(HtmlStyle.colLast);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   308
                if (utils.isDeprecated(klass)) {
42816
3638773ff1b0 8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents: 41453
diff changeset
   309
                    tdClassDescription.addContent(getDeprecatedPhrase(klass));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   310
                    List<? extends DocTree> tags = utils.getDeprecatedTrees(klass);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   311
                    if (!tags.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   312
                        addSummaryDeprecatedComment(klass, tags.get(0), tdClassDescription);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   313
                    }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   314
                } else {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   315
                    addSummaryComment(klass, tdClassDescription);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   316
                }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   317
                tr.addContent(tdClassDescription);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   318
                tbody.addContent(tr);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   319
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   320
            table.addContent(tbody);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   321
            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   322
            summaryContentTree.addContent(li);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   329
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   330
    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
   331
        if (!utils.getBody(packageElement).isEmpty()) {
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   332
            Content tree = configuration.allowTag(HtmlTag.SECTION) ? sectionTree : packageContentTree;
46081
7c6d73d10b6b 8185194: Missing anchor for package description in package-summary.html pages
pmuthuswamy
parents: 45417
diff changeset
   333
            tree.addContent(getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION));
41453
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   334
            addDeprecationInfo(tree);
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   335
            addInlineComment(packageElement, tree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   342
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   343
    public void addPackageTags(Content packageContentTree) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   344
        Content htmlTree = (configuration.allowTag(HtmlTag.SECTION))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   345
                ? sectionTree
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   346
                : packageContentTree;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   347
        addTagsInfo(packageElement, htmlTree);
41453
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   348
        if (configuration.allowTag(HtmlTag.SECTION)) {
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   349
            packageContentTree.addContent(sectionTree);
5429549751ad 4649116: Add option to include full package description at top, before interface table
bpatel
parents: 41452
diff changeset
   350
        }
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   351
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   352
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   353
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   354
     * {@inheritDoc}
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   355
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   356
    @Override
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   357
    public void addPackageContent(Content contentTree, Content packageContentTree) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   358
        if (configuration.allowTag(HtmlTag.MAIN)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   359
            mainTree.addContent(packageContentTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   360
            contentTree.addContent(mainTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   361
        } else {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   362
            contentTree.addContent(packageContentTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   363
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   364
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   365
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   366
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   367
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   368
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   369
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   370
    public void addPackageFooter(Content contentTree) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   371
        Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   372
                ? HtmlTree.FOOTER()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   373
                : contentTree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   374
        addNavLinks(false, htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   375
        addBottom(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   376
        if (configuration.allowTag(HtmlTag.FOOTER)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   377
            contentTree.addContent(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26664
diff changeset
   378
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   379
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   380
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
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   383
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   384
    @Override
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   385
    public void printDocument(Content contentTree) throws DocFileIOException {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   386
        printHtmlDocument(configuration.metakeywords.getMetaKeywords(packageElement),
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   387
                true, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   391
     * 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
   392
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   393
     * @return a content tree for the class use link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   395
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   396
    protected Content getNavLinkClassUse() {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   397
        Content useLink = getHyperLink(DocPaths.PACKAGE_USE,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   398
                contents.useLabel, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   399
        Content li = HtmlTree.LI(useLink);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   400
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   404
     * Get "PREV PACKAGE" link in the navigation bar.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   405
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   406
     * @return a content tree for the previous link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   408
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   409
    public Content getNavLinkPrevious() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   410
        Content li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
        if (prev == null) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   412
            li = HtmlTree.LI(contents.prevPackageLabel);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
        } else {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   414
            DocPath path = DocPath.relativePath(packageElement, prev);
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   415
            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.PACKAGE_SUMMARY),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   416
                contents.prevPackageLabel, "", ""));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   418
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   419
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   420
06bc494ca11e Initial load
duke
parents:
diff changeset
   421
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   422
     * Get "NEXT PACKAGE" link in the navigation bar.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   423
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   424
     * @return a content tree for the next link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   426
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   427
    public Content getNavLinkNext() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   428
        Content li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
        if (next == null) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   430
            li = HtmlTree.LI(contents.nextPackageLabel);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   431
        } else {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   432
            DocPath path = DocPath.relativePath(packageElement, next);
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   433
            li = HtmlTree.LI(getHyperLink(path.resolve(DocPaths.PACKAGE_SUMMARY),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   434
                contents.nextPackageLabel, "", ""));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   436
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   440
     * Get "Tree" link in the navigation bar. This will be link to the package
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   441
     * tree file.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   442
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   443
     * @return a content tree for the tree link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   445
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   446
    protected Content getNavLinkTree() {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   447
        Content useLink = getHyperLink(DocPaths.PACKAGE_TREE,
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   448
                contents.treeLabel, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   449
        Content li = HtmlTree.LI(useLink);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   450
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
    /**
37943
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   454
     * 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
   455
     *
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   456
     * @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
   457
     */
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   458
    @Override
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   459
    protected Content getNavLinkModule() {
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   460
        Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(packageElement),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   461
                contents.moduleLabel);
37943
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   462
        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
   463
        return li;
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   464
    }
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   465
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 36526
diff changeset
   466
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   467
     * 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
   468
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   469
     * @return a content tree for the package link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   470
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40503
diff changeset
   471
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   472
    protected Content getNavLinkPackage() {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   473
        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
   474
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
}