src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
author ksrini
Tue, 24 Apr 2018 11:54:03 -0700
changeset 49879 601277b1d582
parent 49551 0d4786e42471
child 52644 43efb4ca6d6c
permissions -rw-r--r--
8025091: VisibleMemberMap.java possible performance improvements 8198890: The standard doclet incorrectly produces wrong method signatures in certain cases. Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 47850
diff changeset
     2
 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2320
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    26
package jdk.javadoc.internal.doclets.formats.html;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    27
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
    28
import jdk.javadoc.internal.doclets.formats.html.markup.Table;
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
    29
import jdk.javadoc.internal.doclets.formats.html.markup.TableHeader;
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
    30
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    31
import java.util.*;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    32
import java.util.stream.Collectors;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    34
import javax.lang.model.element.Element;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    35
import javax.lang.model.element.ExecutableElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    36
import javax.lang.model.element.Modifier;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    37
import javax.lang.model.element.TypeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    38
import javax.lang.model.element.TypeParameterElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    39
import javax.lang.model.type.TypeMirror;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 7681
diff changeset
    40
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    41
import com.sun.source.doctree.DocTree;
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
    42
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    43
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
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;
47850
4a28dc8a86c2 8190821: Introduce a new Links builder class
jjg
parents: 47847
diff changeset
    47
import jdk.javadoc.internal.doclets.formats.html.markup.Links;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    48
import jdk.javadoc.internal.doclets.formats.html.markup.StringContent;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    49
import jdk.javadoc.internal.doclets.toolkit.Content;
47450
d3e20c816f60 8189843: Missing \"id\" attributes in table rows
jjg
parents: 47427
diff changeset
    50
import jdk.javadoc.internal.doclets.toolkit.MemberSummaryWriter;
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
    51
import jdk.javadoc.internal.doclets.toolkit.Resources;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    52
import jdk.javadoc.internal.doclets.toolkit.taglets.DeprecatedTaglet;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    53
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    54
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    55
import static javax.lang.model.element.Modifier.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 * The base class for member writers.
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    60
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    61
 *  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: 14259
diff changeset
    62
 *  This code and its internal interfaces are subject to change or
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    63
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    64
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
 * @author Robert Field
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
 * @author Jamie Ho (Re-write)
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1789
diff changeset
    68
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
 */
47450
d3e20c816f60 8189843: Missing \"id\" attributes in table rows
jjg
parents: 47427
diff changeset
    70
