langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java
author ksrini
Sat, 28 Nov 2015 18:52:17 -0800
changeset 35426 374342e56a56
parent 29957 langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java@7740f9657f56
child 37943 2efb75c09230
permissions -rw-r--r--
8035473: [javadoc] Revamp the existing Doclet APIs 8146529: Update the new Doclet API 8146427: "-nohelp" option issue 8146475: "-helpfile" option issue Reviewed-by: alanb, bpatel, ihse, jjg, jlahoda, mchung, ogb, vromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
     2
 * Copyright (c) 2003, 2016, 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
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
    28
import java.io.IOException;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    29
import java.util.List;
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
    30
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    31
import javax.lang.model.element.PackageElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    32
import javax.lang.model.element.TypeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    33
import javax.lang.model.type.TypeMirror;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    34
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    35
import com.sun.source.doctree.DocTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    36
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    37
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    38
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    39
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    40
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    41
import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    42
import jdk.javadoc.internal.doclets.toolkit.Content;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    43
import jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    44
import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    45
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    46
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    47
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    48
import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 * Generate the Class Information Page.
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    52
 *
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    53
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    54
 *  If you write code that depends on this, you do so at your own risk.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    55
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    56
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    57
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 * @see java.util.Collections
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
 * @see java.util.List
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
 * @see java.util.ArrayList
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
 * @see java.util.HashMap
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
 * @author Robert Field
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    65
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
        implements AnnotationTypeWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    70
    protected TypeElement annotationType;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    72
    protected TypeMirror prev;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    74
    protected TypeMirror next;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    77
     * @param configuration the configuration
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     * @param annotationType the annotation type being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
     * @param prevType the previous class that was documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     * @param nextType the next class being documented.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    81
     * @throws java.lang.Exception
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     */
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
    83
    public AnnotationTypeWriterImpl(ConfigurationImpl configuration,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    84
            TypeElement annotationType, TypeMirror prevType, TypeMirror nextType)
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14265
diff changeset
    85
            throws Exception {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    86
        super(configuration, DocPath.forClass(configuration.utils, annotationType));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
        this.annotationType = annotationType;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    88
        configuration.currentTypeElement = annotationType;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
        this.prev = prevType;
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
        this.next = nextType;
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    94
     * Get this package link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    95
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    96
     * @return a content tree for the package link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    98
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    99
    protected Content getNavLinkPackage() {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   100
        Content linkContent = getHyperLink(DocPaths.PACKAGE_SUMMARY,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   101
                packageLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   102
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   103
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   107
     * Get the class link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   108
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   109
     * @return a content tree for the class link
10
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
    protected Content getNavLinkClass() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   113
        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, classLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   114
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   115
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   116
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   117
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   118
     * Get the class use link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   119
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   120
     * @return a content tree for the class use link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   121
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   122
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   123
    protected Content getNavLinkClassUse() {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   124
        Content linkContent = getHyperLink(DocPaths.CLASS_USE.resolve(filename), useLabel);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   125
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   126
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   130
     * Get link to previous class.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   131
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   132
     * @return a content tree for the previous class link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   134
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   135
    public Content getNavLinkPrevious() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   136
        Content li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   137
        if (prev != null) {
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   138
            Content prevLink = getLink(new LinkInfoImpl(configuration,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   139
                    LinkInfoImpl.Kind.CLASS, utils.asTypeElement(prev))
19907
41ae54351dea 8023700: Use non breaking space in various labels
jjg
parents: 19667
diff changeset
   140
                    .label(prevclassLabel).strong(true));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   141
            li = HtmlTree.LI(prevLink);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   142
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   143
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   144
            li = HtmlTree.LI(prevclassLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   145
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   149
     * Get link to next class.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   150
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   151
     * @return a content tree for the next class link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   153
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   154
    public Content getNavLinkNext() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   155
        Content li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   156
        if (next != null) {
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   157
            Content nextLink = getLink(new LinkInfoImpl(configuration,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   158
                    LinkInfoImpl.Kind.CLASS, utils.asTypeElement(next))
19907
41ae54351dea 8023700: Use non breaking space in various labels
jjg
parents: 19667
diff changeset
   159
                    .label(nextclassLabel).strong(true));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   160
            li = HtmlTree.LI(nextLink);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   162
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   163
            li = HtmlTree.LI(nextclassLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   164
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   170
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   171
    public Content getHeader(String header) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   172
        HtmlTree bodyTree = getBody(true, getWindowTitle(utils.getSimpleName(annotationType)));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   173
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   174
                ? HtmlTree.HEADER()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   175
                : bodyTree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   176
        addTop(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   177
        addNavLinks(true, htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   178
        if (configuration.allowTag(HtmlTag.HEADER)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   179
            bodyTree.addContent(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   180
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   181
        bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   182
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   183
        div.addStyle(HtmlStyle.header);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   184
        PackageElement pkg = utils.containingPackage(annotationType);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   185
        if (!pkg.isUnnamed()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   186
            Content pkgNameContent = new StringContent(utils.getPackageName(pkg));
9068
6697b4cbba1d 7010342: End tag for element P is not open for few html files generated using new javadoc
bpatel
parents: 7681
diff changeset
   187
            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
6697b4cbba1d 7010342: End tag for element P is not open for few html files generated using new javadoc
bpatel
parents: 7681
diff changeset
   188
            div.addContent(pkgNameDiv);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   189
        }
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
   190
        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17559
diff changeset
   191
                LinkInfoImpl.Kind.CLASS_HEADER, annotationType);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   192
        Content headerContent = new StringContent(header);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   193
        Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING, true,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   194
                HtmlStyle.title, headerContent);
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   195
        heading.addContent(getTypeParameterLinks(linkInfo));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   196
        div.addContent(heading);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   197
        if (configuration.allowTag(HtmlTag.MAIN)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   198
            mainTree.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   199
        } else {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   200
            bodyTree.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   201
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   202
        return bodyTree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   203
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   205
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   206
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   207
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   208
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   209
    public Content getAnnotationContentHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   210
        return getContentHeader();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   211
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   212
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   213
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   214
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   215
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   216
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   217
    public void addFooter(Content contentTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   218
        contentTree.addContent(HtmlConstants.END_OF_CLASS_DATA);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   219
        Content htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   220
                ? HtmlTree.FOOTER()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   221
                : contentTree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   222
        addNavLinks(false, htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   223
        addBottom(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   224
        if (configuration.allowTag(HtmlTag.FOOTER)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   225
            contentTree.addContent(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   226
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   232
    @Override
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14260
diff changeset
   233
    public void printDocument(Content contentTree) throws IOException {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   234
        printHtmlDocument(configuration.metakeywords.getMetaKeywords(annotationType),
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   235
                true, contentTree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   236
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   237
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   238
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   239
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   240
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   241
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   242
    public Content getAnnotationInfoTreeHeader() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   243
        return getMemberTreeHeader();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   244
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   245
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   246
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   247
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   248
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   249
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   250
    public Content getAnnotationInfo(Content annotationInfoTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   251
        return getMemberTree(HtmlStyle.description, annotationInfoTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   257
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   258
    public void addAnnotationTypeSignature(String modifiers, Content annotationInfoTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   259
        annotationInfoTree.addContent(new HtmlTree(HtmlTag.BR));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   260
        Content pre = new HtmlTree(HtmlTag.PRE);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   261
        addAnnotationInfo(annotationType, pre);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   262
        pre.addContent(modifiers);
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
   263
        LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17559
diff changeset
   264
                LinkInfoImpl.Kind.CLASS_SIGNATURE, annotationType);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   265
        Content annotationName = new StringContent(utils.getSimpleName(annotationType));
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   266
        Content parameterLinks = getTypeParameterLinks(linkInfo);
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
   267
        if (configuration.linksource) {
9083
63f3c4d2d992 7010344: Some of the html files do not have element <a> in right context.
bpatel
parents: 9068
diff changeset
   268
            addSrcLink(annotationType, annotationName, pre);
63f3c4d2d992 7010344: Some of the html files do not have element <a> in right context.
bpatel
parents: 9068
diff changeset
   269
            pre.addContent(parameterLinks);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
        } else {
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 20237
diff changeset
   271
            Content span = HtmlTree.SPAN(HtmlStyle.memberNameLabel, annotationName);
9083
63f3c4d2d992 7010344: Some of the html files do not have element <a> in right context.
bpatel
parents: 9068
diff changeset
   272
            span.addContent(parameterLinks);
63f3c4d2d992 7010344: Some of the html files do not have element <a> in right context.
bpatel
parents: 9068
diff changeset
   273
            pre.addContent(span);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   275
        annotationInfoTree.addContent(pre);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   281
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   282
    public void addAnnotationTypeDescription(Content annotationInfoTree) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
        if(!configuration.nocomment) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   284
            if (!utils.getBody(annotationType).isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   285
                addInlineComment(annotationType, annotationInfoTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   293
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   294
    public void addAnnotationTypeTagInfo(Content annotationInfoTree) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
        if(!configuration.nocomment) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   296
            addTagsInfo(annotationType, annotationInfoTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   303
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   304
    public void addAnnotationTypeDeprecationInfo(Content annotationInfoTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   305
        Content hr = new HtmlTree(HtmlTag.HR);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   306
        annotationInfoTree.addContent(hr);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   307
        List<? extends DocTree> deprs = utils.getBlockTags(annotationType, DocTree.Kind.DEPRECATED);
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 21478
diff changeset
   308
        if (utils.isDeprecated(annotationType)) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   309
            CommentHelper ch = utils.getCommentHelper(annotationType);
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 20237
diff changeset
   310
            Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 20237
diff changeset
   311
            Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   312
            if (!deprs.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   313
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   314
                List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   315
                if (!commentTags.isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   316
                    div.addContent(getSpace());
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   317
                    addInlineDeprecatedComment(annotationType, deprs.get(0), div);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   320
            annotationInfoTree.addContent(div);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   324
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   325
     * {@inheritDoc}
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   326
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   327
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   328
    protected Content getNavLinkTree() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14265
diff changeset
   329
        Content treeLinkContent = getHyperLink(DocPaths.PACKAGE_TREE,
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   330
                treeLabel, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   331
        Content li = HtmlTree.LI(treeLinkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   332
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   333
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   334
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   335
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   336
     * Add summary details to the navigation bar.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   337
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   338
     * @param subDiv the content tree to which the summary detail links will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   339
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   340
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   341
    protected void addSummaryDetailLinks(Content subDiv) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
        try {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   343
            Content div = HtmlTree.DIV(getNavSummaryLinks());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   344
            div.addContent(getNavDetailLinks());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   345
            subDiv.addContent(div);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
        } catch (Exception e) {
19667
fdfce85627a9 8001669: javadoc internal DocletAbortException should set cause when appropriate
jjg
parents: 19253
diff changeset
   347
            throw new DocletAbortException(e);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
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
     * Get summary links for navigation bar.
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
     * @return the content tree for the navigation summary links
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   355
     * @throws java.lang.Exception
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   356
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   357
    protected Content getNavSummaryLinks() throws Exception {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   358
        Content li = HtmlTree.LI(summaryLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   359
        li.addContent(getSpace());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   360
        Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
        MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   362
                configuration.getBuilderFactory().getMemberSummaryBuilder(this);
20237
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   363
        Content liNavField = new HtmlTree(HtmlTag.LI);
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   364
        addNavSummaryLink(memberSummaryBuilder,
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   365
                "doclet.navField",
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   366
                VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS, liNavField);
20237
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   367
        addNavGap(liNavField);
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   368
        ulNav.addContent(liNavField);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   369
        Content liNavReq = new HtmlTree(HtmlTag.LI);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   370
        addNavSummaryLink(memberSummaryBuilder,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   371
                "doclet.navAnnotationTypeRequiredMember",
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   372
                VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED, liNavReq);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   373
        addNavGap(liNavReq);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   374
        ulNav.addContent(liNavReq);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   375
        Content liNavOpt = new HtmlTree(HtmlTag.LI);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   376
        addNavSummaryLink(memberSummaryBuilder,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   377
                "doclet.navAnnotationTypeOptionalMember",
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   378
                VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL, liNavOpt);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   379
        ulNav.addContent(liNavOpt);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   380
        return ulNav;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   383
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   384
     * Add the navigation summary link.
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
     * @param builder builder for the member to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   387
     * @param label the label for the navigation
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   388
     * @param type type to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   389
     * @param liNav the content tree to which the navigation summary link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   390
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   391
    protected void addNavSummaryLink(MemberSummaryBuilder builder,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   392
            String label, VisibleMemberMap.Kind type, Content liNav) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
        AbstractMemberWriter writer = ((AbstractMemberWriter) builder.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   394
                getMemberSummaryWriter(type));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
        if (writer == null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   396
            liNav.addContent(getResource(label));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
        } else {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   398
            liNav.addContent(writer.getNavSummaryLink(null,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   399
                    ! builder.getVisibleMemberMap(type).noVisibleMembers()));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   404
     * Get detail links for the navigation bar.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   406
     * @return the content tree for the detail links
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   407
     * @throws java.lang.Exception
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   409
    protected Content getNavDetailLinks() throws Exception {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   410
        Content li = HtmlTree.LI(detailLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   411
        li.addContent(getSpace());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   412
        Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
        MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder)
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   414
                configuration.getBuilderFactory().getMemberSummaryBuilder(this);
20237
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   415
        AbstractMemberWriter writerField =
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   416
                ((AbstractMemberWriter) memberSummaryBuilder.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   417
                getMemberSummaryWriter(VisibleMemberMap.Kind.ANNOTATION_TYPE_FIELDS));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   418
        AbstractMemberWriter writerOptional =
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   419
                ((AbstractMemberWriter) memberSummaryBuilder.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   420
                getMemberSummaryWriter(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   421
        AbstractMemberWriter writerRequired =
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   422
                ((AbstractMemberWriter) memberSummaryBuilder.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   423
                getMemberSummaryWriter(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED));
20237
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   424
        Content liNavField = new HtmlTree(HtmlTag.LI);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   425
        if (writerField != null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   426
            writerField.addNavDetailLink(!utils.getAnnotationFields(annotationType).isEmpty(), liNavField);
20237
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   427
        } else {
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   428
            liNavField.addContent(getResource("doclet.navField"));
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   429
        }
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   430
        addNavGap(liNavField);
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19907
diff changeset
   431
        ulNav.addContent(liNavField);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
        if (writerOptional != null){
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   433
            Content liNavOpt = new HtmlTree(HtmlTag.LI);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   434
            writerOptional.addNavDetailLink(!annotationType.getAnnotationMirrors().isEmpty(), liNavOpt);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   435
            ulNav.addContent(liNavOpt);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
        } else if (writerRequired != null){
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   437
            Content liNavReq = new HtmlTree(HtmlTag.LI);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   438
            writerRequired.addNavDetailLink(!annotationType.getAnnotationMirrors().isEmpty(), liNavReq);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   439
            ulNav.addContent(liNavReq);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   440
        } else {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   441
            Content liNav = HtmlTree.LI(getResource("doclet.navAnnotationTypeMember"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   442
            ulNav.addContent(liNav);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   443
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   444
        return ulNav;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
06bc494ca11e Initial load
duke
parents:
diff changeset
   447
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   448
     * Add gap between navigation bar elements.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   449
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   450
     * @param liNav the content tree to which the gap will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   452
    protected void addNavGap(Content liNav) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   453
        liNav.addContent(getSpace());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   454
        liNav.addContent("|");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   455
        liNav.addContent(getSpace());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
06bc494ca11e Initial load
duke
parents:
diff changeset
   458
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   459
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   461
    @Override
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   462
    public TypeElement getAnnotationTypeElement() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   463
        return annotationType;
06bc494ca11e Initial load
duke
parents:
diff changeset
   464
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   465
}