src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java
author jjg
Fri, 20 Oct 2017 11:08:18 -0700
changeset 47427 251676148c62
parent 47216 71c04702a3d5
child 47846 4e78aba768f0
permissions -rw-r--r--
8189405: More cleanup in HtmlWriter Reviewed-by: bpatel, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 42277
diff changeset
     2
 * Copyright (c) 1998, 2017, 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;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
    28
import java.text.MessageFormat;
19512
07dcf1232608 8013887: In class use, some tables are randomly unsorted
jjg
parents: 17570
diff changeset
    29
import java.util.ArrayList;
07dcf1232608 8013887: In class use, some tables are randomly unsorted
jjg
parents: 17570
diff changeset
    30
import java.util.Collections;
07dcf1232608 8013887: In class use, some tables are randomly unsorted
jjg
parents: 17570
diff changeset
    31
import java.util.HashMap;
07dcf1232608 8013887: In class use, some tables are randomly unsorted
jjg
parents: 17570
diff changeset
    32
import java.util.List;
07dcf1232608 8013887: In class use, some tables are randomly unsorted
jjg
parents: 17570
diff changeset
    33
import java.util.Map;
07dcf1232608 8013887: In class use, some tables are randomly unsorted
jjg
parents: 17570
diff changeset
    34
import java.util.Set;
07dcf1232608 8013887: In class use, some tables are randomly unsorted
jjg
parents: 17570
diff changeset
    35
import java.util.SortedSet;
07dcf1232608 8013887: In class use, some tables are randomly unsorted
jjg
parents: 17570
diff changeset
    36
import java.util.TreeSet;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 14060
diff changeset
    37
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    38
import javax.lang.model.element.Element;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    39
import javax.lang.model.element.PackageElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    40
import javax.lang.model.element.TypeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    41
import javax.tools.Diagnostic;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    42
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    43
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    44
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    45
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    46
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    47
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
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;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    50
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    51
import jdk.javadoc.internal.doclets.toolkit.util.ClassUseMapper;
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
    52
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    53
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    54
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41157
diff changeset
    56
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 * Generate class usage information.
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    60
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
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: 14258
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: 14258
diff changeset
    63
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    64
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
 * @author Robert G. Field
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1789
diff changeset
    66
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
public class ClassUseWriter extends SubWriterHolderWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    70
    final TypeElement typeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    71
    Set<PackageElement> pkgToPackageAnnotations = null;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    72
    final Map<PackageElement, List<Element>> pkgToClassTypeParameter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    73
    final Map<PackageElement, List<Element>> pkgToClassAnnotations;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    74
    final Map<PackageElement, List<Element>> pkgToMethodTypeParameter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    75
    final Map<PackageElement, List<Element>> pkgToMethodArgTypeParameter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    76
    final Map<PackageElement, List<Element>> pkgToMethodReturnTypeParameter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    77
    final Map<PackageElement, List<Element>> pkgToMethodAnnotations;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    78
    final Map<PackageElement, List<Element>> pkgToMethodParameterAnnotations;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    79
    final Map<PackageElement, List<Element>> pkgToFieldTypeParameter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    80
    final Map<PackageElement, List<Element>> pkgToFieldAnnotations;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    81
    final Map<PackageElement, List<Element>> pkgToSubclass;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    82
    final Map<PackageElement, List<Element>> pkgToSubinterface;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    83
    final Map<PackageElement, List<Element>> pkgToImplementingClass;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    84
    final Map<PackageElement, List<Element>> pkgToField;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    85
    final Map<PackageElement, List<Element>> pkgToMethodReturn;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    86
    final Map<PackageElement, List<Element>> pkgToMethodArgs;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    87
    final Map<PackageElement, List<Element>> pkgToMethodThrows;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    88
    final Map<PackageElement, List<Element>> pkgToConstructorAnnotations;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    89
    final Map<PackageElement, List<Element>> pkgToConstructorParameterAnnotations;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    90
    final Map<PackageElement, List<Element>> pkgToConstructorArgs;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    91
    final Map<PackageElement, List<Element>> pkgToConstructorArgTypeParameter;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    92
    final Map<PackageElement, List<Element>> pkgToConstructorThrows;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
    93
    final SortedSet<PackageElement> pkgSet;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
    final MethodWriterImpl methodSubWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    final ConstructorWriterImpl constrSubWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
    final FieldWriterImpl fieldSubWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    final NestedClassWriterImpl classSubWriter;
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1789
diff changeset
    98
    // Summary for various use tables.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1789