public abstract class AbstractMemberWriter implements MemberSummaryWriter {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 42831
diff changeset
    72
    protected final HtmlConfiguration configuration;
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 22163
diff changeset
    73
    protected final Utils utils;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    protected final SubWriterHolderWriter writer;
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
    75
    protected final Contents contents;
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
    76
    protected final Resources resources;
47850
4a28dc8a86c2 8190821: Introduce a new Links builder class
jjg
parents: 47847
diff changeset
    77
    protected final Links links;
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
    78
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    79
    protected final TypeElement typeElement;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    public final boolean nodepr;
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14266
diff changeset
    82
    protected boolean printedSummaryHeader = false;
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14266
diff changeset
    83
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    84
    public AbstractMemberWriter(SubWriterHolderWriter writer, TypeElement typeElement) {
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14266
diff changeset
    85
        this.configuration = writer.configuration;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
        this.writer = writer;
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14266
diff changeset
    87
        this.nodepr = configuration.nodeprecated;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    88
        this.typeElement = typeElement;
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
    89
        this.utils = configuration.utils;
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
    90
        this.contents = configuration.contents;
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
    91
        this.resources = configuration.resources;
48654
36f58bd6269f 8195796: Reduce the size of relative URLs in generated docs
jjg
parents: 47850
diff changeset
    92
        this.links = writer.links;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    public AbstractMemberWriter(SubWriterHolderWriter writer) {
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
        this(writer, null);
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
    /*** abstracts ***/
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   101
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   102
     * Add the summary label for the member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   103
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   104
     * @param memberTree the content tree to which the label will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   105
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   106
    public abstract void addSummaryLabel(Content memberTree);
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2216
diff changeset
   107
7614
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
     * Get the summary for the member summary table.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   110
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   111
     * @return a string for the table summary
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   112
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   113
    private String getTableSummaryX() { return null; }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
7614
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
     * Get the summary table header for the member.
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
     * @param member the member to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   119
     * @return the summary table header
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   120
     */
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47272
diff changeset
   121
    public abstract TableHeader getSummaryTableHeader(Element member);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   123
    private Table summaryTable;
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   124
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   125
    private Table getSummaryTable() {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   126
        if (summaryTable == null) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   127
            summaryTable = createSummaryTable();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   128
        }
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   129
        return summaryTable;
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   130
    }
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   131
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   132
    /**
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   133
     * Create the summary table for this element.
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   134
     * The table should be created and initialized if needed, and configured
49879
601277b1d582 8025091: VisibleMemberMap.java possible performance improvements
ksrini
parents: 49551
diff changeset
   135
     * so that it is ready to add content with {@link Table#addRow(Content[])}
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   136
     * and similar methods.
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   137
     *
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   138
     * @return the summary table
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   139
     */
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   140
    protected abstract Table createSummaryTable();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   141
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   142
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   143
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   144
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   145
     * Add inherited summary label for the member.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   146
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   147
     * @param typeElement the TypeElement to which to link to
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   148
     * @param inheritedTree the content tree to which the inherited summary label will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   149
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   150
    public abstract void addInheritedSummaryLabel(TypeElement typeElement, Content inheritedTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   152
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   153
     * Add the anchor for the summary section of the member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   154
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   155
     * @param typeElement the TypeElement to be documented
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   156
     * @param memberTree the content tree to which the summary anchor will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   157
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   158
    public abstract void addSummaryAnchor(TypeElement typeElement, Content memberTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   160
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   161
     * Add the anchor for the inherited summary section of the member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   162
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   163
     * @param typeElement the TypeElement to be documented
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   164
     * @param inheritedTree the content tree to which the inherited summary anchor will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   165
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   166
    public abstract void addInheritedSummaryAnchor(TypeElement typeElement, Content inheritedTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   168
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   169
     * Add the summary type for the member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   170
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   171
     * @param member the member to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   172
     * @param tdSummaryType the content tree to which the type will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   173
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   174
    protected abstract void addSummaryType(Element member, Content tdSummaryType);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   175
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   176
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   177
     * Add the summary link for the member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   178
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   179
     * @param typeElement the TypeElement to be documented
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   180
     * @param member the member to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   181
     * @param tdSummary the content tree to which the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   182
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   183
    protected void addSummaryLink(TypeElement typeElement, Element member, Content tdSummary) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   184
        addSummaryLink(LinkInfoImpl.Kind.MEMBER, typeElement, member, tdSummary);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   187
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   188
     * Add the summary link for the member.
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
     * @param context the id of the context where the link will be printed
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   191
     * @param typeElement the TypeElement to be documented
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   192
     * @param member the member to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   193
     * @param tdSummary the content tree to which the summary link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   194
     */
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 15034
diff changeset
   195
    protected abstract void addSummaryLink(LinkInfoImpl.Kind context,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   196
            TypeElement typeElement, Element member, Content tdSummary);
7614
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
     * Add the inherited summary link for the member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   200
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   201
     * @param typeElement the TypeElement to be documented
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   202
     * @param member the member to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   203
     * @param linksTree the content tree to which the inherited summary link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   204
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   205
    protected abstract void addInheritedSummaryLink(TypeElement typeElement,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   206
            Element member, Content linksTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   208
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   209
     * Get the deprecated link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   210
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   211
     * @param member the member being linked to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   212
     * @return a content tree representing the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   213
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   214
    protected abstract Content getDeprecatedLink(Element member);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   216
    /**
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17560
diff changeset
   217
     * Add the member name to the content tree.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   218
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   219
     * @param name the member name to be added to the content tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   220
     * @param htmltree the content tree to which the name will be added.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   221
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   222
    protected void addName(String name, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   223
        htmltree.addContent(name);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   224
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   225
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   226
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   227
     * Add the modifier for the member. The modifiers are ordered as specified
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   228
     * by <em>The Java Language Specification</em>.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   229
     *
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   230
     * @param member the member for which the modifier will be added.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   231
     * @param htmltree the content tree to which the modifier information will be added.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   232
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   233
    protected void addModifiers(Element member, Content htmltree) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   234
        Set<Modifier> set = new TreeSet<>(member.getModifiers());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   235
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   236
        // remove the ones we really don't need
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   237
        set.remove(NATIVE);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   238
        set.remove(SYNCHRONIZED);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   239
        set.remove(STRICTFP);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   240
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
        // According to JLS, we should not be showing public modifier for
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
        // interface methods.
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   243
        if ((utils.isField(member) || utils.isMethod(member))
36038
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
   244
            && ((writer instanceof ClassWriterImpl
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
   245
                 && utils.isInterface(((ClassWriterImpl) writer).getTypeElement())  ||
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
   246
                 writer instanceof AnnotationTypeWriterImpl) )) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   247
            // Remove the implicit abstract and public modifiers
36038
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
   248
            if (utils.isMethod(member) &&
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
   249
                (utils.isInterface(member.getEnclosingElement()) ||
39c5445924b9 6469561: javadoc for annotation types should not display "public abstract" modifiers on methods
darcy
parents: 35426
diff changeset
   250
                 utils.isAnnotationType(member.getEnclosingElement()))) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   251
                set.remove(ABSTRACT);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   252
                set.remove(PUBLIC);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   253
            }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   254
            if (!utils.isMethod(member)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   255
                set.remove(PUBLIC);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   256
            }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   258
        if (!set.isEmpty()) {
42827
36468b5fa7f4 8181370: Convert anonymous inner classes into lambdas/method references
mcimadamore
parents: 42816
diff changeset
   259
            String mods = set.stream().map(Modifier::toString).collect(Collectors.joining(" "));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   260
            htmltree.addContent(mods);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   261
            htmltree.addContent(Contents.SPACE);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
   265
    protected CharSequence makeSpace(int len) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
        if (len <= 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   267
            return "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
        }
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14260
diff changeset
   269
        StringBuilder sb = new StringBuilder(len);
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17560
diff changeset
   270
        for (int i = 0; i < len; i++) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
            sb.append(' ');
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   272
        }
36500
d31e4986dc8b 8149139: [javadoc] Modify Content to accept CharSequence
ksrini
parents: 36038
diff changeset
   273
        return sb;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   277
     * Add the modifier and type for the member in the member summary.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   278
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   279
     * @param member the member to add the type for
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   280
     * @param type the type to add
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   281
     * @param tdSummaryType the content tree to which the modified and type will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   283
    protected void addModifierAndType(Element member, TypeMirror type,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   284
            Content tdSummaryType) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   285
        HtmlTree code = new HtmlTree(HtmlTag.CODE);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   286
        addModifier(member, code);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
        if (type == null) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   288
            code.addContent(utils.isClass(member) ? "class" : "interface");
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   289
            code.addContent(Contents.SPACE);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
        } else {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   291
            List<? extends TypeParameterElement> list = utils.isExecutableElement(member)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   292
                    ? ((ExecutableElement)member).getTypeParameters()
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   293
                    : null;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   294
            if (list != null && !list.isEmpty()) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   295
                Content typeParameters = ((AbstractExecutableMemberWriter) this)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   296
                        .getTypeParameters((ExecutableElement)member);
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17560
diff changeset
   297
                    code.addContent(typeParameters);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
                //Code to avoid ugly wrapping in member summary table.
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17560
diff changeset
   299
                if (typeParameters.charCount() > 10) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   300
                    code.addContent(new HtmlTree(HtmlTag.BR));
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17560
diff changeset
   301
                } else {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   302
                    code.addContent(Contents.SPACE);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
                }
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   304
                code.addContent(
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14266
diff changeset
   305
                        writer.getLink(new LinkInfoImpl(configuration,
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   306
                        LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
            } else {
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   308
                code.addContent(
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14266
diff changeset
   309
                        writer.getLink(new LinkInfoImpl(configuration,
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   310
                        LinkInfoImpl.Kind.SUMMARY_RETURN_TYPE, type)));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   314
        tdSummaryType.addContent(code);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1789
diff changeset
   317
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   318
     * Add the modifier for the member.
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
     * @param member the member to add the type for
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   321
     * @param code the content tree to which the modified will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   322
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   323
    private void addModifier(Element member, Content code) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   324
        if (utils.isProtected(member)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   325
            code.addContent("protected ");
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   326
        } else if (utils.isPrivate(member)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   327
            code.addContent("private ");
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   328
        } else if (!utils.isPublic(member)) { // Package private
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14266
diff changeset
   329
            code.addContent(configuration.getText("doclet.Package_private"));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   330
            code.addContent(" ");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   331
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   332
        boolean isAnnotatedTypeElement = utils.isAnnotationType(member.getEnclosingElement());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   333
        if (!isAnnotatedTypeElement && utils.isMethod(member)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   334
            if (!utils.isInterface(member.getEnclosingElement()) && utils.isAbstract(member)) {
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14549
diff changeset
   335
                code.addContent("abstract ");
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14549
diff changeset
   336
            }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   337
            if (utils.isDefault(member)) {
14965
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14549
diff changeset
   338
                code.addContent("default ");
bb1eb01b8c41 8004893: the javadoc/doclet needs to be updated to accommodate lambda changes
bpatel
parents: 14549
diff changeset
   339
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   340
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   341
        if (utils.isStatic(member)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   342
            code.addContent("static ");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   343
        }
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
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
     * Add the deprecated information for the given member.
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1789
diff changeset
   348
     *
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1789
diff changeset
   349
     * @param member the member being documented.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   350
     * @param contentTree the content tree to which the deprecated information will be added.
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1789
diff changeset
   351
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   352
    protected void addDeprecatedInfo(Element member, Content contentTree) {
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17570
diff changeset
   353
        Content output = (new DeprecatedTaglet()).getTagletOutput(member,
17567
56e83a873757 8012176: reduce use of TagletOutputImpl.toString
jjg
parents: 17564
diff changeset
   354
            writer.getTagletWriterInstance(false));
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17570
diff changeset
   355
        if (!output.isEmpty()) {
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17570
diff changeset
   356
            Content deprecatedContent = output;
47272
e0d686cdf608 8183511: improve style for deprecated text
bpatel
parents: 47216
diff changeset
   357
            Content div = HtmlTree.DIV(HtmlStyle.deprecationBlock, deprecatedContent);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   358
            contentTree.addContent(div);
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1789
diff changeset
   359
        }
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1789
diff changeset
   360
    }
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 1789
diff changeset
   361
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   362
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   363
     * Add the comment for the given member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   364
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   365
     * @param member the member being documented.
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
   366
     * @param htmltree the content tree to which the comment will be added.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   367
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   368
    protected void addComment(Element member, Content htmltree) {
41452
ddaef4bba083 8165991: Fix DocTreeFactory newDocCommentTree
ksrini
parents: 41157
diff changeset
   369
        if (!utils.getFullBody(member).isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   370
            writer.addInlineComment(member, htmltree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   374
    protected String name(Element member) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   375
        return utils.getSimpleName(member);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   378
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   379
     * Get the header for the section.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   380
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   381
     * @param member the member being documented.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   382
     * @return a header content for the section.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   383
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   384
    protected Content getHead(Element member) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   385
        Content memberContent = new StringContent(name(member));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   386
        Content heading = HtmlTree.HEADING(HtmlConstants.MEMBER_HEADING, memberContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   387
        return heading;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
    * Return true if the given <code>ProgramElement</code> is inherited
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
    * by the class that is being documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
    *
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
    * @param ped The <code>ProgramElement</code> being checked.
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
    * return true if the <code>ProgramElement</code> is being inherited and
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
    * false otherwise.
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   397
     *@return true if inherited
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
    */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   399
    protected boolean isInherited(Element ped){
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   400
        return (!utils.isPrivate(ped) &&
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   401
                (!utils.isPackagePrivate(ped) ||
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   402
                    ped.getEnclosingElement().equals(ped.getEnclosingElement())));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   406
     * Add use information to the documentation tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   407
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   408
     * @param mems list of program elements for which the use information will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   409
     * @param heading the section heading
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   410
     * @param tableSummary the summary for the use table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   411
     * @param contentTree the content tree to which the use information will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
     */
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   413
    protected void addUseInfo(List<? extends Element> mems,
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17567
diff changeset
   414
            Content heading, String tableSummary, Content contentTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   415
        if (mems == null || mems.isEmpty()) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   418
        List<? extends Element> members = mems;
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2216
diff changeset
   419
        boolean printedUseTableHeader = false;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   420
        if (members.size() > 0) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   421
            Table useTable = new Table(configuration.htmlVersion, HtmlStyle.useSummary)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   422
                    .setSummary(tableSummary)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   423
                    .setCaption(heading)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   424
                    .setRowScopeColumn(1)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   425
                    .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colSecond, HtmlStyle.colLast);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   426
            for (Element element : members) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   427
                TypeElement te = (typeElement == null)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   428
                        ? utils.getEnclosingTypeElement(element)
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   429
                        : typeElement;
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2216
diff changeset
   430
                if (!printedUseTableHeader) {
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   431
                    useTable.setHeader(getSummaryTableHeader(element));
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2216
diff changeset
   432
                    printedUseTableHeader = true;
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2216
diff changeset
   433
                }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   434
                Content summaryType = new ContentBuilder();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   435
                addSummaryType(element, summaryType);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   436
                Content typeContent = new ContentBuilder();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   437
                if (te != null
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   438
                        && !utils.isConstructor(element)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   439
                        && !utils.isClass(element)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   440
                        && !utils.isInterface(element)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   441
                        && !utils.isAnnotationType(element)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   442
                    HtmlTree name = new HtmlTree(HtmlTag.SPAN);
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   443
                    name.setStyle(HtmlStyle.typeNameLabel);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   444
                    name.addContent(name(te) + ".");
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   445
                    typeContent.addContent(name);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   446
                }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   447
                addSummaryLink(utils.isClass(element) || utils.isInterface(element)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   448
                        ? LinkInfoImpl.Kind.CLASS_USE
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   449
                        : LinkInfoImpl.Kind.MEMBER,
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   450
                        te, element, typeContent);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   451
                Content desc = new ContentBuilder();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   452
                writer.addSummaryLinkComment(this, element, desc);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   453
                useTable.addRow(summaryType, typeContent, desc);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
            }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   455
            contentTree.addContent(useTable.toContent());
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
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   459
    protected void serialWarning(Element e, String key, String a1, String a2) {
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14266
diff changeset
   460
        if (configuration.serialwarn) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 36500
diff changeset
   461
            configuration.messages.warning(e, key, a1, a2);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   462
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   463
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   464
06bc494ca11e Initial load
duke
parents:
diff changeset
   465
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   466
     * Add the member summary for the given class.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   467
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   468
     * @param tElement the class that is being documented
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   469
     * @param member the member being documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   470
     * @param firstSentenceTags the first sentence tags to be added to the summary
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   471
     */
47850
4a28dc8a86c2 8190821: Introduce a new Links builder class
jjg
parents: 47847
diff changeset
   472
    @Override
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   473
    public void addMemberSummary(TypeElement tElement, Element member,
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   474
            List<? extends DocTree> firstSentenceTags) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   475
        if (tElement != typeElement) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   476
            throw new IllegalStateException();
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
   477
        }
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   478
        Table table = getSummaryTable();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   479
        List<Content> rowContents = new ArrayList<>();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   480
        Content summaryType = new ContentBuilder();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   481
        addSummaryType(member, summaryType);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   482
        if (!summaryType.isEmpty())
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   483
            rowContents.add(summaryType);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   484
        Content summaryLink = new ContentBuilder();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   485
        addSummaryLink(tElement, member, summaryLink);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   486
        rowContents.add(summaryLink);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   487
        Content desc = new ContentBuilder();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   488
        writer.addSummaryLinkComment(this, member, firstSentenceTags, desc);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   489
        rowContents.add(desc);
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   490
        table.addRow(member, rowContents);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   491
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   492
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   493
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   494
     * Add inherited member summary for the given class and member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   495
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   496
     * @param tElement the class the inherited member belongs to
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   497
     * @param nestedClass the inherited member that is summarized
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   498
     * @param isFirst true if this is the first member in the list
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   499
     * @param isLast true if this is the last member in the list
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   500
     * @param linksTree the content tree to which the summary will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   501
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   502
    @Override
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   503
    public void addInheritedMemberSummary(TypeElement tElement,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   504
            Element nestedClass, boolean isFirst, boolean isLast,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   505
            Content linksTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   506
        writer.addInheritedMemberSummary(this, tElement, nestedClass, isFirst,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   507
                linksTree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   508
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   509
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   510
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   511
     * Get the inherited summary header for the given class.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   512
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   513
     * @param tElement the class the inherited member belongs to
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   514
     * @return a content tree for the inherited summary header
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   515
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   516
    @Override
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   517
    public Content getInheritedSummaryHeader(TypeElement tElement) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   518
        Content inheritedTree = writer.getMemberTreeHeader();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   519
        writer.addInheritedSummaryHeader(this, tElement, inheritedTree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   520
        return inheritedTree;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   521
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   522
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   523
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   524
     * Get the inherited summary links tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   525
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   526
     * @return a content tree for the inherited summary links
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   527
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   528
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   529
    public Content getInheritedSummaryLinksTree() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   530
        return new HtmlTree(HtmlTag.CODE);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   531
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   532
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   533
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   534
     * Get the summary table tree for the given class.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   535
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   536
     * @param tElement the class for which the summary table is generated
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   537
     * @return a content tree for the summary table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   538
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   539
    @Override
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   540
    public Content getSummaryTableTree(TypeElement tElement) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   541
        if (tElement != typeElement) {
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   542
            throw new IllegalStateException();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   543
        }
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   544
        Table table = getSummaryTable();
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   545
        if (table.needsScript()) {
47847
7640bc1eb94f 8190818: Introduce a new Script builder class
jjg
parents: 47846
diff changeset
   546
            writer.getMainBodyScript().append(table.getScript());
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   547
        }
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   548
        return table.toContent();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   549
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   550
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   551
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   552
     * Get the member tree to be documented.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   553
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   554
     * @param memberTree the content tree of member to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   555
     * @return a content tree that will be added to the class documentation
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   556
     */
47846
4e78aba768f0 8190295: Introduce a new Table builder class
jjg
parents: 47450
diff changeset
   557
    @Override
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   558
    public Content getMemberTree(Content memberTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   559
        return writer.getMemberTree(memberTree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   560
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   561
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   562
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   563
     * Get the member tree to be documented.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   564
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   565
     * @param memberTree the content tree of member to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   566
     * @param isLastContent true if the content to be added is the last content
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   567
     * @return a content tree that will be added to the class documentation
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   568
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   569
    public Content getMemberTree(Content memberTree, boolean isLastContent) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   570
        if (isLastContent)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   571
            return HtmlTree.UL(HtmlStyle.blockListLast, memberTree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   572
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   573
            return HtmlTree.UL(HtmlStyle.blockList, memberTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   574
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   575
}