src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java
author hannesw
Wed, 27 Nov 2019 13:08:16 +0100
changeset 59294 48b88b9c11eb
parent 54936 8c63164bd540
permissions -rw-r--r--
8223378: CSS solution for navbar problem with <a> elements is not ideal Reviewed-by: jjg
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) 1997, 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
54610
a9ab154b1384 8222669: Create and use new html.Entity class
jjg
parents: 54350
diff changeset
    28
import java.util.Collection;
a9ab154b1384 8222669: Create and use new html.Entity class
jjg
parents: 54350
diff changeset
    29
import java.util.List;
a9ab154b1384 8222669: Create and use new html.Entity class
jjg
parents: 54350
diff changeset
    30
import java.util.Set;
a9ab154b1384 8222669: Create and use new html.Entity class
jjg
parents: 54350
diff changeset
    31
import java.util.SortedSet;
a9ab154b1384 8222669: Create and use new html.Entity class
jjg
parents: 54350
diff changeset
    32
import java.util.TreeSet;
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1789
diff changeset
    33
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    34
import javax.lang.model.element.AnnotationMirror;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    35
import javax.lang.model.element.Element;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
    36
import javax.lang.model.element.ModuleElement;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    37
import javax.lang.model.element.PackageElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    38
import javax.lang.model.element.TypeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    39
import javax.lang.model.type.TypeMirror;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    40
import javax.lang.model.util.SimpleElementVisitor8;
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26270
diff changeset
    41
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    42
import com.sun.source.doctree.DocTree;
54648
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
    43
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
54610
a9ab154b1384 8222669: Create and use new html.Entity class
jjg
parents: 54350
diff changeset
    44
import jdk.javadoc.internal.doclets.formats.html.markup.Entity;
54648
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
    45
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    46
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    47
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    48
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    49
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    50
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    51
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    52
import jdk.javadoc.internal.doclets.toolkit.ClassWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    53
import jdk.javadoc.internal.doclets.toolkit.Content;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    54
import jdk.javadoc.internal.doclets.toolkit.taglets.ParamTaglet;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    55
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    56
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40506
diff changeset
    57
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
54936
8c63164bd540 8219313: Support module specific stylesheets
pmuthuswamy
parents: 54648
diff changeset
    58
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    59
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
 * Generate the Class Information Page.
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    63
 *
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    64
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    65
 *  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
    66
 *  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
    67
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    68
 *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    69
 * @see javax.lang.model.element.TypeElement
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
 * @see java.util.Collections
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
 * @see java.util.List
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
 * @see java.util.ArrayList
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
 * @see java.util.HashMap
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
 * @author Robert Field
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    77
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
 */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    79
