src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java
author jjg
Thu, 21 Feb 2019 17:50:27 -0800
changeset 53883 f41793b5b83f
parent 53880 3f1e9372557f
child 53991 786825220790
permissions -rw-r--r--
8219558: jdk/javadoc tests fail with missing headings: h1 Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
53863
d001808c57e8 8218998: Add metadata to generated API documentation files
jjg
parents: 53562
diff changeset
     2
 * Copyright (c) 2003, 2019, 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: 2216
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: 2216
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: 2216
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2216
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2216
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
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    28
import java.util.List;
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
    29
44196
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
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;
53883
f41793b5b83f 8219558: jdk/javadoc tests fail with missing headings: h1
jjg
parents: 53880
diff changeset
    35
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
35426
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;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    39
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    40
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    41
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    42
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    43
import jdk.javadoc.internal.doclets.toolkit.Content;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    44
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
    45
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * Generate the Class Information Page.
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    49
 *
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    50
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    51
 *  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
    52
 *  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
    53
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    54
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 * @see java.util.Collections
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
 * @see java.util.List
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
 * @see java.util.ArrayList
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 * @see java.util.HashMap
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
 * @author Robert Field
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    62
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
        implements AnnotationTypeWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    67
    protected TypeElement annotationType;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    69
    private final Navigation navBar;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    70
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    72
     * @param configuration the configuration
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
     * @param annotationType the annotation type being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 44196
diff changeset
    75
    public AnnotationTypeWriterImpl(HtmlConfiguration configuration,
48756
ce608a09a666 8196027: Remove "Prev" and "Next" links from the javadoc navigation
bpatel
parents: 48654
diff changeset
    76
            TypeElement annotationType) {
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48756
diff changeset
    77
        super(configuration, configuration.docPaths.forClass(annotationType));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
        this.annotationType = annotationType;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    79
        configuration.currentTypeElement = annotationType;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    80
        this.navBar = new Navigation(annotationType, configuration, fixedNavDiv, PageMode.CLASS, path);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    86
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    87
    public Content getHeader(String header) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    88
        HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getSimpleName(annotationType)));
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 49879
diff changeset
    89
        HtmlTree htmlTree = HtmlTree.HEADER();
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
    90
        addTop(htmlTree);
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    91
        Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(annotationType),
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    92
                contents.moduleLabel);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    93
        navBar.setNavLinkModule(linkContent);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    94
        navBar.setMemberSummaryBuilder(configuration.getBuilderFactory().getMemberSummaryBuilder(this));
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    95
        navBar.setUserHeader(getUserHeaderFooter(true));
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    96
        htmlTree.addContent(navBar.getContent(true));
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 49879
diff changeset
    97
        bodyTree.addContent(htmlTree);
53883
f41793b5b83f 8219558: jdk/javadoc tests fail with missing headings: h1
jjg
parents: 53880
diff changeset
    98
        bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    99
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47300
diff changeset
   100
        div.setStyle(HtmlStyle.header);
44196
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   101
        if (configuration.showModules) {
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   102
            ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(annotationType);
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   103
            Content typeModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInType, contents.moduleLabel);
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   104
            Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, typeModuleLabel);
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   105
            moduleNameDiv.addContent(Contents.SPACE);
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   106
            moduleNameDiv.addContent(getModuleLink(mdle, new StringContent(mdle.getQualifiedName())));
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   107
            div.addContent(moduleNameDiv);
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   108
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   109
        PackageElement pkg = utils.containingPackage(annotationType);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   110
        if (!pkg.isUnnamed()) {
44196
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   111
            Content typePackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInType, contents.packageLabel);
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   112
            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, typePackageLabel);
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   113
            pkgNameDiv.addContent(Contents.SPACE);
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   114
            Content pkgNameContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42816
diff changeset
   115
            pkgNameDiv.addContent(pkgNameContent);
9068
6697b4cbba1d 7010342: End tag for element P is not open for few html files generated using new javadoc
bpatel
parents: 7681
diff changeset
   116
            div.addContent(pkgNameDiv);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   117
        }
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
   118
        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17559
diff changeset
   119
                LinkInfoImpl.Kind.CLASS_HEADER, annotationType);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   120
        Content headerContent = new StringContent(header);
