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