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