53883
f41793b5b83f 8219558: jdk/javadoc tests fail with missing headings: h1
jjg
parents: 53880
diff changeset
   121
        Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   122
                HtmlStyle.title, headerContent);
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   123
        heading.addContent(getTypeParameterLinks(linkInfo));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   124
        div.addContent(heading);
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 49879
diff changeset
   125
        mainTree.addContent(div);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   126
        return bodyTree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   127
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   129
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   130
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   131
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   132
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   133
    public Content getAnnotationContentHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   134
        return getContentHeader();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   135
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   136
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   137
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   138
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   139
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   140
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   141
    public void addFooter(Content contentTree) {
53883
f41793b5b83f 8219558: jdk/javadoc tests fail with missing headings: h1
jjg
parents: 53880
diff changeset
   142
        contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 49879
diff changeset
   143
        Content htmlTree = HtmlTree.FOOTER();
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   144
        navBar.setUserFooter(getUserHeaderFooter(false));
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   145
        htmlTree.addContent(navBar.getContent(false));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   146
        addBottom(htmlTree);
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 49879
diff changeset
   147
        contentTree.addContent(htmlTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   153
    @Override
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40303
diff changeset
   154
    public void printDocument(Content contentTree) throws DocFileIOException {
53863
d001808c57e8 8218998: Add metadata to generated API documentation files
jjg
parents: 53562
diff changeset
   155
        String description = getDescription("declaration", annotationType);
53866
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   156
        PackageElement pkg = utils.containingPackage(this.annotationType);
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   157
        Content stylesheetContent = getLocalStylesheetContent(pkg);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   158
        printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType),
53880
3f1e9372557f 8219497: Unused parameter in HtmlDocletWriter::printHtmlDocument
jjg
parents: 53879
diff changeset
   159
                description, stylesheetContent, contentTree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   160
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   161
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   162
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   163
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   164
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   165
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   166
    public Content getAnnotationInfoTreeHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   167
        return getMemberTreeHeader();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   168
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   169
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   170
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   171
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   172
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   173
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   174
    public Content getAnnotationInfo(Content annotationInfoTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   175
        return getMemberTree(HtmlStyle.description, annotationInfoTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   181
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   182
    public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) {
47272
e0d686cdf608 8183511: improve style for deprecated text
bpatel
parents: 47216
diff changeset
   183
        Content hr = new HtmlTree(HtmlTag.HR);
e0d686cdf608 8183511: improve style for deprecated text
bpatel
parents: 47216
diff changeset
   184
        annotationInfoTree.addContent(hr);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   185
        Content pre = new HtmlTree(HtmlTag.PRE);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   186
        addAnnotationInfo(annotationType, pre);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   187
        pre.addContent(modifiers);
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
   188
        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17559
diff changeset
   189
                LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   190
        Content annotationName = new StringContent(utils.getSimpleName(annotationType));
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   191
        Content parameterLinks = getTypeParameterLinks(linkInfo);
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
   192
        if (configuration.linksource) {
9083
63f3c4d2d992 7010344: Some of the html files do not have element <a> in right context.
bpatel
parents: 9068
diff changeset
   193
            addSrcLink(annotationType, annotationName, pre);
63f3c4d2d992 7010344: Some of the html files do not have element <a> in right context.
bpatel
parents: 9068
diff changeset
   194
            pre.addContent(parameterLinks);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
        } else {
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 20237
diff changeset
   196
            Content span = HtmlTree.SPAN(HtmlStyle.memberNameLabel, annotationName);
9083
63f3c4d2d992 7010344: Some of the html files do not have element <a> in right context.
bpatel
parents: 9068
diff changeset
   197
            span.addContent(parameterLinks);
63f3c4d2d992 7010344: Some of the html files do not have element <a> in right context.
bpatel
parents: 9068
diff changeset
   198
            pre.addContent(span);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   200
        annotationInfoTree.addContent(pre);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   206
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   207
    public void addAnnotationTypeDescription(Content annotationInfoTree) {
41452
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 40587
diff changeset
   208
        if (!configuration.nocomment) {
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 40587
diff changeset
   209
            if (!utils.getFullBody(annotationType).isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   210
                addInlineComment(annotationType, annotationInfoTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   218
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   219
    public void addAnnotationTypeTagInfo(Content annotationInfoTree) {
41452
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 40587
diff changeset
   220
        if (!configuration.nocomment) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   221
            addTagsInfo(annotationType, annotationInfoTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   228
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   229
    public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   230
        List<? extends DocTree> deprs = utils.getBlockTags(annotationType, DocTree.Kind.DEPRECATED);
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 21478
diff changeset
   231
        if (utils.isDeprecated(annotationType)) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   232
            CommentHelper ch = utils.getCommentHelper(annotationType);
42816
3638773ff1b0 8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents: 41452
diff changeset
   233
            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(annotationType));
47272
e0d686cdf608 8183511: improve style for deprecated text
bpatel
parents: 47216
diff changeset
   234
            Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprLabel);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   235
            if (!deprs.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   236
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   237
                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   238
                if (!commentTags.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   239
                    addInlineDeprecatedComment(annotationType, deprs.get(0), div);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   242
            annotationInfoTree.addContent(div);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   246
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   247
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   248
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   249
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   250
    public TypeElement getAnnotationTypeElement() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
        return annotationType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
}