diff changeset
    99
    final String classUseTableSummary;
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1789
diff changeset
   100
    final String subclassUseTableSummary;
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1789
diff changeset
   101
    final String subinterfaceUseTableSummary;
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1789
diff changeset
   102
    final String fieldUseTableSummary;
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1789
diff changeset
   103
    final String methodUseTableSummary;
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 1789
diff changeset
   104
    final String constructorUseTableSummary;
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   105
    final String packageUseTableSummary;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   108
     * The HTML tree for main tag.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   109
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   110
    protected HtmlTree mainTree = HtmlTree.MAIN();
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   111
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   112
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     * Constructor.
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     * @param filename the file to be generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 42277
diff changeset
   117
    public ClassUseWriter(HtmlConfiguration configuration,
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14260
diff changeset
   118
                          ClassUseMapper mapper, DocPath filename,
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   119
                          TypeElement typeElement) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14260
diff changeset
   120
        super(configuration, filename);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   121
        this.typeElement = typeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   122
        if (mapper.classToPackageAnnotations.containsKey(typeElement)) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   123
            pkgToPackageAnnotations = new TreeSet<>(utils.makeClassUseComparator());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   124
            pkgToPackageAnnotations.addAll(mapper.classToPackageAnnotations.get(typeElement));
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   125
        }
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   126
        configuration.currentTypeElement = typeElement;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   127
        this.pkgSet = new TreeSet<>(utils.makePackageComparator());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
        this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam);
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
        this.pkgToClassAnnotations = pkgDivide(mapper.classToClassAnnotations);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   130
        this.pkgToMethodTypeParameter = pkgDivide(mapper.classToMethodTypeParam);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   131
        this.pkgToMethodArgTypeParameter = pkgDivide(mapper.classToMethodArgTypeParam);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   132
        this.pkgToFieldTypeParameter = pkgDivide(mapper.classToFieldTypeParam);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   133
        this.pkgToFieldAnnotations = pkgDivide(mapper.annotationToField);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   134
        this.pkgToMethodReturnTypeParameter = pkgDivide(mapper.classToMethodReturnTypeParam);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   135
        this.pkgToMethodAnnotations = pkgDivide(mapper.classToMethodAnnotations);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   136
        this.pkgToMethodParameterAnnotations = pkgDivide(mapper.classToMethodParamAnnotation);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
        this.pkgToSubclass = pkgDivide(mapper.classToSubclass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
        this.pkgToSubinterface = pkgDivide(mapper.classToSubinterface);
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
        this.pkgToImplementingClass = pkgDivide(mapper.classToImplementingClass);
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
        this.pkgToField = pkgDivide(mapper.classToField);
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
        this.pkgToMethodReturn = pkgDivide(mapper.classToMethodReturn);
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
        this.pkgToMethodArgs = pkgDivide(mapper.classToMethodArgs);
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
        this.pkgToMethodThrows = pkgDivide(mapper.classToMethodThrows);
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
        this.pkgToConstructorAnnotations = pkgDivide(mapper.classToConstructorAnnotations);
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
        this.pkgToConstructorParameterAnnotations = pkgDivide(mapper.classToConstructorParamAnnotation);
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
        this.pkgToConstructorArgs = pkgDivide(mapper.classToConstructorArgs);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   147
        this.pkgToConstructorArgTypeParameter = pkgDivide(mapper.classToConstructorArgTypeParam);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
        this.pkgToConstructorThrows = pkgDivide(mapper.classToConstructorThrows);
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
        //tmp test
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
        if (pkgSet.size() > 0 &&
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   151
            mapper.classToPackage.containsKey(this.typeElement) &&
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   152
            !pkgSet.equals(mapper.classToPackage.get(this.typeElement))) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   153
            configuration.reporter.print(Diagnostic.Kind.WARNING,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   154
                    "Internal error: package sets don't match: "
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   155
                    + pkgSet + " with: " + mapper.classToPackage.get(this.typeElement));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
        }
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   157
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
        methodSubWriter = new MethodWriterImpl(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
        constrSubWriter = new ConstructorWriterImpl(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
        fieldSubWriter = new FieldWriterImpl(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        classSubWriter = new NestedClassWriterImpl(this);
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   162
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   163
        String useTableSummary = resources.getText("doclet.Use_Table_Summary");
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   164
        classUseTableSummary = MessageFormat.format(useTableSummary,
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   165
                resources.getText("doclet.classes"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   166
        subclassUseTableSummary = MessageFormat.format(useTableSummary,
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   167
                resources.getText("doclet.subclasses"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   168
        subinterfaceUseTableSummary = MessageFormat.format(useTableSummary,
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   169
                resources.getText("doclet.subinterfaces"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   170
        fieldUseTableSummary = MessageFormat.format(useTableSummary,
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   171
                resources.getText("doclet.fields"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   172
        methodUseTableSummary = MessageFormat.format(useTableSummary,
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   173
                resources.getText("doclet.methods"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   174
        constructorUseTableSummary = MessageFormat.format(useTableSummary,
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   175
                resources.getText("doclet.constructors"));
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   176
        packageUseTableSummary = MessageFormat.format(useTableSummary,
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   177
                resources.getText("doclet.packages"));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
     * Write out class use pages.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   182
     *
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   183
     * @param configuration the configuration for this doclet
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   184
     * @param classtree the class tree hierarchy
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   185
     * @throws DocFileIOException if there is an error while generating the documentation
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 42277
diff changeset
   187
    public static void generate(HtmlConfiguration configuration, ClassTree classtree) throws DocFileIOException  {
26270
a3635e6d3d78 8050031: [javadoc] class-use pages have duplicates and missing entries
ksrini
parents: 25874
diff changeset
   188
        ClassUseMapper mapper = new ClassUseMapper(configuration, classtree);
42277
2668b0bc7ad7 8164316: Refine the Doclet APIs
ksrini
parents: 41157
diff changeset
   189
        for (TypeElement aClass : configuration.getIncludedTypeElements()) {
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 8841
diff changeset
   190
            // If -nodeprecated option is set and the containing package is marked
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 8841
diff changeset
   191
            // as deprecated, do not generate the class-use page. We will still generate
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 8841
diff changeset
   192
            // the class-use page if the class is marked as deprecated but the containing
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 8841
diff changeset
   193
            // package is not since it could still be linked from that package-use page.
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 8841
diff changeset
   194
            if (!(configuration.nodeprecated &&
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   195
                  configuration.utils.isDeprecated(configuration.utils.containingPackage(aClass))))
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 20613
diff changeset
   196
                ClassUseWriter.generate(configuration, mapper, aClass);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
        }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   198
        for (PackageElement pkg : configuration.packages) {
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 8841
diff changeset
   199
            // If -nodeprecated option is set and the package is marked
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 8841
diff changeset
   200
            // as deprecated, do not generate the package-use page.
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24297
diff changeset
   201
            if (!(configuration.nodeprecated && configuration.utils.isDeprecated(pkg)))
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 20613
diff changeset
   202
                PackageUseWriter.generate(configuration, mapper, pkg);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   206
    private Map<PackageElement, List<Element>> pkgDivide(Map<TypeElement, ? extends List<? extends Element>> classMap) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   207
        Map<PackageElement, List<Element>> map = new HashMap<>();
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   208
        List<? extends Element> elements = (List<? extends Element>) classMap.get(typeElement);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   209
        if (elements != null) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   210
            Collections.sort(elements, utils.makeClassUseComparator());
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   211
            for (Element e : elements) {
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   212
                PackageElement pkg = utils.containingPackage(e);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
                pkgSet.add(pkg);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   214
                List<Element> inPkg = map.get(pkg);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
                if (inPkg == null) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   216
                    inPkg = new ArrayList<>();
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   217
                    map.put(pkg, inPkg);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
                }
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   219
                inPkg.add(e);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
        return map;
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
     * Generate a class page.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   227
     *
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   228
     * @throws DocFileIOException if there is a problem while generating the documentation
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
     */
45417
f7479ee8de69 8177848: Rename Configuration(Impl) classes
ksrini
parents: 42277
diff changeset
   230
    public static void generate(HtmlConfiguration configuration, ClassUseMapper mapper,
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   231
                                TypeElement typeElement) throws DocFileIOException {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
        ClassUseWriter clsgen;
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   233
        DocPath path = DocPath.forPackage(configuration.utils, typeElement)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   234
                              .resolve(DocPaths.CLASS_USE)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   235
                              .resolve(DocPath.forName(configuration.utils, typeElement));
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   236
        clsgen = new ClassUseWriter(configuration, mapper, path, typeElement);
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   237
        clsgen.generateClassUseFile();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   241
     * Generate the class use elements.
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   242
     *
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   243
     * @throws DocFileIOException if there is a problem while generating the documentation
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   245
    protected void generateClassUseFile() throws DocFileIOException {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   246
        HtmlTree body = getClassUseHeader();
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   247
        HtmlTree div = new HtmlTree(HtmlTag.DIV);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   248
        div.addStyle(HtmlStyle.classUseContainer);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
        if (pkgSet.size() > 0) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   250
            addClassUse(div);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
        } else {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   252
            div.addContent(contents.getContent("doclet.ClassUse_No.usage.of.0",
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   253
                    utils.getFullyQualifiedName(typeElement)));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
        }
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   255
        if (configuration.allowTag(HtmlTag.MAIN)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   256
            mainTree.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   257
            body.addContent(mainTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   258
        } else {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   259
            body.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   260
        }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   261
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.FOOTER))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   262
                ? HtmlTree.FOOTER()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   263
                : body;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   264
        addNavLinks(false, htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   265
        addBottom(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   266
        if (configuration.allowTag(HtmlTag.FOOTER)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   267
            body.addContent(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   268
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   269
        printHtmlDocument(null, true, body);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   272
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   273
     * Add the class use documentation.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   274
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   275
     * @param contentTree the content tree to which the class use information will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   276
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   277
    protected void addClassUse(Content contentTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   278
        HtmlTree ul = new HtmlTree(HtmlTag.UL);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   279
        ul.addStyle(HtmlStyle.blockList);
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 24220
diff changeset
   280
        if (configuration.packages.size() > 1) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   281
            addPackageList(ul);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   282
            addPackageAnnotationList(ul);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   284
        addClassList(ul);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   285
        contentTree.addContent(ul);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   288
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   289
     * Add the packages elements that use the given class.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   290
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   291
     * @param contentTree the content tree to which the packages elements will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   292
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   293
    protected void addPackageList(Content contentTree) {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   294
        Content caption = getTableCaption(configuration.getContent(
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   295
                "doclet.ClassUse_Packages.that.use.0",
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   296
                getLink(new LinkInfoImpl(configuration,
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   297
                        LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement))));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   298
        Content table = (configuration.isOutputHtml5())
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   299
                ? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   300
                : HtmlTree.TABLE(HtmlStyle.useSummary, packageUseTableSummary, caption);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   301
        table.addContent(getPackageTableHeader().toContent());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   302
        Content tbody = new HtmlTree(HtmlTag.TBODY);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   303
        boolean altColor = true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   304
        for (PackageElement pkg : pkgSet) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   305
            HtmlTree tr = new HtmlTree(HtmlTag.TR);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   306
            tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   307
            altColor = !altColor;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   308
            addPackageUse(pkg, tr);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   309
            tbody.addContent(tr);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   311
        table.addContent(tbody);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   312
        Content li = HtmlTree.LI(HtmlStyle.blockList, table);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   313
        contentTree.addContent(li);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   317
     * Add the package annotation elements.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   318
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   319
     * @param contentTree the content tree to which the package annotation elements will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   321
    protected void addPackageAnnotationList(Content contentTree) {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   322
        if (!utils.isAnnotationType(typeElement) ||
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   323
                pkgToPackageAnnotations == null ||
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
   324
                pkgToPackageAnnotations.isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   325
            return;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   326
        }
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   327
        Content caption = getTableCaption(configuration.getContent(
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   328
                "doclet.ClassUse_PackageAnnotation",
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14358
diff changeset
   329
                getLink(new LinkInfoImpl(configuration,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   330
                        LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement))));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   331
        Content table = (configuration.isOutputHtml5())
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   332
                ? HtmlTree.TABLE(HtmlStyle.useSummary, caption)
47427
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   333
                : HtmlTree.TABLE(HtmlStyle.useSummary, packageUseTableSummary, caption);
251676148c62 8189405: More cleanup in HtmlWriter
jjg
parents: 47216
diff changeset
   334
        table.addContent(getPackageTableHeader().toContent());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   335
        Content tbody = new HtmlTree(HtmlTag.TBODY);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   336
        boolean altColor = true;
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   337
        for (PackageElement pkg : pkgToPackageAnnotations) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   338
            HtmlTree tr = new HtmlTree(HtmlTag.TR);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   339
            tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   340
            altColor = !altColor;
41157
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40587
diff changeset
   341
            Content thFirst = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, getPackageLink(pkg));
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40587
diff changeset
   342
            tr.addContent(thFirst);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   343
            HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   344
            tdLast.addStyle(HtmlStyle.colLast);
8841
b4422fa4f2e6 7006178: findbugs high priority issues in new javadoc
bpatel
parents: 7681
diff changeset
   345
            addSummaryComment(pkg, tdLast);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   346
            tr.addContent(tdLast);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   347
            tbody.addContent(tr);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   348
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   349
        table.addContent(tbody);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   350
        Content li = HtmlTree.LI(HtmlStyle.blockList, table);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   351
        contentTree.addContent(li);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   352
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   353
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   354
    /**
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   355
     * Add the class elements that use the given class.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   356
     *
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   357
     * @param contentTree the content tree to which the class elements will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   358
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   359
    protected void addClassList(Content contentTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   360
        HtmlTree ul = new HtmlTree(HtmlTag.UL);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   361
        ul.addStyle(HtmlStyle.blockList);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   362
        for (PackageElement pkg : pkgSet) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   363
            Content markerAnchor = getMarkerAnchor(getPackageAnchorName(pkg));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   364
            HtmlTree htmlTree = (configuration.allowTag(HtmlTag.SECTION))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   365
                    ? HtmlTree.SECTION(markerAnchor)
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   366
                    : HtmlTree.LI(HtmlStyle.blockList, markerAnchor);
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   367
            Content link = contents.getContent("doclet.ClassUse_Uses.of.0.in.1",
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   368
                    getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   369
                            typeElement)),
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   370
                    getPackageLink(pkg, utils.getPackageName(pkg)));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   371
            Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   372
            htmlTree.addContent(heading);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   373
            addClassUse(pkg, htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   374
            if (configuration.allowTag(HtmlTag.SECTION)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   375
                ul.addContent(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   376
            } else {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   377
                ul.addContent(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   378
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   379
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   380
        Content li = HtmlTree.LI(HtmlStyle.blockList, ul);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   381
        contentTree.addContent(li);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   385
     * Add the package use information.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   386
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   387
     * @param pkg the package that uses the given class
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   388
     * @param contentTree the content tree to which the package use information will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   390
    protected void addPackageUse(PackageElement pkg, Content contentTree) {
41157
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40587
diff changeset
   391
        Content thFirst = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst,
26900
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26270
diff changeset
   392
                getHyperLink(getPackageAnchorName(pkg), new StringContent(utils.getPackageName(pkg))));
41157
b235a429089a 8162363: Tables in javadoc documentation missing row headers
bpatel
parents: 40587
diff changeset
   393
        contentTree.addContent(thFirst);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   394
        HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   395
        tdLast.addStyle(HtmlStyle.colLast);
8841
b4422fa4f2e6 7006178: findbugs high priority issues in new javadoc
bpatel
parents: 7681
diff changeset
   396
        addSummaryComment(pkg, tdLast);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   397
        contentTree.addContent(tdLast);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   401
     * Add the class use information.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   402
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   403
     * @param pkg the package that uses the given class
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   404
     * @param contentTree the content tree to which the class use information will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
     */
40587
1c355ea550ed 8164130: Simplify doclet IOException handling
jjg
parents: 40508
diff changeset
   406
    protected void addClassUse(PackageElement pkg, Content contentTree) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
   407
        Content classLink = getLink(new LinkInfoImpl(configuration,
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   408
            LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement));
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24297
diff changeset
   409
        Content pkgLink = getPackageLink(pkg, utils.getPackageName(pkg));
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   410
        classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   411
                configuration.getContent("doclet.ClassUse_Annotation", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   412
                pkgLink), classUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   413
        classSubWriter.addUseInfo(pkgToClassTypeParameter.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   414
                configuration.getContent("doclet.ClassUse_TypeParameter", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   415
                pkgLink), classUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   416
        classSubWriter.addUseInfo(pkgToSubclass.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   417
                configuration.getContent("doclet.ClassUse_Subclass", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   418
                pkgLink), subclassUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   419
        classSubWriter.addUseInfo(pkgToSubinterface.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   420
                configuration.getContent("doclet.ClassUse_Subinterface", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   421
                pkgLink), subinterfaceUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   422
        classSubWriter.addUseInfo(pkgToImplementingClass.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   423
                configuration.getContent("doclet.ClassUse_ImplementingClass", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   424
                pkgLink), classUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   425
        fieldSubWriter.addUseInfo(pkgToField.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   426
                configuration.getContent("doclet.ClassUse_Field", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   427
                pkgLink), fieldUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   428
        fieldSubWriter.addUseInfo(pkgToFieldAnnotations.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   429
                configuration.getContent("doclet.ClassUse_FieldAnnotations", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   430
                pkgLink), fieldUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   431
        fieldSubWriter.addUseInfo(pkgToFieldTypeParameter.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   432
                configuration.getContent("doclet.ClassUse_FieldTypeParameter", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   433
                pkgLink), fieldUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   434
        methodSubWriter.addUseInfo(pkgToMethodAnnotations.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   435
                configuration.getContent("doclet.ClassUse_MethodAnnotations", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   436
                pkgLink), methodUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   437
        methodSubWriter.addUseInfo(pkgToMethodParameterAnnotations.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   438
                configuration.getContent("doclet.ClassUse_MethodParameterAnnotations", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   439
                pkgLink), methodUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   440
        methodSubWriter.addUseInfo(pkgToMethodTypeParameter.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   441
                configuration.getContent("doclet.ClassUse_MethodTypeParameter", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   442
                pkgLink), methodUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   443
        methodSubWriter.addUseInfo(pkgToMethodReturn.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   444
                configuration.getContent("doclet.ClassUse_MethodReturn", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   445
                pkgLink), methodUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   446
        methodSubWriter.addUseInfo(pkgToMethodReturnTypeParameter.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   447
                configuration.getContent("doclet.ClassUse_MethodReturnTypeParameter", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   448
                pkgLink), methodUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   449
        methodSubWriter.addUseInfo(pkgToMethodArgs.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   450
                configuration.getContent("doclet.ClassUse_MethodArgs", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   451
                pkgLink), methodUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   452
        methodSubWriter.addUseInfo(pkgToMethodArgTypeParameter.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   453
                configuration.getContent("doclet.ClassUse_MethodArgsTypeParameters", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   454
                pkgLink), methodUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   455
        methodSubWriter.addUseInfo(pkgToMethodThrows.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   456
                configuration.getContent("doclet.ClassUse_MethodThrows", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   457
                pkgLink), methodUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   458
        constrSubWriter.addUseInfo(pkgToConstructorAnnotations.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   459
                configuration.getContent("doclet.ClassUse_ConstructorAnnotations", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   460
                pkgLink), constructorUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   461
        constrSubWriter.addUseInfo(pkgToConstructorParameterAnnotations.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   462
                configuration.getContent("doclet.ClassUse_ConstructorParameterAnnotations", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   463
                pkgLink), constructorUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   464
        constrSubWriter.addUseInfo(pkgToConstructorArgs.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   465
                configuration.getContent("doclet.ClassUse_ConstructorArgs", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   466
                pkgLink), constructorUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   467
        constrSubWriter.addUseInfo(pkgToConstructorArgTypeParameter.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   468
                configuration.getContent("doclet.ClassUse_ConstructorArgsTypeParameters", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   469
                pkgLink), constructorUseTableSummary, contentTree);
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   470
        constrSubWriter.addUseInfo(pkgToConstructorThrows.get(pkg),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   471
                configuration.getContent("doclet.ClassUse_ConstructorThrows", classLink,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   472
                pkgLink), constructorUseTableSummary, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   476
     * Get the header for the class use Listing.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   477
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   478
     * @return a content tree representing the class use header
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   479
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   480
    protected HtmlTree getClassUseHeader() {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   481
        String cltype = configuration.getText(utils.isInterface(typeElement)
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   482
                ? "doclet.Interface"
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   483
                : "doclet.Class");
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   484
        String clname = utils.getFullyQualifiedName(typeElement);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   485
        String title = configuration.getText("doclet.Window_ClassUse_Header",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   486
                cltype, clname);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   487
        HtmlTree bodyTree = getBody(true, getWindowTitle(title));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   488
        HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   489
                ? HtmlTree.HEADER()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   490
                : bodyTree;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   491
        addTop(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   492
        addNavLinks(true, htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   493
        if (configuration.allowTag(HtmlTag.HEADER)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   494
            bodyTree.addContent(htmlTree);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   495
        }
17562
c84f1d7fa11d 8011662: Remove single instance of resource with HTML from doclet resource bundle
jjg
parents: 17561
diff changeset
   496
        ContentBuilder headContent = new ContentBuilder();
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   497
        headContent.addContent(contents.getContent("doclet.ClassUse_Title", cltype));
17562
c84f1d7fa11d 8011662: Remove single instance of resource with HTML from doclet resource bundle
jjg
parents: 17561
diff changeset
   498
        headContent.addContent(new HtmlTree(HtmlTag.BR));
c84f1d7fa11d 8011662: Remove single instance of resource with HTML from doclet resource bundle
jjg
parents: 17561
diff changeset
   499
        headContent.addContent(clname);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   500
        Content heading = HtmlTree.HEADING(HtmlConstants.CLASS_PAGE_HEADING,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   501
                true, HtmlStyle.title, headContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   502
        Content div = HtmlTree.DIV(HtmlStyle.header, heading);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   503
        if (configuration.allowTag(HtmlTag.MAIN)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   504
            mainTree.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   505
        } else {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   506
            bodyTree.addContent(div);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   507
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   508
        return bodyTree;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   509
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   510
06bc494ca11e Initial load
duke
parents:
diff changeset
   511
    /**
37943
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   512
     * Get the module link.
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   513
     *
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   514
     * @return a content tree for the module link
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   515
     */
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   516
    @Override
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   517
    protected Content getNavLinkModule() {
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   518
        Content linkContent = getModuleLink(utils.elementUtils.getModuleOf(typeElement),
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   519
                contents.moduleLabel);
37943
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   520
        Content li = HtmlTree.LI(linkContent);
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   521
        return li;
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   522
    }
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   523
2efb75c09230 8154262: Navigation bar in javadoc generated pages needs to be updated to display module information
bpatel
parents: 35426
diff changeset
   524
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   525
     * Get this package link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   526
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   527
     * @return a content tree for the package link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   528
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   529
    protected Content getNavLinkPackage() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14260
diff changeset
   530
        Content linkContent =
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   531
                getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY), contents.packageLabel);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   532
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   533
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   534
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   535
06bc494ca11e Initial load
duke
parents:
diff changeset
   536
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   537
     * Get class page link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   538
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   539
     * @return a content tree for the class page link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   540
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   541
    protected Content getNavLinkClass() {
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
   542
        Content linkContent = getLink(new LinkInfoImpl(
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   543
                configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER, typeElement)
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17559
diff changeset
   544
                .label(configuration.getText("doclet.Class")));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   545
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   546
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   547
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   548
06bc494ca11e Initial load
duke
parents:
diff changeset
   549
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   550
     * Get the use link.
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
     * @return a content tree for the use link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   553
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   554
    protected Content getNavLinkClassUse() {
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   555
        Content li = HtmlTree.LI(HtmlStyle.navBarCell1Rev, contents.useLabel);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   556
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   557
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   558
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   559
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   560
     * Get the tree link.
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
     * @return a content tree for the tree link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   563
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   564
    protected Content getNavLinkTree() {
35426
374342e56a56 8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents: 29957
diff changeset
   565
        Content linkContent = utils.isEnclosingPackageIncluded(typeElement)
40303
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   566
                ? getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), contents.treeLabel)
96a1226aca18 8160697: HTMLWriter needs perf cleanup
jjg
parents: 39364
diff changeset
   567
                : getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), contents.treeLabel);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   568
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   569
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   570
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   571
}