public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWriter {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
52914
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
    81
    private static final Set<String> suppressSubtypesSet
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
    82
            = Set.of("java.lang.Object",
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
    83
                     "org.omg.CORBA.Object");
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
    84
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
    85
    private static final Set<String> suppressImplementingSet
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
    86
            = Set.of( "java.lang.Cloneable",
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
    87
                    "java.lang.constant.Constable",
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
    88
                    "java.lang.constant.ConstantDesc",
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
    89
                    "java.io.Serializable");
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
    90
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    91
    protected final TypeElement typeElement;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
    93
    protected final ClassTree classtree;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    95
    private final Navigation navBar;
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
    96
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    /**
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
    98
     * @param configuration the configuration data for the doclet
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    99
     * @param typeElement the class being documented.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
     * @param classTree the class tree for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 44196
diff changeset
   102
    public ClassWriterImpl(HtmlConfiguration configuration, TypeElement typeElement,
48756
ce608a09a666 8196027: Remove "Prev" and "Next" links from the javadoc navigation
bpatel
parents: 48654
diff changeset
   103
                           ClassTree classTree) {
48759
ffa68af7da87 8195795: Organize output files by module/package, not just package
jjg
parents: 48756
diff changeset
   104
        super(configuration, configuration.docPaths.forClass(typeElement));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   105
        this.typeElement = typeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   106
        configuration.currentTypeElement = typeElement;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
        this.classtree = classTree;
59294
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   108
        this.navBar = new Navigation(typeElement, configuration, PageMode.CLASS, path);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   114
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   115
    public Content getHeader(String header) {
54350
4f9772f4403d 8215599: Remove support for javadoc "frames" mode
pmuthuswamy
parents: 54060
diff changeset
   116
        HtmlTree bodyTree = getBody(getWindowTitle(utils.getSimpleName(typeElement)));
59294
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   117
        Content headerContent = new ContentBuilder();
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   118
        addTop(headerContent);
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   119
        Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(typeElement),
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   120
                contents.moduleLabel);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   121
        navBar.setNavLinkModule(linkContent);
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   122
        navBar.setMemberSummaryBuilder(configuration.getBuilderFactory().getMemberSummaryBuilder(this));
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   123
        navBar.setUserHeader(getUserHeaderFooter(true));
59294
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   124
        headerContent.add(navBar.getContent(true));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   125
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47300
diff changeset
   126
        div.setStyle(HtmlStyle.header);
40503
cb34fd6e8071 8135291: [javadoc] broken link in Package com.sun.tools.jconsole
bpatel
parents: 40303
diff changeset
   127
        if (configuration.showModules) {
42824
89b14017e8d6 8133896: Update javax.lang.model APIs
jlahoda
parents: 42816
diff changeset
   128
            ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(typeElement);
44196
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42824
diff changeset
   129
            Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInType, contents.moduleLabel);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   130
            Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
54610
a9ab154b1384 8222669: Create and use new html.Entity class
jjg
parents: 54350
diff changeset
   131
            moduleNameDiv.add(Entity.NO_BREAK_SPACE);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   132
            moduleNameDiv.add(getModuleLink(mdle,
49879
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 49551
diff changeset
   133
                    new StringContent(mdle.getQualifiedName())));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   134
            div.add(moduleNameDiv);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   135
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   136
        PackageElement pkg = utils.containingPackage(typeElement);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   137
        if (!pkg.isUnnamed()) {
44196
f88c0e9cb102 8174974: Annotation type pages generated by javadoc is missing module information
bpatel
parents: 42824
diff changeset
   138
            Content classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInType, contents.packageLabel);
36277
9ac0af8efac2 8150000: Javadoc omits package listing for type
ksrini
parents: 35426
diff changeset
   139
            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classPackageLabel);
54610
a9ab154b1384 8222669: Create and use new html.Entity class
jjg
parents: 54350
diff changeset
   140
            pkgNameDiv.add(Entity.NO_BREAK_SPACE);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   141
            Content pkgNameContent = getPackageLink(pkg,
3b41f1c69604 8142968: Module System implementation
alanb
parents: 36500
diff changeset
   142
                    new StringContent(utils.getPackageName(pkg)));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   143
            pkgNameDiv.add(pkgNameContent);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   144
            div.add(pkgNameDiv);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
        }
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
   146
        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   147
                LinkInfoImpl.Kind.CLASS_HEADER, typeElement);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
        //Let's not link to ourselves in the header.
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
        linkInfo.linkToSelf = false;
53991
786825220790 8219801: Pages do not have <h1>
jjg
parents: 53883
diff changeset
   150
        Content heading = HtmlTree.HEADING(Headings.PAGE_TITLE_HEADING, true,
59294
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   151
                HtmlStyle.title, new StringContent(header));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   152
        heading.add(getTypeParameterLinks(linkInfo));
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   153
        div.add(heading);
59294
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   154
        bodyContents.setHeader(headerContent)
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   155
                .addMainContent(MarkerComments.START_OF_CLASS_DATA)
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   156
                .addMainContent(div);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   157
        return bodyTree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   158
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   159
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
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   162
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   163
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   164
    public Content getClassContentHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   165
        return getContentHeader();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   166
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   167
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
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   170
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   171
    @Override
59294
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   172
    public void addFooter() {
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   173
        bodyContents.addMainContent(MarkerComments.END_OF_CLASS_DATA);
53562
0d9dee001667 8215577: Remove javadoc support for HTML 4
pmuthuswamy
parents: 52914
diff changeset
   174
        Content htmlTree = HtmlTree.FOOTER();
49551
0d4786e42471 8196200: Implement a navigation builder in javadoc
bpatel
parents: 48759
diff changeset
   175
        navBar.setUserFooter(getUserHeaderFooter(false));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   176
        htmlTree.add(navBar.getContent(false));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26270
diff changeset
   177
        addBottom(htmlTree);
59294
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   178
        bodyContents.setFooter(htmlTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   184
    @Override
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40506
diff changeset
   185
    public void printDocument(Content contentTree) throws DocFileIOException {
53863
d001808c57e8 8218998: Add metadata to generated API documentation files
jjg
parents: 53562
diff changeset
   186
        String description = getDescription("declaration", typeElement);
53866
880baf6db17b 8213354: Support package-specific stylesheets
pmuthuswamy
parents: 53863
diff changeset
   187
        PackageElement pkg = utils.containingPackage(typeElement);
54936
8c63164bd540 8219313: Support module specific stylesheets
pmuthuswamy
parents: 54648
diff changeset
   188
        List<DocPath> localStylesheets = getLocalStylesheets(pkg);
59294
48b88b9c11eb 8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents: 54936
diff changeset
   189
        contentTree.add(bodyContents.toContent());
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   190
        printHtmlDocument(configuration.metakeywords.getMetaKeywords(typeElement),
54936
8c63164bd540 8219313: Support module specific stylesheets
pmuthuswamy
parents: 54648
diff changeset
   191
                description, localStylesheets, contentTree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   192
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   193
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   194
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   195
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   196
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   197
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   198
    public Content getClassInfoTreeHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   199
        return getMemberTreeHeader();
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   203
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   204
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   205
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   206
    public Content getClassInfo(Content classInfoTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   207
        return getMemberTree(HtmlStyle.description, classInfoTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   213
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   214
    public void addClassSignature(String modifiers, Content classInfoTree) {
47272
e0d686cdf608 8183511: improve style for deprecated text
bpatel
parents: 47216
diff changeset
   215
        Content hr = new HtmlTree(HtmlTag.HR);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   216
        classInfoTree.add(hr);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   217
        Content pre = new HtmlTree(HtmlTag.PRE);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   218
        addAnnotationInfo(typeElement, pre);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   219
        pre.add(modifiers);
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
   220
        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   221
                LinkInfoImpl.Kind.CLASS_SIGNATURE, typeElement);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
        //Let's not link to ourselves in the signature.
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
        linkInfo.linkToSelf = false;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   224
        Content className = new StringContent(utils.getSimpleName(typeElement));
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   225
        Content parameterLinks = getTypeParameterLinks(linkInfo);
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
   226
        if (configuration.linksource) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   227
            addSrcLink(typeElement, className, pre);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   228
            pre.add(parameterLinks);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
        } else {
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 19907
diff changeset
   230
            Content span = HtmlTree.SPAN(HtmlStyle.typeNameLabel, className);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   231
            span.add(parameterLinks);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   232
            pre.add(span);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   234
        if (!utils.isInterface(typeElement)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   235
            TypeMirror superclass = utils.getFirstVisibleSuperClass(typeElement);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
            if (superclass != null) {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   237
                pre.add(DocletConstants.NL);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   238
                pre.add("extends ");
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   239
                Content link = getLink(new LinkInfoImpl(configuration,
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 15723
diff changeset
   240
                        LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   241
                        superclass));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   242
                pre.add(link);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   245
        List<? extends TypeMirror> interfaces = typeElement.getInterfaces();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   246
        if (!interfaces.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   247
            boolean isFirst = true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   248
            for (TypeMirror type : interfaces) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   249
                TypeElement tDoc = utils.asTypeElement(type);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   250
                if (!(utils.isPublic(tDoc) || utils.isLinkable(tDoc))) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
                    continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
                }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   253
                if (isFirst) {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   254
                    pre.add(DocletConstants.NL);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   255
                    pre.add(utils.isInterface(typeElement) ? "extends " : "implements ");
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   256
                    isFirst = false;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
                } else {
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   258
                    pre.add(", ");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
                }
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   260
                Content link = getLink(new LinkInfoImpl(configuration,
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 21478
diff changeset
   261
                                                        LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   262
                                                        type));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   263
                pre.add(link);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
        }
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   266
        classInfoTree.add(pre);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   267
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   268
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   269
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   270
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   271
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   272
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   273
    public void addClassDescription(Content classInfoTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   274
        if(!configuration.nocomment) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   275
            // generate documentation for the class.
41452
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 40606
diff changeset
   276
            if (!utils.getFullBody(typeElement).isEmpty()) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   277
                addInlineComment(typeElement, classInfoTree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   278
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   279
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   285
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   286
    public void addClassTagInfo(Content classInfoTree) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
        if(!configuration.nocomment) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   288
            // Print Information about all the tags here
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   289
            addTagsInfo(typeElement, classInfoTree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   290
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   291
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   292
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   293
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   294
     * Get the class hierarchy tree for the given class.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   295
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   296
     * @param type the class to print the hierarchy for
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   297
     * @return a content tree for class inheritence
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   298
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   299
    private Content getClassInheritenceTree(TypeMirror type) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   300
        TypeMirror sup;
54648
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   301
        HtmlTree classTree = null;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   302
        do {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   303
            sup = utils.getFirstVisibleSuperClass(type);
54648
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   304
            HtmlTree htmlElement = HtmlTree.DIV(HtmlStyle.inheritance, getTreeForClassHelper(type));
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   305
            if (classTree != null)
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   306
                htmlElement.add(classTree);
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   307
            classTree = htmlElement;
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   308
            type = sup;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   309
        } while (sup != null);
54648
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   310
        classTree.put(HtmlAttr.TITLE, contents.getContent("doclet.Inheritance_Tree").toString());
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   311
        return classTree;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   312
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   313
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   314
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   315
     * Get the class helper tree for the given class.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   316
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   317
     * @param type the class to print the helper for
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   318
     * @return a content tree for class helper
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   319
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   320
    private Content getTreeForClassHelper(TypeMirror type) {
54648
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   321
        Content content = new ContentBuilder();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   322
        if (type.equals(typeElement.asType())) {
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   323
            Content typeParameters = getTypeParameterLinks(
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 15723
diff changeset
   324
                    new LinkInfoImpl(configuration, LinkInfoImpl.Kind.TREE,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   325
                    typeElement));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   326
            if (configuration.shouldExcludeQualifier(utils.containingPackage(typeElement).toString())) {
54648
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   327
                content.add(utils.asTypeElement(type).getSimpleName());
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   328
                content.add(typeParameters);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   329
            } else {
54648
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   330
                content.add(utils.asTypeElement(type).getQualifiedName());
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   331
                content.add(typeParameters);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   332
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   333
        } else {
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   334
            Content link = getLink(new LinkInfoImpl(configuration,
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17559
diff changeset
   335
                    LinkInfoImpl.Kind.CLASS_TREE_PARENT, type)
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   336
                    .label(configuration.getClassName(utils.asTypeElement(type))));
54648
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   337
            content.add(link);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   338
        }
54648
89f2043ee67a 8221991: Improve the HTML for the inheritance tree for a type
pmuthuswamy
parents: 54610
diff changeset
   339
        return content;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   340
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   341
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   342
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   343
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   344
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   345
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   346
    public void addClassTree(Content classContentTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   347
        if (!utils.isClass(typeElement)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   348
            return;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   349
        }
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   350
        classContentTree.add(getClassInheritenceTree(typeElement.asType()));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   351
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   352
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   353
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   354
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   355
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   356
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   357
    public void addTypeParamInfo(Content classInfoTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   358
        if (!utils.getTypeParamTrees(typeElement).isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   359
            Content typeParam = (new ParamTaglet()).getTagletOutput(typeElement,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   360
                    getTagletWriterInstance(false));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   361
            Content dl = HtmlTree.DL(typeParam);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   362
            classInfoTree.add(dl);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   363
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   364
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   365
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   366
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   367
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   368
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   369
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   370
    public void addSubClassInfo(Content classInfoTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   371
        if (utils.isClass(typeElement)) {
52914
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
   372
            for (String s : suppressSubtypesSet) {
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
   373
                if (typeElement.getQualifiedName().contentEquals(s)) {
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
   374
                    return;    // Don't generate the list, too huge
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
   375
                }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   376
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   377
            Set<TypeElement> subclasses = classtree.directSubClasses(typeElement, false);
26270
a3635e6d3d78 8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents: 25874
diff changeset
   378
            if (!subclasses.isEmpty()) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   379
                Content label = contents.subclassesLabel;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   380
                Content dt = HtmlTree.DT(label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   381
                Content dl = HtmlTree.DL(dt);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   382
                dl.add(getClassLinks(LinkInfoImpl.Kind.SUBCLASSES,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   383
                        subclasses));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   384
                classInfoTree.add(dl);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   385
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   386
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   387
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   388
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   389
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   390
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   391
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   392
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   393
    public void addSubInterfacesInfo(Content classInfoTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   394
        if (utils.isInterface(typeElement)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   395
            Set<TypeElement> subInterfaces = classtree.allSubClasses(typeElement, false);
26270
a3635e6d3d78 8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents: 25874
diff changeset
   396
            if (!subInterfaces.isEmpty()) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   397
                Content label = contents.subinterfacesLabel;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   398
                Content dt = HtmlTree.DT(label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   399
                Content dl = HtmlTree.DL(dt);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   400
                dl.add(getClassLinks(LinkInfoImpl.Kind.SUBINTERFACES,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   401
                        subInterfaces));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   402
                classInfoTree.add(dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   410
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   411
    public void addInterfaceUsageInfo (Content classInfoTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   412
        if (!utils.isInterface(typeElement)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   413
            return;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   414
        }
52914
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
   415
        for (String s : suppressImplementingSet) {
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
   416
            if (typeElement.getQualifiedName().contentEquals(s)) {
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
   417
                return;    // Don't generate the list, too huge
4fa75d8ad418 8210031: implementation for JVM Constants API
vromero
parents: 49879
diff changeset
   418
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   419
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   420
        Set<TypeElement> implcl = classtree.implementingClasses(typeElement);
26270
a3635e6d3d78 8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents: 25874
diff changeset
   421
        if (!implcl.isEmpty()) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   422
            Content label = contents.implementingClassesLabel;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   423
            Content dt = HtmlTree.DT(label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   424
            Content dl = HtmlTree.DL(dt);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   425
            dl.add(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_CLASSES,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   426
                    implcl));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   427
            classInfoTree.add(dl);
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
06bc494ca11e Initial load
duke
parents:
diff changeset
   431
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   433
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   434
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   435
    public void addImplementedInterfacesInfo(Content classInfoTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   436
        SortedSet<TypeMirror> interfaces = new TreeSet<>(utils.makeTypeMirrorClassUseComparator());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   437
        interfaces.addAll(utils.getAllInterfaces(typeElement));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   438
        if (utils.isClass(typeElement) && !interfaces.isEmpty()) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   439
            Content label = contents.allImplementedInterfacesLabel;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   440
            Content dt = HtmlTree.DT(label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   441
            Content dl = HtmlTree.DL(dt);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   442
            dl.add(getClassLinks(LinkInfoImpl.Kind.IMPLEMENTED_INTERFACES, interfaces));
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   443
            classInfoTree.add(dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
06bc494ca11e Initial load
duke
parents:
diff changeset
   447
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   449
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   450
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   451
    public void addSuperInterfacesInfo(Content classInfoTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   452
        SortedSet<TypeMirror> interfaces =
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   453
                new TreeSet<>(utils.makeTypeMirrorIndexUseComparator());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   454
        interfaces.addAll(utils.getAllInterfaces(typeElement));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   455
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   456
        if (utils.isInterface(typeElement) && !interfaces.isEmpty()) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   457
            Content label = contents.allSuperinterfacesLabel;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   458
            Content dt = HtmlTree.DT(label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   459
            Content dl = HtmlTree.DL(dt);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   460
            dl.add(getClassLinks(LinkInfoImpl.Kind.SUPER_INTERFACES, interfaces));
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   461
            classInfoTree.add(dl);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   462
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   463
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   464
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   465
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   466
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   467
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   468
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   469
    public void addNestedClassInfo(final Content classInfoTree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   470
        Element outerClass = typeElement.getEnclosingElement();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   471
        if (outerClass == null)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   472
            return;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   473
        new SimpleElementVisitor8<Void, Void>() {
40606
eb2c81860c86 8164836: TEST_BUG: adjust scope of the DefinedByAnalyzer in tools/all/RunCodingRules.java
jlahoda
parents: 40587
diff changeset
   474
            @Override
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   475
            public Void visitType(TypeElement e, Void p) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   476
                Content label = utils.isInterface(e)
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   477
                        ? contents.enclosingInterfaceLabel
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   478
                        : contents.enclosingClassLabel;
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   479
                Content dt = HtmlTree.DT(label);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   480
                Content dl = HtmlTree.DL(dt);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   481
                Content dd = new HtmlTree(HtmlTag.DD);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   482
                dd.add(getLink(new LinkInfoImpl(configuration,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   483
                        LinkInfoImpl.Kind.CLASS, e)));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   484
                dl.add(dd);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   485
                classInfoTree.add(dl);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   486
                return null;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   487
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   488
        }.visit(outerClass);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   489
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   490
06bc494ca11e Initial load
duke
parents:
diff changeset
   491
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   492
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   493
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   494
    @Override
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14542
diff changeset
   495
    public void addFunctionalInterfaceInfo (Content classInfoTree) {
23799
daa645653200 8029143: javadoc standard doclet should add Functional Interface blurb when @FunctionalInterface annotation is present
bpatel
parents: 22159
diff changeset
   496
        if (isFunctionalInterface()) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39670
diff changeset
   497
            Content dt = HtmlTree.DT(contents.functionalInterface);
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14542
diff changeset
   498
            Content dl = HtmlTree.DL(dt);
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14542
diff changeset
   499
            Content dd = new HtmlTree(HtmlTag.DD);
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   500
            dd.add(contents.functionalInterfaceMessage);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   501
            dl.add(dd);
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   502
            classInfoTree.add(dl);
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14542
diff changeset
   503
        }
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14542
diff changeset
   504
    }
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14542
diff changeset
   505
23799
daa645653200 8029143: javadoc standard doclet should add Functional Interface blurb when @FunctionalInterface annotation is present
bpatel
parents: 22159
diff changeset
   506
    public boolean isFunctionalInterface() {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   507
        List<? extends AnnotationMirror> annotationMirrors = ((Element) typeElement).getAnnotationMirrors();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   508
        for (AnnotationMirror anno : annotationMirrors) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   509
            if (utils.isFunctionalInterface(anno)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   510
                return true;
23799
daa645653200 8029143: javadoc standard doclet should add Functional Interface blurb when @FunctionalInterface annotation is present
bpatel
parents: 22159
diff changeset
   511
            }
daa645653200 8029143: javadoc standard doclet should add Functional Interface blurb when @FunctionalInterface annotation is present
bpatel
parents: 22159
diff changeset
   512
        }
daa645653200 8029143: javadoc standard doclet should add Functional Interface blurb when @FunctionalInterface annotation is present
bpatel
parents: 22159
diff changeset
   513
        return false;
daa645653200 8029143: javadoc standard doclet should add Functional Interface blurb when @FunctionalInterface annotation is present
bpatel
parents: 22159
diff changeset
   514
    }
daa645653200 8029143: javadoc standard doclet should add Functional Interface blurb when @FunctionalInterface annotation is present
bpatel
parents: 22159
diff changeset
   515
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   516
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14542
diff changeset
   517
    /**
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14542
diff changeset
   518
     * {@inheritDoc}
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14542
diff changeset
   519
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   520
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   521
    public void addClassDeprecationInfo(Content classInfoTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   522
        List<? extends DocTree> deprs = utils.getBlockTags(typeElement, DocTree.Kind.DEPRECATED);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   523
        if (utils.isDeprecated(typeElement)) {
42816
3638773ff1b0 8162674: change javadoc output text and style emitted by for-removal deprecations
bpatel
parents: 41452
diff changeset
   524
            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, getDeprecatedPhrase(typeElement));
47272
e0d686cdf608 8183511: improve style for deprecated text
bpatel
parents: 47216
diff changeset
   525
            Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprLabel);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   526
            if (!deprs.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   527
                CommentHelper ch = utils.getCommentHelper(typeElement);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   528
                DocTree dt = deprs.get(0);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   529
                List<? extends DocTree> commentTags = ch.getBody(configuration, dt);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   530
                if (!commentTags.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   531
                    addInlineDeprecatedComment(typeElement, deprs.get(0), div);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   532
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   533
            }
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   534
            classInfoTree.add(div);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   535
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   536
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   537
06bc494ca11e Initial load
duke
parents:
diff changeset
   538
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   539
     * Get links to the given classes.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   540
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   541
     * @param context the id of the context where the link will be printed
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   542
     * @param list the list of classes
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   543
     * @return a content tree for the class list
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   544
     */
26270
a3635e6d3d78 8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents: 25874
diff changeset
   545
    private Content getClassLinks(LinkInfoImpl.Kind context, Collection<?> list) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   546
        Content dd = new HtmlTree(HtmlTag.DD);
26270
a3635e6d3d78 8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents: 25874
diff changeset
   547
        boolean isFirst = true;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   548
        for (Object type : list) {
26270
a3635e6d3d78 8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents: 25874
diff changeset
   549
            if (!isFirst) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   550
                Content separator = new StringContent(", ");
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   551
                dd.add(separator);
26270
a3635e6d3d78 8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents: 25874
diff changeset
   552
            } else {
a3635e6d3d78 8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents: 25874
diff changeset
   553
                isFirst = false;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   554
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   555
            // TODO: should we simply split this method up to avoid instanceof ?
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   556
            if (type instanceof TypeElement) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   557
                Content link = getLink(
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   558
                        new LinkInfoImpl(configuration, context, (TypeElement)(type)));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   559
                dd.add(HtmlTree.CODE(link));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   560
            } else {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   561
                Content link = getLink(
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   562
                        new LinkInfoImpl(configuration, context, ((TypeMirror)type)));
54060
53a95878619f 8220202: Simplify/standardize method naming for HtmlTree
jjg
parents: 53991
diff changeset
   563
                dd.add(HtmlTree.CODE(link));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   564
            }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   565
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   566
        return dd;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   567
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   568
06bc494ca11e Initial load
duke
parents:
diff changeset
   569
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   570
     * Return the TypeElement being documented.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   571
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   572
     * @return the TypeElement being documented.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   573
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   574
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   575
    public TypeElement getTypeElement() {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   576
        return typeElement;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   577
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   578
}