langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
author jjg
Fri, 27 May 2016 13:06:58 -0700
changeset 38617 d93a7f64e231
parent 36526 3b41f1c69604
child 43568 0126b1f1e2be
permissions -rw-r--r--
8157606: deprecate com.sun.javadoc API Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
     2
 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3891
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: 3891
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: 3891
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3891
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 3891
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.doclets.formats.html;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import java.io.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
import java.text.SimpleDateFormat;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import java.util.*;
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
    31
import java.util.regex.Matcher;
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
    32
import java.util.regex.Pattern;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    34
import com.sun.javadoc.*;
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    35
import com.sun.tools.doclets.formats.html.markup.*;
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    36
import com.sun.tools.doclets.internal.toolkit.*;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 13844
diff changeset
    37
import com.sun.tools.doclets.internal.toolkit.taglets.*;
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    38
import com.sun.tools.doclets.internal.toolkit.util.*;
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 22005
diff changeset
    39
import com.sun.tools.javac.util.StringUtils;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * Class for the Html Format Code Generation specific to JavaDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * This Class contains methods related to the Html Code Generation which
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * are used extensively while generating the entire documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    46
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    47
 *  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
    48
 *  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
    49
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    50
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 * @since 1.2
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 * @author Robert Field
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    54
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 */
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 36526
diff changeset
    56
@Deprecated
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
public class HtmlDocletWriter extends HtmlDocWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
     * Relative path from the file getting generated to the destination
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
     * directory. For example, if the file getting generated is
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    62
     * "java/lang/Object.html", then the path to the root is "../..".
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
     * This string can be empty if the file getting generated is in
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
     * the destination directory.
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    66
    public final DocPath pathToRoot;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    /**
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    69
     * Platform-independent path from the current or the
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
     * destination directory to the file getting generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     * Used when creating the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    73
    public final DocPath path;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     * Name of the file getting generated. If the file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     * "java/lang/Object.html", then the filename is "Object.html".
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
    79
    public final DocPath filename;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     * The global configuration information for this run.
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     */
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    84
    public final ConfigurationImpl configuration;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
    86
    protected final Utils utils;
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
    87
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    89
     * To check whether annotation heading is printed or not.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    90
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    91
    protected boolean printedAnnotationHeading = false;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    92
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    93
    /**
20237
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19920
diff changeset
    94
     * To check whether annotation field heading is printed or not.
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19920
diff changeset
    95
     */
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19920
diff changeset
    96
    protected boolean printedAnnotationFieldHeading = false;
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19920
diff changeset
    97
b6d89903c867 8015249: javadoc fails to document static final fields in annotation types
bpatel
parents: 19920
diff changeset
    98
    /**
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
    99
     * To check whether the repeated annotations is documented or not.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   100
     */
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   101
    private boolean isAnnotationDocumented = false;
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   102
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   103
    /**
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   104
     * To check whether the container annotations is documented or not.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   105
     */
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   106
    private boolean isContainerDocumented = false;
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   107
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   108
    HtmlTree fixedNavDiv = new HtmlTree(HtmlTag.DIV);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   109
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
   110
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     * Constructor to construct the HtmlStandardWriter object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     *
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   113
     * @param path File to be generated.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   115
    public HtmlDocletWriter(ConfigurationImpl configuration, DocPath path)
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   116
            throws IOException {
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   117
        super(configuration, path);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
        this.configuration = configuration;
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
   119
        this.utils = configuration.utils;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
        this.path = path;
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   121
        this.pathToRoot = path.parent().invert();
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   122
        this.filename = path.basename();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     * Replace {&#064;docRoot} tag used in options that accept HTML text, such
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
     * as -header, -footer, -top and -bottom, and when converting a relative
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
     * HREF where commentTagsToString inserts a {&#064;docRoot} where one was
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
     * missing.  (Also see DocRootTaglet for {&#064;docRoot} tags in doc
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     * comments.)
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     * Replace {&#064;docRoot} tag in htmlstr with the relative path to the
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     * destination directory from the directory where the file is being
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     * written, looping to handle all such tags in htmlstr.
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * For example, for "-d docs" and -header containing {&#064;docRoot}, when
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * the HTML page for source file p/C1.java is being generated, the
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     * {&#064;docRoot} tag would be inserted into the header as "../",
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * the relative path from docs/p/ to docs/ (the document root).
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     * Note: This doc comment was written with '&amp;#064;' representing '@'
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     * to prevent the inline tag from being interpreted.
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
    public String replaceDocRootDir(String htmlstr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
        // Return if no inline tags exist
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
        int index = htmlstr.indexOf("{@");
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
        if (index < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
            return htmlstr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
        }
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   150
        Matcher docrootMatcher = docrootPattern.matcher(htmlstr);
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   151
        if (!docrootMatcher.find()) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
            return htmlstr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
        }
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
   154
        StringBuilder buf = new StringBuilder();
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   155
        int prevEnd = 0;
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   156
        do {
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   157
            int match = docrootMatcher.start();
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   158
            // append htmlstr up to start of next {@docroot}
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   159
            buf.append(htmlstr.substring(prevEnd, match));
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   160
            prevEnd = docrootMatcher.end();
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   161
            if (configuration.docrootparent.length() > 0 && htmlstr.startsWith("/..", prevEnd)) {
22005
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
   162
                // Insert the absolute link if {@docRoot} is followed by "/..".
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   163
                buf.append(configuration.docrootparent);
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   164
                prevEnd += 3;
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   165
            } else {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   166
                // Insert relative path where {@docRoot} was located
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   167
                buf.append(pathToRoot.isEmpty() ? "." : pathToRoot.getPath());
22005
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
   168
            }
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
   169
            // Append slash if next character is not a slash
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   170
            if (prevEnd < htmlstr.length() && htmlstr.charAt(prevEnd) != '/') {
22005
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
   171
                buf.append('/');
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
            }
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   173
        } while (docrootMatcher.find());
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   174
        buf.append(htmlstr.substring(prevEnd));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
        return buf.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
    }
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   177
    //where:
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   178
        // Note: {@docRoot} is not case sensitive when passed in w/command line option:
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   179
        private static final Pattern docrootPattern =
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
   180
                Pattern.compile(Pattern.quote("{@docroot}"), Pattern.CASE_INSENSITIVE);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   183
     * Get the script to show or hide the All classes link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   184
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   185
     * @param id id of the element to show or hide
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   186
     * @return a content tree for the script
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
    public Content getAllClassesLinkScript(String id) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   189
        HtmlTree script = HtmlTree.SCRIPT();
7641
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   190
        String scriptCode = "<!--" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   191
                "  allClassesLink = document.getElementById(\"" + id + "\");" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   192
                "  if(window==top) {" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   193
                "    allClassesLink.style.display = \"block\";" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   194
                "  }" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   195
                "  else {" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   196
                "    allClassesLink.style.display = \"none\";" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   197
                "  }" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   198
                "  //-->" + DocletConstants.NL;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   199
        Content scriptContent = new RawHtml(scriptCode);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   200
        script.addContent(scriptContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   201
        Content div = HtmlTree.DIV(script);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   202
        Content div_noscript = HtmlTree.DIV(getResource("doclet.No_Script_Message"));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   203
        Content noScript = HtmlTree.NOSCRIPT(div_noscript);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   204
        div.addContent(noScript);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   205
        return div;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   206
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   207
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
     * Add method information.
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 method the method to be documented
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   212
     * @param dl the content tree to which the method information will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   213
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   214
    private void addMethodInfo(MethodDoc method, Content dl) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
        ClassDoc[] intfacs = method.containingClass().interfaces();
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
        MethodDoc overriddenMethod = method.overriddenMethod();
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   217
        // Check whether there is any implementation or overridden info to be
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   218
        // printed. If no overridden or implementation info needs to be
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   219
        // printed, do not print this section.
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   220
        if ((intfacs.length > 0 &&
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   221
                new ImplementedMethods(method, this.configuration).build().length > 0) ||
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   222
                overriddenMethod != null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   223
            MethodWriterImpl.addImplementsInfo(this, method, dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
            if (overriddenMethod != null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   225
                MethodWriterImpl.addOverridden(this,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   226
                        method.overriddenType(), overriddenMethod, dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   231
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   232
     * Adds the tags information.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   233
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   234
     * @param doc the doc for which the tags will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   235
     * @param htmltree the documentation tree to which the tags will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   236
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   237
    protected void addTagsInfo(Doc doc, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   238
        if (configuration.nocomment) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   241
        Content dl = new HtmlTree(HtmlTag.DL);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
        if (doc instanceof MethodDoc) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   243
            addMethodInfo((MethodDoc) doc, dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
        }
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   245
        Content output = new ContentBuilder();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
        TagletWriter.genTagOuput(configuration.tagletManager, doc,
17573
0e20dec17c87 8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents: 17571
diff changeset
   247
            configuration.tagletManager.getCustomTaglets(doc),
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
                getTagletWriterInstance(false), output);
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   249
        dl.addContent(output);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   250
        htmltree.addContent(dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
    /**
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   254
     * Check whether there are any tags for Serialization Overview
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   255
     * section to be printed.
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   256
     *
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   257
     * @param field the FieldDoc object to check for tags.
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   258
     * @return true if there are tags to be printed else return false.
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   259
     */
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   260
    protected boolean hasSerializationOverviewTags(FieldDoc field) {
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   261
        Content output = new ContentBuilder();
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   262
        TagletWriter.genTagOuput(configuration.tagletManager, field,
17573
0e20dec17c87 8012311: Cleanup names and duplicatre code in TagletManager
jjg
parents: 17571
diff changeset
   263
            configuration.tagletManager.getCustomTaglets(field),
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   264
                getTagletWriterInstance(false), output);
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
   265
        return !output.isEmpty();
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   266
    }
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   267
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   268
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
     * Returns a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
     * @return a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
    public TagletWriter getTagletWriterInstance(boolean isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
        return new TagletWriterImpl(this, isFirstSentence);
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   278
     * Get Package link, with target frame.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   280
     * @param pd The link will be to the "package-summary.html" page for this package
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   281
     * @param target name of the target frame
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   282
     * @param label tag for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   283
     * @return a content for the target package link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   285
    public Content getTargetPackageLink(PackageDoc pd, String target,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   286
            Content label) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   287
        return getHyperLink(pathString(pd, DocPaths.PACKAGE_SUMMARY), label, "", target);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   291
     * Generates the HTML document tree and prints it out.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   292
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   293
     * @param metakeywords Array of String keywords for META tag. Each element
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   294
     *                     of the array is assigned to a separate META tag.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   295
     *                     Pass in null for no array
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   296
     * @param includeScript true if printing windowtitle script
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   297
     *                      false for files that appear in the left-hand frames
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   298
     * @param body the body htmltree to be included in the document
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   299
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   300
    public void printHtmlDocument(String[] metakeywords, boolean includeScript,
14265
4e8e488eeae0 8000666: javadoc should write directly to Writer instead of composing strings
jjg
parents: 14263
diff changeset
   301
            Content body) throws IOException {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   302
        Content htmlDocType = configuration.isOutputHtml5()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   303
                ? DocType.HTML5
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   304
                : DocType.TRANSITIONAL;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   305
        Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   306
        Content head = new HtmlTree(HtmlTag.HEAD);
19920
ead15bfdcfa0 8024288: javadoc generated-by comment should always be present
jjg
parents: 19909
diff changeset
   307
        head.addContent(getGeneratedBy(!configuration.notimestamp));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   308
        head.addContent(getTitle());
26665
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   309
        Content meta = HtmlTree.META("Content-Type", CONTENT_TYPE,
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   310
                (configuration.charset.length() > 0) ?
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   311
                        configuration.charset : HtmlConstants.HTML_DEFAULT_CHARSET);
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   312
        head.addContent(meta);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   313
        if (!configuration.notimestamp) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   314
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   315
            meta = HtmlTree.META(configuration.isOutputHtml5()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   316
                    ? "dc.created"
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   317
                    : "date", dateFormat.format(new Date()));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   318
            head.addContent(meta);
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
        if (metakeywords != null) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   321
            for (String metakeyword : metakeywords) {
26665
e813baa25bf2 8047745: Javadoc should include encoding information in generated html files
bpatel
parents: 25874
diff changeset
   322
                meta = HtmlTree.META("keywords", metakeyword);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   323
                head.addContent(meta);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   324
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   325
        }
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   326
        addStyleSheetProperties(head);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   327
        addScriptProperties(head);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   328
        Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(),
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   329
                head, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   330
        Content htmlDocument = new HtmlDocument(htmlDocType,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   331
                htmlComment, htmlTree);
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
   332
        write(htmlDocument);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   333
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   334
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   335
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   336
     * Get the window title.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   337
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   338
     * @param title the title string to construct the complete window title
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   339
     * @return the window title string
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   340
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   341
    public String getWindowTitle(String title) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   342
        if (configuration.windowtitle.length() > 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   343
            title += " (" + configuration.windowtitle  + ")";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   344
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   345
        return title;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   346
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   347
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   348
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   349
     * Get user specified header and the footer.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   350
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   351
     * @param header if true print the user provided header else print the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   352
     * user provided footer.
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
    public Content getUserHeaderFooter(boolean header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   355
        String content;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   356
        if (header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   357
            content = replaceDocRootDir(configuration.header);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   358
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   359
            if (configuration.footer.length() != 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   360
                content = replaceDocRootDir(configuration.footer);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   361
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   362
                content = replaceDocRootDir(configuration.header);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   363
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   364
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   365
        Content rawContent = new RawHtml(content);
19254
0988183c8164 4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents: 19253
diff changeset
   366
        return rawContent;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   367
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   368
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   369
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   370
     * Adds the user specified top.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   371
     *
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   372
     * @param htmlTree the content tree to which user specified top will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   373
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   374
    public void addTop(Content htmlTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   375
        Content top = new RawHtml(replaceDocRootDir(configuration.top));
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   376
        fixedNavDiv.addContent(top);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   377
    }
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   380
     * Adds the user specified bottom.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   381
     *
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   382
     * @param htmlTree the content tree to which user specified bottom will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   383
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   384
    public void addBottom(Content htmlTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   385
        Content bottom = new RawHtml(replaceDocRootDir(configuration.bottom));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   386
        Content small = HtmlTree.SMALL(bottom);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   387
        Content p = HtmlTree.P(HtmlStyle.legalCopy, small);
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   388
        htmlTree.addContent(p);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   389
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   390
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   391
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   392
     * Adds the navigation bar for the Html page at the top and and the bottom.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   393
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   394
     * @param header If true print navigation bar at the top of the page else
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   395
     * @param htmlTree the HtmlTree to which the nav links will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   396
     */
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   397
    protected void addNavLinks(boolean header, Content htmlTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   398
        if (!configuration.nonavbar) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   399
            Content tree = (configuration.allowTag(HtmlTag.NAV))
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   400
                    ? HtmlTree.NAV()
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   401
                    : htmlTree;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   402
            String allClassesId = "allclasses_";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   403
            HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   404
            fixedNavDiv.addStyle(HtmlStyle.fixedNav);
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   405
            Content skipNavLinks = configuration.getResource("doclet.Skip_navigation_links");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   406
            if (header) {
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   407
                fixedNavDiv.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   408
                navDiv.addStyle(HtmlStyle.topNav);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   409
                allClassesId += "navbar_top";
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   410
                Content a = getMarkerAnchor(SectionName.NAVBAR_TOP);
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   411
                //WCAG - Hyperlinks should contain text or an image with alt text - for AT tools
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   412
                navDiv.addContent(a);
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   413
                Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   414
                    getDocLink(SectionName.SKIP_NAVBAR_TOP), skipNavLinks,
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   415
                    skipNavLinks.toString(), ""));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   416
                navDiv.addContent(skipLinkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   417
            } else {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   418
                tree.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   419
                navDiv.addStyle(HtmlStyle.bottomNav);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   420
                allClassesId += "navbar_bottom";
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   421
                Content a = getMarkerAnchor(SectionName.NAVBAR_BOTTOM);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   422
                navDiv.addContent(a);
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   423
                Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   424
                    getDocLink(SectionName.SKIP_NAVBAR_BOTTOM), skipNavLinks,
19909
784c68032a36 7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
bpatel
parents: 19663
diff changeset
   425
                    skipNavLinks.toString(), ""));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   426
                navDiv.addContent(skipLinkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   427
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   428
            if (header) {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   429
                navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_TOP_FIRSTROW));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   430
            } else {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   431
                navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_BOTTOM_FIRSTROW));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   432
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   433
            HtmlTree navList = new HtmlTree(HtmlTag.UL);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   434
            navList.addStyle(HtmlStyle.navList);
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   435
            navList.addAttr(HtmlAttr.TITLE,
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
   436
                            configuration.getText("doclet.Navigation"));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   437
            if (configuration.createoverview) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   438
                navList.addContent(getNavLinkContents());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   439
            }
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23794
diff changeset
   440
            if (configuration.packages.size() == 1) {
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23794
diff changeset
   441
                navList.addContent(getNavLinkPackage(configuration.packages.first()));
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23794
diff changeset
   442
            } else if (configuration.packages.size() > 1) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   443
                navList.addContent(getNavLinkPackage());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   444
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   445
            navList.addContent(getNavLinkClass());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   446
            if(configuration.classuse) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   447
                navList.addContent(getNavLinkClassUse());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   448
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   449
            if(configuration.createtree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   450
                navList.addContent(getNavLinkTree());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   451
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   452
            if(!(configuration.nodeprecated ||
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   453
                     configuration.nodeprecatedlist)) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   454
                navList.addContent(getNavLinkDeprecated());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   455
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   456
            if(configuration.createindex) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   457
                navList.addContent(getNavLinkIndex());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   458
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   459
            if (!configuration.nohelp) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   460
                navList.addContent(getNavLinkHelp());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   461
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   462
            navDiv.addContent(navList);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   463
            Content aboutDiv = HtmlTree.DIV(HtmlStyle.aboutLanguage, getUserHeaderFooter(header));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   464
            navDiv.addContent(aboutDiv);
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   465
            if (header) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   466
                fixedNavDiv.addContent(navDiv);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   467
            } else {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   468
                tree.addContent(navDiv);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   469
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   470
            Content ulNav = HtmlTree.UL(HtmlStyle.navList, getNavLinkPrevious());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   471
            ulNav.addContent(getNavLinkNext());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   472
            Content subDiv = HtmlTree.DIV(HtmlStyle.subNav, ulNav);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   473
            Content ulFrames = HtmlTree.UL(HtmlStyle.navList, getNavShowLists());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   474
            ulFrames.addContent(getNavHideLists(filename));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   475
            subDiv.addContent(ulFrames);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   476
            HtmlTree ulAllClasses = HtmlTree.UL(HtmlStyle.navList, getNavLinkClassIndex());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   477
            ulAllClasses.addAttr(HtmlAttr.ID, allClassesId.toString());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   478
            subDiv.addContent(ulAllClasses);
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   479
            if (header && configuration.createindex) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   480
                HtmlTree inputText = HtmlTree.INPUT("text", "search");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   481
                HtmlTree inputReset = HtmlTree.INPUT("reset", "reset");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   482
                Content searchTxt = configuration.getResource("doclet.search");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   483
                searchTxt.addContent(getSpace());
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   484
                HtmlTree liInput = HtmlTree.LI(HtmlTree.SPAN(searchTxt));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   485
                liInput.addContent(inputText);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   486
                liInput.addContent(inputReset);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   487
                HtmlTree ulSearch = HtmlTree.UL(HtmlStyle.navListSearch, liInput);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   488
                subDiv.addContent(ulSearch);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   489
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   490
            subDiv.addContent(getAllClassesLinkScript(allClassesId.toString()));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   491
            addSummaryDetailLinks(subDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   492
            if (header) {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   493
                subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_TOP));
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   494
                fixedNavDiv.addContent(subDiv);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   495
                fixedNavDiv.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
   496
                tree.addContent(fixedNavDiv);
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
   497
                HtmlTree paddingDiv = HtmlTree.DIV(HtmlStyle.navPadding, getSpace());
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
   498
                tree.addContent(paddingDiv);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   499
            } else {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   500
                subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_BOTTOM));
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   501
                tree.addContent(subDiv);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   502
                tree.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   503
            }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   504
            if (configuration.allowTag(HtmlTag.NAV)) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   505
                htmlTree.addContent(tree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   506
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   507
        }
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 word "NEXT" to indicate that no link is available.  Override
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   512
     * this method to customize next link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   513
     *
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 link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   515
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   516
    protected Content getNavLinkNext() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   517
        return getNavLinkNext(null);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   518
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   519
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   520
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   521
     * Get the word "PREV" to indicate that no link is available.  Override
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   522
     * this method to customize prev link.
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
     * @return a content tree for the link
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
    protected Content getNavLinkPrevious() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   527
        return getNavLinkPrevious(null);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   528
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   529
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   530
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   531
     * Do nothing. This is the default method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   532
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   533
    protected void addSummaryDetailLinks(Content navDiv) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   534
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   535
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   536
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   537
     * Get link to the "overview-summary.html" page.
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 link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   540
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   541
    protected Content getNavLinkContents() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   542
        Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_SUMMARY),
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   543
                overviewLabel, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   544
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   545
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   546
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   547
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   548
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   549
     * Get link to the "package-summary.html" page for the package passed.
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
     * @param pkg Package to which link will be generated
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 link
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
    protected Content getNavLinkPackage(PackageDoc pkg) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   555
        Content linkContent = getPackageLink(pkg,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   556
                packageLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   557
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   558
        return li;
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
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
     * Get the word "Package" , to indicate that link is not available here.
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
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   565
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   566
    protected Content getNavLinkPackage() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   567
        Content li = HtmlTree.LI(packageLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   568
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   569
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   570
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   571
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   572
     * Get the word "Use", to indicate that link is not available.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   573
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   574
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   575
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   576
    protected Content getNavLinkClassUse() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   577
        Content li = HtmlTree.LI(useLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   578
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   579
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   580
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   581
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   582
     * Get link for previous file.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   583
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   584
     * @param prev File name for the prev link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   585
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   586
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   587
    public Content getNavLinkPrevious(DocPath prev) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   588
        Content li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   589
        if (prev != null) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   590
            li = HtmlTree.LI(getHyperLink(prev, prevLabel, "", ""));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   591
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   592
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   593
            li = HtmlTree.LI(prevLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   594
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   595
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   596
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   597
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   598
     * Get link for next file.  If next is null, just print the label
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   599
     * without linking it anywhere.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   600
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   601
     * @param next File name for the next link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   602
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   603
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   604
    public Content getNavLinkNext(DocPath next) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   605
        Content li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   606
        if (next != null) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   607
            li = HtmlTree.LI(getHyperLink(next, nextLabel, "", ""));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   608
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   609
        else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   610
            li = HtmlTree.LI(nextLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   611
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   612
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   613
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   614
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   615
     * Get "FRAMES" link, to switch to the frame version of the output.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   616
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   617
     * @param link File to be linked, "index.html"
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   618
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   619
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   620
    protected Content getNavShowLists(DocPath link) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   621
        DocLink dl = new DocLink(link, path.getPath(), null);
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   622
        Content framesContent = getHyperLink(dl, framesLabel, "", "_top");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   623
        Content li = HtmlTree.LI(framesContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   624
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   625
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   626
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   627
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   628
     * Get "FRAMES" link, to switch to the frame version of the output.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   629
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   630
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   631
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   632
    protected Content getNavShowLists() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   633
        return getNavShowLists(pathToRoot.resolve(DocPaths.INDEX));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   634
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   635
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   636
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   637
     * Get "NO FRAMES" link, to switch to the non-frame version of the output.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   638
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   639
     * @param link File to be linked
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   640
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   641
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   642
    protected Content getNavHideLists(DocPath link) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   643
        Content noFramesContent = getHyperLink(link, noframesLabel, "", "_top");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   644
        Content li = HtmlTree.LI(noFramesContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   645
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   646
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   647
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   648
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   649
     * Get "Tree" link in the navigation bar. If there is only one package
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   650
     * specified on the command line, then the "Tree" link will be to the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   651
     * only "package-tree.html" file otherwise it will be to the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   652
     * "overview-tree.html" file.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   653
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   654
     * @return a content tree for the link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   655
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   656
    protected Content getNavLinkTree() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   657
        Content treeLinkContent;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   658
        PackageDoc[] packages = configuration.root.specifiedPackages();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   659
        if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   660
            treeLinkContent = getHyperLink(pathString(packages[0],
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   661
                    DocPaths.PACKAGE_TREE), treeLabel,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   662
                    "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   663
        } else {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   664
            treeLinkContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE),
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   665
                    treeLabel, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   666
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   667
        Content li = HtmlTree.LI(treeLinkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   668
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   669
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   670
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   671
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   672
     * Get the overview tree link for the main tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   673
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   674
     * @param label the label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   675
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   676
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   677
    protected Content getNavLinkMainTree(String label) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   678
        Content mainTreeContent = getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE),
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   679
                new StringContent(label));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   680
        Content li = HtmlTree.LI(mainTreeContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   681
        return li;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   682
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   683
06bc494ca11e Initial load
duke
parents:
diff changeset
   684
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   685
     * Get the word "Class", to indicate that class link is not available.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   686
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   687
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   688
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   689
    protected Content getNavLinkClass() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   690
        Content li = HtmlTree.LI(classLabel);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   691
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   692
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   693
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   694
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   695
     * Get "Deprecated" API link in the navigation bar.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   696
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   697
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   698
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   699
    protected Content getNavLinkDeprecated() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   700
        Content linkContent = getHyperLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST),
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   701
                deprecatedLabel, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   702
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   703
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   704
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   705
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   706
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   707
     * Get link for generated index. If the user has used "-splitindex"
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   708
     * command line option, then link to file "index-files/index-1.html" is
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   709
     * generated otherwise link to file "index-all.html" is generated.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   710
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   711
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   712
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   713
    protected Content getNavLinkClassIndex() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   714
        Content allClassesContent = getHyperLink(pathToRoot.resolve(
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   715
                DocPaths.ALLCLASSES_NOFRAME),
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   716
                allclassesLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   717
        Content li = HtmlTree.LI(allClassesContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   718
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   719
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   720
06bc494ca11e Initial load
duke
parents:
diff changeset
   721
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   722
     * Get link for generated class index.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   723
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   724
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   725
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   726
    protected Content getNavLinkIndex() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   727
        Content linkContent = getHyperLink(pathToRoot.resolve(
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   728
                (configuration.splitindex
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   729
                    ? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1))
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   730
                    : DocPaths.INDEX_ALL)),
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   731
            indexLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   732
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   733
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   734
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   735
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   736
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   737
     * Get help file link. If user has provided a help file, then generate a
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   738
     * link to the user given file, which is already copied to current or
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   739
     * destination directory.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   740
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   741
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   742
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   743
    protected Content getNavLinkHelp() {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   744
        String helpfile = configuration.helpfile;
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   745
        DocPath helpfilenm;
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   746
        if (helpfile.isEmpty()) {
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   747
            helpfilenm = DocPaths.HELP_DOC;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   748
        } else {
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
   749
            DocFile file = DocFile.createFileForInput(configuration, helpfile);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
   750
            helpfilenm = DocPath.create(file.getName());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   751
        }
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   752
        Content linkContent = getHyperLink(pathToRoot.resolve(helpfilenm),
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   753
                helpLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   754
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   755
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   756
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   757
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   758
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   759
     * Get summary table header.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   760
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   761
     * @param header the header for the table
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   762
     * @param scope the scope of the headers
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   763
     * @return a content tree for the header
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   764
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   765
    public Content getSummaryTableHeader(String[] header, String scope) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   766
        Content tr = new HtmlTree(HtmlTag.TR);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   767
        int size = header.length;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   768
        Content tableHeader;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   769
        if (size == 1) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   770
            tableHeader = new StringContent(header[0]);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   771
            tr.addContent(HtmlTree.TH(HtmlStyle.colOne, scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   772
            return tr;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   773
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   774
        for (int i = 0; i < size; i++) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   775
            tableHeader = new StringContent(header[i]);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   776
            if(i == 0)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   777
                tr.addContent(HtmlTree.TH(HtmlStyle.colFirst, scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   778
            else if(i == (size - 1))
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   779
                tr.addContent(HtmlTree.TH(HtmlStyle.colLast, scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   780
            else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   781
                tr.addContent(HtmlTree.TH(scope, tableHeader));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   782
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   783
        return tr;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   784
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   785
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   786
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   787
     * Get table caption.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   788
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   789
     * @param rawText the caption for the table which could be raw Html
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   790
     * @return a content tree for the caption
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   791
     */
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
   792
    public Content getTableCaption(Content title) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   793
        Content captionSpan = HtmlTree.SPAN(title);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   794
        Content space = getSpace();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   795
        Content tabSpan = HtmlTree.SPAN(HtmlStyle.tabEnd, space);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   796
        Content caption = HtmlTree.CAPTION(captionSpan);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   797
        caption.addContent(tabSpan);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   798
        return caption;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   799
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   800
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   801
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   802
     * Get the marker anchor which will be added to the documentation tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   803
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   804
     * @param anchorName the anchor name attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   805
     * @return a content tree for the marker anchor
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   806
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   807
    public Content getMarkerAnchor(String anchorName) {
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   808
        return getMarkerAnchor(getName(anchorName), null);
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   809
    }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   810
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   811
    /**
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   812
     * Get the marker anchor which will be added to the documentation tree.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   813
     *
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   814
     * @param sectionName the section name anchor attribute for page
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   815
     * @return a content tree for the marker anchor
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   816
     */
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   817
    public Content getMarkerAnchor(SectionName sectionName) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   818
        return getMarkerAnchor(sectionName.getName(), null);
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   819
    }
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   820
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   821
    /**
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   822
     * Get the marker anchor which will be added to the documentation tree.
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   823
     *
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   824
     * @param sectionName the section name anchor attribute for page
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   825
     * @param anchorName the anchor name combined with section name attribute for the page
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   826
     * @return a content tree for the marker anchor
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   827
     */
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   828
    public Content getMarkerAnchor(SectionName sectionName, String anchorName) {
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
   829
        return getMarkerAnchor(sectionName.getName() + getName(anchorName), null);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   830
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   831
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   832
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   833
     * Get the marker anchor which will be added to the documentation tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   834
     *
31297
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
   835
     * @param anchorName the anchor name or id attribute
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   836
     * @param anchorContent the content that should be added to the anchor
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   837
     * @return a content tree for the marker anchor
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   838
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   839
    public Content getMarkerAnchor(String anchorName, Content anchorContent) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   840
        if (anchorContent == null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   841
            anchorContent = new Comment(" ");
31297
86fe1414f12c 8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents: 29957
diff changeset
   842
        Content markerAnchor = HtmlTree.A(configuration.htmlVersion, anchorName, anchorContent);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   843
        return markerAnchor;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   844
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   845
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   846
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   847
     * Returns a packagename content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   848
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   849
     * @param packageDoc the package to check
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   850
     * @return package name content
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   851
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   852
    public Content getPackageName(PackageDoc packageDoc) {
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23794
diff changeset
   853
        return packageDoc == null || packageDoc.name().isEmpty() ?
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   854
            defaultPackageLabel :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   855
            getPackageLabel(packageDoc.name());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   856
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   857
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   858
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   859
     * Returns a package name label.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   860
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
   861
     * @param packageName the package name
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   862
     * @return the package name content
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   863
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   864
    public Content getPackageLabel(String packageName) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   865
        return new StringContent(packageName);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   866
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   867
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   868
    /**
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   869
     * Add package deprecation information to the documentation tree
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   870
     *
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   871
     * @param deprPkgs list of deprecated packages
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   872
     * @param headingKey the caption for the deprecated package table
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   873
     * @param tableSummary the summary for the deprecated package table
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   874
     * @param tableHeader table headers for the deprecated package table
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   875
     * @param contentTree the content tree to which the deprecated package table will be added
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   876
     */
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   877
    protected void addPackageDeprecatedAPI(List<Doc> deprPkgs, String headingKey,
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   878
            String tableSummary, String[] tableHeader, Content contentTree) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   879
        if (deprPkgs.size() > 0) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   880
            Content caption = getTableCaption(configuration.getResource(headingKey));
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   881
            Content table = (configuration.isOutputHtml5())
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   882
                    ? HtmlTree.TABLE(HtmlStyle.deprecatedSummary, caption)
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 26900
diff changeset
   883
                    : HtmlTree.TABLE(HtmlStyle.deprecatedSummary, tableSummary, caption);
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   884
            table.addContent(getSummaryTableHeader(tableHeader, "col"));
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   885
            Content tbody = new HtmlTree(HtmlTag.TBODY);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   886
            for (int i = 0; i < deprPkgs.size(); i++) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   887
                PackageDoc pkg = (PackageDoc) deprPkgs.get(i);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   888
                HtmlTree td = HtmlTree.TD(HtmlStyle.colOne,
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   889
                        getPackageLink(pkg, getPackageName(pkg)));
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   890
                if (pkg.tags("deprecated").length > 0) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   891
                    addInlineDeprecatedComment(pkg, pkg.tags("deprecated")[0], td);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   892
                }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   893
                HtmlTree tr = HtmlTree.TR(td);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   894
                if (i % 2 == 0) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   895
                    tr.addStyle(HtmlStyle.altColor);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   896
                } else {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   897
                    tr.addStyle(HtmlStyle.rowColor);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   898
                }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   899
                tbody.addContent(tr);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   900
            }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   901
            table.addContent(tbody);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   902
            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   903
            Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   904
            contentTree.addContent(ul);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   905
        }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   906
    }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   907
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   908
    /**
14366
af625e568667 8001929: fix doclint errors in langtools doc comments
jjg
parents: 14358
diff changeset
   909
     * Return the path to the class page for a classdoc.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   910
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   911
     * @param cd   Class to which the path is requested.
06bc494ca11e Initial load
duke
parents:
diff changeset
   912
     * @param name Name of the file(doesn't include path).
06bc494ca11e Initial load
duke
parents:
diff changeset
   913
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   914
    protected DocPath pathString(ClassDoc cd, DocPath name) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   915
        return pathString(cd.containingPackage(), name);
06bc494ca11e Initial load
duke
parents:
diff changeset
   916
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   917
06bc494ca11e Initial load
duke
parents:
diff changeset
   918
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   919
     * Return path to the given file name in the given package. So if the name
06bc494ca11e Initial load
duke
parents:
diff changeset
   920
     * passed is "Object.html" and the name of the package is "java.lang", and
06bc494ca11e Initial load
duke
parents:
diff changeset
   921
     * if the relative path is "../.." then returned string will be
06bc494ca11e Initial load
duke
parents:
diff changeset
   922
     * "../../java/lang/Object.html"
06bc494ca11e Initial load
duke
parents:
diff changeset
   923
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   924
     * @param pd Package in which the file name is assumed to be.
06bc494ca11e Initial load
duke
parents:
diff changeset
   925
     * @param name File name, to which path string is.
06bc494ca11e Initial load
duke
parents:
diff changeset
   926
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   927
    protected DocPath pathString(PackageDoc pd, DocPath name) {
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   928
        return pathToRoot.resolve(DocPath.forPackage(pd).resolve(name));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   929
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   930
06bc494ca11e Initial load
duke
parents:
diff changeset
   931
    /**
26900
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
   932
     * Given a package, return the name to be used in HTML anchor tag.
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
   933
     * @param packageDoc the package.
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
   934
     * @return the name to be used in HTML anchor tag.
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
   935
     */
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
   936
    public String getPackageAnchorName(PackageDoc packageDoc) {
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
   937
        return packageDoc == null || packageDoc.name().length() == 0 ?
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
   938
            SectionName.UNNAMED_PACKAGE_ANCHOR.getName() : packageDoc.name();
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
   939
    }
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
   940
dccc7a72526d 8048351: tidy errors for attribute href, name for langtools javadoc tests needs investigation
bpatel
parents: 26665
diff changeset
   941
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   942
     * Return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
   943
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   944
     * @param pkg the package to link to.
06bc494ca11e Initial load
duke
parents:
diff changeset
   945
     * @param label the label for the link.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   946
     * @return a content tree for the package link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   947
     */
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
   948
    public Content getPackageLink(PackageDoc pkg, String label) {
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
   949
        return getPackageLink(pkg, new StringContent(label));
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
   950
    }
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
   951
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
   952
    /**
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
   953
     * Return the link to the given package.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
   954
     *
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
   955
     * @param pkg the package to link to.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
   956
     * @param label the label for the link.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
   957
     * @return a content tree for the package link.
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 17561
diff changeset
   958
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   959
    public Content getPackageLink(PackageDoc pkg, Content label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   960
        boolean included = pkg != null && pkg.isIncluded();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   961
        if (! included) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   962
            for (PackageDoc p : configuration.packages) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   963
                if (p.equals(pkg)) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   964
                    included = true;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   965
                    break;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   966
                }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   967
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   968
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   969
        if (included || pkg == null) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
   970
            return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY),
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   971
                    label);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   972
        } else {
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
   973
            DocLink crossPkgLink = getCrossPackageLink(utils.getPackageName(pkg));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   974
            if (crossPkgLink != null) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
   975
                return getHyperLink(crossPkgLink, label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   976
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   977
                return label;
06bc494ca11e Initial load
duke
parents:
diff changeset
   978
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   979
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   980
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   981
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   982
    public Content italicsClassName(ClassDoc cd, boolean qual) {
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
   983
        Content name = new StringContent((qual)? cd.qualifiedName(): cd.name());
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 21008
diff changeset
   984
        return (cd.isInterface())?  HtmlTree.SPAN(HtmlStyle.interfaceName, name): name;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   985
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   986
06bc494ca11e Initial load
duke
parents:
diff changeset
   987
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   988
     * Add the link to the content tree.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   989
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   990
     * @param doc program element doc for which the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   991
     * @param label label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   992
     * @param htmltree 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
   993
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   994
    public void addSrcLink(ProgramElementDoc doc, Content label, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   995
        if (doc == null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   996
            return;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   997
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   998
        ClassDoc cd = doc.containingClass();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   999
        if (cd == null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1000
            //d must be a class doc since in has no containing class.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1001
            cd = (ClassDoc) doc;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1002
        }
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1003
        DocPath href = pathToRoot
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1004
                .resolve(DocPaths.SOURCE_OUTPUT)
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1005
                .resolve(DocPath.forClass(cd));
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1006
        Content linkContent = getHyperLink(href.fragment(SourceToHTMLConverter.getAnchorName(doc)), label, "", "");
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1007
        htmltree.addContent(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1008
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1009
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1010
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1011
     * Return the link to the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1012
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1013
     * @param linkInfo the information about the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1014
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1015
     * @return the link for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1016
     */
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1017
    public Content getLink(LinkInfoImpl linkInfo) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1018
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
17564
c329fe11193d 8011288: Erratic/inconsistent indentation of signatures
jjg
parents: 17563
diff changeset
  1019
        return factory.getLink(linkInfo);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1020
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1021
06bc494ca11e Initial load
duke
parents:
diff changeset
  1022
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1023
     * Return the type parameters for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1024
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1025
     * @param linkInfo the information about the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1026
     * @return the type for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1027
     */
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1028
    public Content getTypeParameterLinks(LinkInfoImpl linkInfo) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1029
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1030
        return factory.getTypeParameterLinks(linkInfo, false);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1031
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1032
06bc494ca11e Initial load
duke
parents:
diff changeset
  1033
    /*************************************************************
06bc494ca11e Initial load
duke
parents:
diff changeset
  1034
     * Return a class cross link to external class documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1035
     * The name must be fully qualified to determine which package
06bc494ca11e Initial load
duke
parents:
diff changeset
  1036
     * the class is in.  The -link option does not allow users to
06bc494ca11e Initial load
duke
parents:
diff changeset
  1037
     * link to external classes in the "default" package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1038
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1039
     * @param qualifiedClassName the qualified name of the external class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1040
     * @param refMemName the name of the member being referenced.  This should
06bc494ca11e Initial load
duke
parents:
diff changeset
  1041
     * be null or empty string if no member is being referenced.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1042
     * @param label the label for the external link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1043
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1044
     * @param style the style of the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1045
     * @param code true if the label should be code font.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1046
     */
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1047
    public Content getCrossClassLink(String qualifiedClassName, String refMemName,
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1048
                                    Content label, boolean strong, String style,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1049
                                    boolean code) {
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1050
        String className = "";
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1051
        String packageName = qualifiedClassName == null ? "" : qualifiedClassName;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1052
        int periodIndex;
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1053
        while ((periodIndex = packageName.lastIndexOf('.')) != -1) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1054
            className = packageName.substring(periodIndex + 1, packageName.length()) +
06bc494ca11e Initial load
duke
parents:
diff changeset
  1055
                (className.length() > 0 ? "." + className : "");
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1056
            Content defaultLabel = new StringContent(className);
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1057
            if (code)
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1058
                defaultLabel = HtmlTree.CODE(defaultLabel);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1059
            packageName = packageName.substring(0, periodIndex);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1060
            if (getCrossPackageLink(packageName) != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1061
                //The package exists in external documentation, so link to the external
06bc494ca11e Initial load
duke
parents:
diff changeset
  1062
                //class (assuming that it exists).  This is definitely a limitation of
06bc494ca11e Initial load
duke
parents:
diff changeset
  1063
                //the -link option.  There are ways to determine if an external package
06bc494ca11e Initial load
duke
parents:
diff changeset
  1064
                //exists, but no way to determine if the external class exists.  We just
06bc494ca11e Initial load
duke
parents:
diff changeset
  1065
                //have to assume that it does.
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1066
                DocLink link = configuration.extern.getExternalLink(packageName, pathToRoot,
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1067
                                className + ".html", refMemName);
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1068
                return getHyperLink(link,
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1069
                    (label == null) || label.isEmpty() ? defaultLabel : label,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1070
                    strong, style,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1071
                    configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1072
                    "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1073
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1074
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1075
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1076
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1077
06bc494ca11e Initial load
duke
parents:
diff changeset
  1078
    public boolean isClassLinkable(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1079
        if (cd.isIncluded()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1080
            return configuration.isGeneratedDoc(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1081
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1082
        return configuration.extern.isExternal(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1083
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1084
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1085
    public DocLink getCrossPackageLink(String pkgName) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1086
        return configuration.extern.getExternalLink(pkgName, pathToRoot,
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1087
            DocPaths.PACKAGE_SUMMARY.getPath());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1088
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1089
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1090
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1091
     * Get the class link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1092
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1093
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1094
     * @param cd the class doc to link to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1095
     * @return a content tree for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1096
     */
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 17547
diff changeset
  1097
    public Content getQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd) {
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17560
diff changeset
  1098
        return getLink(new LinkInfoImpl(configuration, context, cd)
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17560
diff changeset
  1099
                .label(configuration.getClassName(cd)));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1100
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1101
06bc494ca11e Initial load
duke
parents:
diff changeset
  1102
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1103
     * Add the class link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1104
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1105
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1106
     * @param cd the class doc to link to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1107
     * @param contentTree the content tree to which the link will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1108
     */
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 17547
diff changeset
  1109
    public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd, Content contentTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1110
        addPreQualifiedClassLink(context, cd, false, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1111
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1112
06bc494ca11e Initial load
duke
parents:
diff changeset
  1113
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1114
     * Retrieve the class link with the package portion of the label in
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1115
     * plain text.  If the qualifier is excluded, it will not be included in the
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1116
     * link label.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1117
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1118
     * @param cd the class to link to.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1119
     * @param isStrong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1120
     * @return the link with the package portion of the label in plain text.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1121
     */
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1122
    public Content getPreQualifiedClassLink(LinkInfoImpl.Kind context,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1123
            ClassDoc cd, boolean isStrong) {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1124
        ContentBuilder classlink = new ContentBuilder();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1125
        PackageDoc pd = cd.containingPackage();
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1126
        if (pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1127
            classlink.addContent(getPkgName(cd));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1128
        }
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1129
        classlink.addContent(getLink(new LinkInfoImpl(configuration,
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17560
diff changeset
  1130
                context, cd).label(cd.name()).strong(isStrong)));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1131
        return classlink;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1132
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1133
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1134
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1135
     * Add the class link with the package portion of the label in
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1136
     * plain text. If the qualifier is excluded, it will not be included in the
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1137
     * link label.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1138
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1139
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1140
     * @param cd the class to link to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1141
     * @param isStrong true if the link should be strong
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1142
     * @param contentTree the content tree to which the link with be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1143
     */
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 17547
diff changeset
  1144
    public void addPreQualifiedClassLink(LinkInfoImpl.Kind context,
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1145
            ClassDoc cd, boolean isStrong, Content contentTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1146
        PackageDoc pd = cd.containingPackage();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1147
        if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1148
            contentTree.addContent(getPkgName(cd));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1149
        }
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1150
        contentTree.addContent(getLink(new LinkInfoImpl(configuration,
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17560
diff changeset
  1151
                context, cd).label(cd.name()).strong(isStrong)));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1152
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1153
06bc494ca11e Initial load
duke
parents:
diff changeset
  1154
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1155
     * Add the class link, with only class name as the strong link and prefixing
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1156
     * plain package name.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1157
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1158
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1159
     * @param cd the class to link to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1160
     * @param contentTree the content tree to which the link with be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1161
     */
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 17547
diff changeset
  1162
    public void addPreQualifiedStrongClassLink(LinkInfoImpl.Kind context, ClassDoc cd, Content contentTree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1163
        addPreQualifiedClassLink(context, cd, true, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1164
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1165
06bc494ca11e Initial load
duke
parents:
diff changeset
  1166
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1167
     * Get the link for the given member.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1168
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1169
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1170
     * @param doc the member being linked to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1171
     * @param label the label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1172
     * @return a content tree for the doc link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1173
     */
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 17547
diff changeset
  1174
    public Content getDocLink(LinkInfoImpl.Kind context, MemberDoc doc, String label) {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1175
        return getDocLink(context, doc.containingClass(), doc,
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1176
                new StringContent(label));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1177
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1178
06bc494ca11e Initial load
duke
parents:
diff changeset
  1179
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1180
     * Return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1181
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1182
     * @param context the id of the context where the link will be printed.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1183
     * @param doc the member being linked to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1184
     * @param label the label for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1185
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1186
     * @return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1187
     */
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1188
    public Content getDocLink(LinkInfoImpl.Kind context, MemberDoc doc, String label,
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1189
            boolean strong) {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1190
        return getDocLink(context, doc.containingClass(), doc, label, strong);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1191
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1192
06bc494ca11e Initial load
duke
parents:
diff changeset
  1193
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1194
     * Return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1195
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1196
     * @param context the id of the context where the link will be printed.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1197
     * @param classDoc the classDoc that we should link to.  This is not
06bc494ca11e Initial load
duke
parents:
diff changeset
  1198
     *                 necessarily equal to doc.containingClass().  We may be
06bc494ca11e Initial load
duke
parents:
diff changeset
  1199
     *                 inheriting comments.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1200
     * @param doc the member being linked to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1201
     * @param label the label for the link.
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1202
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1203
     * @return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1204
     */
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1205
    public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1206
            String label, boolean strong) {
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1207
        return getDocLink(context, classDoc, doc, label, strong, false);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1208
    }
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1209
    public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1210
            Content label, boolean strong) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1211
        return getDocLink(context, classDoc, doc, label, strong, false);
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1212
    }
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1213
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1214
   /**
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1215
     * Return the link for the given member.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1216
     *
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1217
     * @param context the id of the context where the link will be printed.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1218
     * @param classDoc the classDoc that we should link to.  This is not
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1219
     *                 necessarily equal to doc.containingClass().  We may be
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1220
     *                 inheriting comments.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1221
     * @param doc the member being linked to.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1222
     * @param label the label for the link.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1223
     * @param strong true if the link should be strong.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1224
     * @param isProperty true if the doc parameter is a JavaFX property.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1225
     * @return the link for the given member.
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1226
     */
17559
87c28ee29329 8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents: 17558
diff changeset
  1227
    public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1228
            String label, boolean strong, boolean isProperty) {
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1229
        return getDocLink(context, classDoc, doc, new StringContent(check(label)), strong, isProperty);
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1230
    }
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1231
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1232
    String check(String s) {
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1233
        if (s.matches(".*[&<>].*"))throw new IllegalArgumentException(s);
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1234
        return s;
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1235
    }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1236
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1237
    public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1238
            Content label, boolean strong, boolean isProperty) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1239
        if (! (doc.isIncluded() ||
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
  1240
            utils.isLinkable(classDoc, configuration))) {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1241
            return label;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1242
        } else if (doc instanceof ExecutableMemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1243
            ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17560
diff changeset
  1244
            return getLink(new LinkInfoImpl(configuration, context, classDoc)
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
  1245
                .label(label).where(getName(getAnchor(emd, isProperty))).strong(strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1246
        } else if (doc instanceof MemberDoc) {
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17560
diff changeset
  1247
            return getLink(new LinkInfoImpl(configuration, context, classDoc)
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
  1248
                .label(label).where(getName(doc.name())).strong(strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1249
        } else {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1250
            return label;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1251
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1252
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1253
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1254
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1255
     * Return the link for the given member.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1256
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1257
     * @param context the id of the context where the link will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1258
     * @param classDoc the classDoc that we should link to.  This is not
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1259
     *                 necessarily equal to doc.containingClass().  We may be
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1260
     *                 inheriting comments
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1261
     * @param doc the member being linked to
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1262
     * @param label the label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1263
     * @return the link for the given member
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1264
     */
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 17547
diff changeset
  1265
    public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1266
            Content label) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1267
        if (! (doc.isIncluded() ||
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
  1268
            utils.isLinkable(classDoc, configuration))) {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1269
            return label;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1270
        } else if (doc instanceof ExecutableMemberDoc) {
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17560
diff changeset
  1271
            ExecutableMemberDoc emd = (ExecutableMemberDoc) doc;
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17560
diff changeset
  1272
            return getLink(new LinkInfoImpl(configuration, context, classDoc)
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
  1273
                .label(label).where(getName(getAnchor(emd))));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1274
        } else if (doc instanceof MemberDoc) {
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17560
diff changeset
  1275
            return getLink(new LinkInfoImpl(configuration, context, classDoc)
21008
af0b915df7cc 8025633: Fix javadoc to generate valid anchor names
bpatel
parents: 20613
diff changeset
  1276
                .label(label).where(getName(doc.name())));
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1277
        } else {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1278
            return label;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1279
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1280
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1281
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1282
    public String getAnchor(ExecutableMemberDoc emd) {
16319
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1283
        return getAnchor(emd, false);
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1284
    }
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1285
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1286
    public String getAnchor(ExecutableMemberDoc emd, boolean isProperty) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1287
        if (isProperty) {
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1288
            return emd.name();
e586bfeb39c5 7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents: 15725
diff changeset
  1289
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1290
        StringBuilder signature = new StringBuilder(emd.signature());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1291
        StringBuilder signatureParsed = new StringBuilder();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1292
        int counter = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1293
        for (int i = 0; i < signature.length(); i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1294
            char c = signature.charAt(i);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1295
            if (c == '<') {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1296
                counter++;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1297
            } else if (c == '>') {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1298
                counter--;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1299
            } else if (counter == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1300
                signatureParsed.append(c);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1301
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1302
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1303
        return emd.name() + signatureParsed.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1304
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1305
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1306
    public Content seeTagToContent(SeeTag see) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1307
        String tagName = see.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1308
        if (! (tagName.startsWith("@link") || tagName.equals("@see"))) {
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1309
            return new ContentBuilder();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1310
        }
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1311
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
  1312
        String seetext = replaceDocRootDir(utils.normalizeNewlines(see.text()));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1313
06bc494ca11e Initial load
duke
parents:
diff changeset
  1314
        //Check if @see is an href or "string"
06bc494ca11e Initial load
duke
parents:
diff changeset
  1315
        if (seetext.startsWith("<") || seetext.startsWith("\"")) {
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1316
            return new RawHtml(seetext);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1317
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1318
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1319
        boolean plain = tagName.equalsIgnoreCase("@linkplain");
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1320
        Content label = plainOrCode(plain, new RawHtml(see.label()));
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1321
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1322
        //The text from the @see tag.  We will output this text when a label is not specified.
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1323
        Content text = plainOrCode(plain, new RawHtml(seetext));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1324
06bc494ca11e Initial load
duke
parents:
diff changeset
  1325
        ClassDoc refClass = see.referencedClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1326
        String refClassName = see.referencedClassName();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1327
        MemberDoc refMem = see.referencedMember();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1328
        String refMemName = see.referencedMemberName();
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1329
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1330
        if (refClass == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1331
            //@see is not referencing an included class
06bc494ca11e Initial load
duke
parents:
diff changeset
  1332
            PackageDoc refPackage = see.referencedPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1333
            if (refPackage != null && refPackage.isIncluded()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1334
                //@see is referencing an included package
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1335
                if (label.isEmpty())
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1336
                    label = plainOrCode(plain, new StringContent(refPackage.name()));
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1337
                return getPackageLink(refPackage, label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1338
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1339
                //@see is not referencing an included class or package.  Check for cross links.
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1340
                Content classCrossLink;
14358
9eda9239cba0 8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents: 14357
diff changeset
  1341
                DocLink packageCrossLink = getCrossPackageLink(refClassName);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1342
                if (packageCrossLink != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1343
                    //Package cross link found
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1344
                    return getHyperLink(packageCrossLink,
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1345
                        (label.isEmpty() ? text : label));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1346
                } else if ((classCrossLink = getCrossClassLink(refClassName,
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1347
                        refMemName, label, false, "", !plain)) != null) {
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1348
                    //Class cross link found (possibly to a member in the class)
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1349
                    return classCrossLink;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1350
                } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1351
                    //No cross link found so print warning
06bc494ca11e Initial load
duke
parents:
diff changeset
  1352
                    configuration.getDocletSpecificMsg().warning(see.position(), "doclet.see.class_or_package_not_found",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1353
                            tagName, seetext);
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1354
                    return (label.isEmpty() ? text: label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1355
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1356
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1357
        } else if (refMemName == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1358
            // Must be a class reference since refClass is not null and refMemName is null.
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1359
            if (label.isEmpty()) {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1360
                label = plainOrCode(plain, new StringContent(refClass.name()));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1361
            }
17561
9f3505f35da9 8011651: simplify LinkInfoImpl API
jjg
parents: 17560
diff changeset
  1362
            return getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, refClass)
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1363
                    .label(label));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1364
        } else if (refMem == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1365
            // Must be a member reference since refClass is not null and refMemName is not null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1366
            // However, refMem is null, so this referenced member does not exist.
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1367
            return (label.isEmpty() ? text: label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1368
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1369
            // Must be a member reference since refClass is not null and refMemName is not null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1370
            // refMem is not null, so this @see tag must be referencing a valid member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1371
            ClassDoc containing = refMem.containingClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1372
            if (see.text().trim().startsWith("#") &&
06bc494ca11e Initial load
duke
parents:
diff changeset
  1373
                ! (containing.isPublic() ||
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
  1374
                utils.isLinkable(containing, configuration))) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1375
                // Since the link is relative and the holder is not even being
06bc494ca11e Initial load
duke
parents:
diff changeset
  1376
                // documented, this must be an inherited link.  Redirect it.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1377
                // The current class either overrides the referenced member or
06bc494ca11e Initial load
duke
parents:
diff changeset
  1378
                // inherits it automatically.
3891
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1379
                if (this instanceof ClassWriterImpl) {
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1380
                    containing = ((ClassWriterImpl) this).getClassDoc();
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1381
                } else if (!containing.isPublic()){
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1382
                    configuration.getDocletSpecificMsg().warning(
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1383
                        see.position(), "doclet.see.class_or_package_not_accessible",
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1384
                        tagName, containing.qualifiedName());
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1385
                } else {
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1386
                    configuration.getDocletSpecificMsg().warning(
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1387
                        see.position(), "doclet.see.class_or_package_not_found",
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1388
                        tagName, seetext);
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1389
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1390
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1391
            if (configuration.currentcd != containing) {
23794
9437acfa99e9 8031625: javadoc problems referencing inner class constructors
bpatel
parents: 23123
diff changeset
  1392
                refMemName = (refMem instanceof ConstructorDoc) ?
9437acfa99e9 8031625: javadoc problems referencing inner class constructors
bpatel
parents: 23123
diff changeset
  1393
                        refMemName : containing.name() + "." + refMemName;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1394
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1395
            if (refMem instanceof ExecutableMemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1396
                if (refMemName.indexOf('(') < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1397
                    refMemName += ((ExecutableMemberDoc)refMem).signature();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1398
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1399
            }
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1400
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1401
            text = plainOrCode(plain, new StringContent(refMemName));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1402
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 17547
diff changeset
  1403
            return getDocLink(LinkInfoImpl.Kind.SEE_TAG, containing,
17569
ef80738645e2 8012178: Cleanup use of Util.escapeHtmlChars
jjg
parents: 17568
diff changeset
  1404
                refMem, (label.isEmpty() ? text: label), false);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1405
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1406
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1407
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1408
    private Content plainOrCode(boolean plain, Content body) {
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1409
        return (plain || body.isEmpty()) ? body : HtmlTree.CODE(body);
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1410
    }
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  1411
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1412
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1413
     * Add the inline comment.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1414
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1415
     * @param doc the doc for which the inline comment will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1416
     * @param tag the inline tag to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1417
     * @param htmltree the content tree to which the comment will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1418
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1419
    public void addInlineComment(Doc doc, Tag tag, Content htmltree) {
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1420
        addCommentTags(doc, tag, tag.inlineTags(), false, false, htmltree);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1421
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1422
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1423
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1424
     * Add the inline deprecated comment.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1425
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1426
     * @param doc the doc for which the inline deprecated comment will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1427
     * @param tag the inline tag to be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1428
     * @param htmltree the content tree to which the comment will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1429
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1430
    public void addInlineDeprecatedComment(Doc doc, Tag tag, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1431
        addCommentTags(doc, tag.inlineTags(), true, false, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1432
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1433
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1434
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1435
     * Adds the summary content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1436
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1437
     * @param doc the doc for which the summary will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1438
     * @param htmltree the documentation tree to which the summary will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1439
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1440
    public void addSummaryComment(Doc doc, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1441
        addSummaryComment(doc, doc.firstSentenceTags(), htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1442
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1443
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1444
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1445
     * Adds the summary content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1446
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1447
     * @param doc the doc for which the summary will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1448
     * @param firstSentenceTags the first sentence tags for the doc
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1449
     * @param htmltree the documentation tree to which the summary will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1450
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1451
    public void addSummaryComment(Doc doc, Tag[] firstSentenceTags, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1452
        addCommentTags(doc, firstSentenceTags, false, true, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1453
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1454
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1455
    public void addSummaryDeprecatedComment(Doc doc, Tag tag, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1456
        addCommentTags(doc, tag.firstSentenceTags(), true, true, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1457
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1458
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1459
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1460
     * Adds the inline comment.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1461
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1462
     * @param doc the doc for which the inline comments will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1463
     * @param htmltree the documentation tree to which the inline comments will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1464
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1465
    public void addInlineComment(Doc doc, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1466
        addCommentTags(doc, doc.inlineTags(), false, false, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1467
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1468
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1469
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1470
     * Adds the comment tags.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1471
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1472
     * @param doc the doc for which the comment tags will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1473
     * @param tags the first sentence tags for the doc
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1474
     * @param depr true if it is deprecated
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1475
     * @param first true if the first sentence tags should be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1476
     * @param htmltree the documentation tree to which the comment tags will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1477
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1478
    private void addCommentTags(Doc doc, Tag[] tags, boolean depr,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1479
            boolean first, Content htmltree) {
17547
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1480
        addCommentTags(doc, null, tags, depr, first, htmltree);
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1481
    }
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1482
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1483
    /**
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1484
     * Adds the comment tags.
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1485
     *
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1486
     * @param doc the doc for which the comment tags will be generated
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1487
     * @param holderTag the block tag context for the inline tags
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1488
     * @param tags the first sentence tags for the doc
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1489
     * @param depr true if it is deprecated
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1490
     * @param first true if the first sentence tags should be added
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1491
     * @param htmltree the documentation tree to which the comment tags will be added
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1492
     */
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1493
    private void addCommentTags(Doc doc, Tag holderTag, Tag[] tags, boolean depr,
40f2f9a5a445 8008768: Using {@inheritDoc} in simple tag defined via -tag fails
jjg
parents: 16964
diff changeset
  1494
            boolean first, Content htmltree) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1495
        if(configuration.nocomment){
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1496
            return;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1497
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1498
        Content div;
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1499
        Content result = commentTagsToContent(null, doc, tags, first);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1500
        if (depr) {
21478
fa4c7cda1b41 8026567: Use meaningful style names for strong and italic styles.
bpatel
parents: 21008
diff changeset
  1501
            Content italic = HtmlTree.SPAN(HtmlStyle.deprecationComment, result);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1502
            div = HtmlTree.DIV(HtmlStyle.block, italic);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1503
            htmltree.addContent(div);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1504
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1505
        else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1506
            div = HtmlTree.DIV(HtmlStyle.block, result);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1507
            htmltree.addContent(div);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1508
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1509
        if (tags.length == 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1510
            htmltree.addContent(getSpace());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1511
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1512
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1513
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1514
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1515
     * Converts inline tags and text to text strings, expanding the
06bc494ca11e Initial load
duke
parents:
diff changeset
  1516
     * inline tags along the way.  Called wherever text can contain
06bc494ca11e Initial load
duke
parents:
diff changeset
  1517
     * an inline tag, such as in comments or in free-form text arguments
06bc494ca11e Initial load
duke
parents:
diff changeset
  1518
     * to non-inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1519
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1520
     * @param holderTag    specific tag where comment resides
06bc494ca11e Initial load
duke
parents:
diff changeset
  1521
     * @param doc    specific doc where comment resides
06bc494ca11e Initial load
duke
parents:
diff changeset
  1522
     * @param tags   array of text tags and inline tags (often alternating)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1523
     *               present in the text of interest for this doc
06bc494ca11e Initial load
duke
parents:
diff changeset
  1524
     * @param isFirstSentence  true if text is first sentence
06bc494ca11e Initial load
duke
parents:
diff changeset
  1525
     */
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1526
    public Content commentTagsToContent(Tag holderTag, Doc doc, Tag[] tags,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1527
            boolean isFirstSentence) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1528
        Content result = new ContentBuilder();
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1529
        boolean textTagChange = false;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1530
        // Array of all possible inline tags for this javadoc run
06bc494ca11e Initial load
duke
parents:
diff changeset
  1531
        configuration.tagletManager.checkTags(doc, tags, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1532
        for (int i = 0; i < tags.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1533
            Tag tagelem = tags[i];
06bc494ca11e Initial load
duke
parents:
diff changeset
  1534
            String tagName = tagelem.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1535
            if (tagelem instanceof SeeTag) {
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1536
                result.addContent(seeTagToContent((SeeTag) tagelem));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1537
            } else if (! tagName.equals("Text")) {
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1538
                boolean wasEmpty = result.isEmpty();
22005
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1539
                Content output;
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1540
                if (configuration.docrootparent.length() > 0
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1541
                        && tagelem.name().equals("@docRoot")
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1542
                        && ((tags[i + 1]).text()).startsWith("/..")) {
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1543
                    // If Xdocrootparent switch ON, set the flag to remove the /.. occurrence after
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1544
                    // {@docRoot} tag in the very next Text tag.
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1545
                    textTagChange = true;
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1546
                    // Replace the occurrence of {@docRoot}/.. with the absolute link.
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1547
                    output = new StringContent(configuration.docrootparent);
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1548
                } else {
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1549
                    output = TagletWriter.getInlineTagOuput(
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1550
                            configuration.tagletManager, holderTag,
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1551
                            tagelem, getTagletWriterInstance(isFirstSentence));
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1552
                }
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1553
                if (output != null)
17574
044c7e1e4d53 8012308: Remove TagletOutput in favor of direct use of Content
jjg
parents: 17573
diff changeset
  1554
                    result.addContent(output);
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1555
                if (wasEmpty && isFirstSentence && tagelem.name().equals("@inheritDoc") && !result.isEmpty()) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1556
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1557
                } else {
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1558
                    continue;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1559
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1560
            } else {
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1561
                String text = tagelem.text();
22005
4270ada5dcd1 8025416: doclet not substituting {@docRoot} in some cases
bpatel
parents: 21494
diff changeset
  1562
                //If Xdocrootparent switch ON, remove the /.. occurrence after {@docRoot} tag.
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1563
                if (textTagChange) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1564
                    text = text.replaceFirst("/..", "");
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1565
                    textTagChange = false;
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1566
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1567
                //This is just a regular text tag.  The text may contain html links (<a>)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1568
                //or inline tag {@docRoot}, which will be handled as special cases.
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1569
                text = redirectRelativeLinks(tagelem.holder(), text);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1570
06bc494ca11e Initial load
duke
parents:
diff changeset
  1571
                // Replace @docRoot only if not represented by an instance of DocRootTaglet,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1572
                // that is, only if it was not present in a source file doc comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1573
                // This happens when inserted by the doclet (a few lines
06bc494ca11e Initial load
duke
parents:
diff changeset
  1574
                // above in this method).  [It might also happen when passed in on the command
06bc494ca11e Initial load
duke
parents:
diff changeset
  1575
                // line as a text argument to an option (like -header).]
06bc494ca11e Initial load
duke
parents:
diff changeset
  1576
                text = replaceDocRootDir(text);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1577
                if (isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1578
                    text = removeNonInlineHtmlTags(text);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1579
                }
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
  1580
                text = utils.replaceTabs(configuration, text);
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
  1581
                text = utils.normalizeNewlines(text);
17571
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1582
                result.addContent(new RawHtml(text));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1583
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1584
        }
17568
d9691936f5f9 8012177: HTMLDocletWriter methods should generate Content, not Strings
jjg
parents: 17567
diff changeset
  1585
        return result;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1586
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1587
06bc494ca11e Initial load
duke
parents:
diff changeset
  1588
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1589
     * Return true if relative links should not be redirected.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1590
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1591
     * @return Return true if a relative link should not be redirected.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1592
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1593
    private boolean shouldNotRedirectRelativeLinks() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1594
        return  this instanceof AnnotationTypeWriter ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1595
                this instanceof ClassWriter ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1596
                this instanceof PackageSummaryWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1597
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1598
06bc494ca11e Initial load
duke
parents:
diff changeset
  1599
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1600
     * Suppose a piece of documentation has a relative link.  When you copy
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1601
     * that documentation to another place such as the index or class-use page,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1602
     * that relative link will no longer work.  We should redirect those links
06bc494ca11e Initial load
duke
parents:
diff changeset
  1603
     * so that they will work again.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1604
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  1605
     * Here is the algorithm used to fix the link:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1606
     * <p>
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  1607
     * {@literal <relative link> => docRoot + <relative path to file> + <relative link> }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1608
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  1609
     * For example, suppose com.sun.javadoc.RootDoc has this link:
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  1610
     * {@literal <a href="package-summary.html">The package Page</a> }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1611
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  1612
     * If this link appeared in the index, we would redirect
06bc494ca11e Initial load
duke
parents:
diff changeset
  1613
     * the link like this:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1614
     *
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  1615
     * {@literal <a href="./com/sun/javadoc/package-summary.html">The package Page</a>}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1616
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1617
     * @param doc the Doc object whose documentation is being written.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1618
     * @param text the text being written.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1619
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1620
     * @return the text, with all the relative links redirected to work.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1621
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1622
    private String redirectRelativeLinks(Doc doc, String text) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1623
        if (doc == null || shouldNotRedirectRelativeLinks()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1624
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1625
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1626
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1627
        DocPath redirectPathFromRoot;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1628
        if (doc instanceof ClassDoc) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1629
            redirectPathFromRoot = DocPath.forPackage(((ClassDoc) doc).containingPackage());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1630
        } else if (doc instanceof MemberDoc) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1631
            redirectPathFromRoot = DocPath.forPackage(((MemberDoc) doc).containingPackage());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1632
        } else if (doc instanceof PackageDoc) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1633
            redirectPathFromRoot = DocPath.forPackage((PackageDoc) doc);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1634
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1635
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1636
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1637
06bc494ca11e Initial load
duke
parents:
diff changeset
  1638
        //Redirect all relative links.
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
  1639
        int end, begin = StringUtils.indexOfIgnoreCase(text, "<a");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1640
        if(begin >= 0){
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
  1641
            StringBuilder textBuff = new StringBuilder(text);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1642
06bc494ca11e Initial load
duke
parents:
diff changeset
  1643
            while(begin >=0){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1644
                if (textBuff.length() > begin + 2 && ! Character.isWhitespace(textBuff.charAt(begin+2))) {
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
  1645
                    begin = StringUtils.indexOfIgnoreCase(textBuff.toString(), "<a", begin + 1);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1646
                    continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1647
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1648
06bc494ca11e Initial load
duke
parents:
diff changeset
  1649
                begin = textBuff.indexOf("=", begin) + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1650
                end = textBuff.indexOf(">", begin +1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1651
                if(begin == 0){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1652
                    //Link has no equal symbol.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1653
                    configuration.root.printWarning(
06bc494ca11e Initial load
duke
parents:
diff changeset
  1654
                        doc.position(),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1655
                        configuration.getText("doclet.malformed_html_link_tag", text));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1656
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1657
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1658
                if (end == -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1659
                    //Break without warning.  This <a> tag is not necessarily malformed.  The text
06bc494ca11e Initial load
duke
parents:
diff changeset
  1660
                    //might be missing '>' character because the href has an inline tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1661
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1662
                }
23123
fd8ad69ac7fe 6457406: javadoc doesn't handle <a href='http://...'> properly in producing index pages
yan
parents: 22163
diff changeset
  1663
fd8ad69ac7fe 6457406: javadoc doesn't handle <a href='http://...'> properly in producing index pages
yan
parents: 22163
diff changeset
  1664
                String quote = textBuff.substring(begin, end);
fd8ad69ac7fe 6457406: javadoc doesn't handle <a href='http://...'> properly in producing index pages
yan
parents: 22163
diff changeset
  1665
                quote = quote.contains("\"") ? "\"" :
fd8ad69ac7fe 6457406: javadoc doesn't handle <a href='http://...'> properly in producing index pages
yan
parents: 22163
diff changeset
  1666
                        quote.contains("\'") ? "\'" : null;
fd8ad69ac7fe 6457406: javadoc doesn't handle <a href='http://...'> properly in producing index pages
yan
parents: 22163
diff changeset
  1667
                if (quote != null) {
fd8ad69ac7fe 6457406: javadoc doesn't handle <a href='http://...'> properly in producing index pages
yan
parents: 22163
diff changeset
  1668
                    begin = textBuff.indexOf(quote, begin) + 1;
fd8ad69ac7fe 6457406: javadoc doesn't handle <a href='http://...'> properly in producing index pages
yan
parents: 22163
diff changeset
  1669
                    end = textBuff.indexOf(quote, begin +1);
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1670
                    if (begin == 0 || end == -1){
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1671
                        //Link is missing a quote.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1672
                        break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1673
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1674
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1675
                String relativeLink = textBuff.substring(begin, end);
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 22005
diff changeset
  1676
                String relativeLinkLowerCase = StringUtils.toLowerCase(relativeLink);
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 22005
diff changeset
  1677
                if (!(relativeLinkLowerCase.startsWith("mailto:") ||
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 22005
diff changeset
  1678
                        relativeLinkLowerCase.startsWith("http:") ||
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 22005
diff changeset
  1679
                        relativeLinkLowerCase.startsWith("https:") ||
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 22005
diff changeset
  1680
                        relativeLinkLowerCase.startsWith("file:"))) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1681
                    relativeLink = "{@"+(new DocRootTaglet()).getName() + "}/"
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1682
                        + redirectPathFromRoot.resolve(relativeLink).getPath();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1683
                    textBuff.replace(begin, end, relativeLink);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1684
                }
24603
43e7e44d63da 8043186: javac test langtools/tools/javac/util/StringUtilsTest.java fails
jlahoda
parents: 24221
diff changeset
  1685
                begin = StringUtils.indexOfIgnoreCase(textBuff.toString(), "<a", begin + 1);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1686
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1687
            return textBuff.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1688
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1689
        return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1690
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1691
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22160
diff changeset
  1692
    static final Set<String> blockTags = new HashSet<>();
17571
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1693
    static {
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1694
        for (HtmlTag t: HtmlTag.values()) {
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1695
            if (t.blockType == HtmlTag.BlockType.BLOCK)
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1696
                blockTags.add(t.value);
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1697
        }
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1698
    }
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1699
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1700
    public static String removeNonInlineHtmlTags(String text) {
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1701
        final int len = text.length();
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1702
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1703
        int startPos = 0;                     // start of text to copy
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1704
        int lessThanPos = text.indexOf('<');  // position of latest '<'
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1705
        if (lessThanPos < 0) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1706
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1707
        }
17571
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1708
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1709
        StringBuilder result = new StringBuilder();
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1710
    main: while (lessThanPos != -1) {
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1711
            int currPos = lessThanPos + 1;
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1712
            if (currPos == len)
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1713
                break;
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1714
            char ch = text.charAt(currPos);
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1715
            if (ch == '/') {
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1716
                if (++currPos == len)
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1717
                    break;
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1718
                ch = text.charAt(currPos);
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1719
            }
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1720
            int tagPos = currPos;
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1721
            while (isHtmlTagLetterOrDigit(ch)) {
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1722
                if (++currPos == len)
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1723
                    break main;
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1724
                ch = text.charAt(currPos);
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1725
            }
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 22005
diff changeset
  1726
            if (ch == '>' && blockTags.contains(StringUtils.toLowerCase(text.substring(tagPos, currPos)))) {
17571
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1727
                result.append(text, startPos, lessThanPos);
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1728
                startPos = currPos + 1;
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1729
            }
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1730
            lessThanPos = text.indexOf('<', currPos);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1731
        }
17571
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1732
        result.append(text.substring(startPos));
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1733
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1734
        return result.toString();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1735
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1736
17578
46ac954e4a84 8013852: update reference impl for type-annotations
jjg
parents: 17577
diff changeset
  1737
    private static boolean isHtmlTagLetterOrDigit(char ch) {
17571
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1738
        return ('a' <= ch && ch <= 'z') ||
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1739
                ('A' <= ch && ch <= 'Z') ||
50895ba58e0d 8012180: Speed up removeNonInlineHtmlTags
jjg
parents: 17570
diff changeset
  1740
                ('1' <= ch && ch <= '6');
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1741
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1742
06bc494ca11e Initial load
duke
parents:
diff changeset
  1743
    /**
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1744
     * Add a link to the stylesheet file.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1745
     *
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1746
     * @param head the content tree to which the files will be added
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1747
     */
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1748
    public void addStyleSheetProperties(Content head) {
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
  1749
        String stylesheetfile = configuration.stylesheetfile;
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1750
        DocPath stylesheet;
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
  1751
        if (stylesheetfile.isEmpty()) {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
  1752
            stylesheet = DocPaths.STYLESHEET;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1753
        } else {
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
  1754
            DocFile file = DocFile.createFileForInput(configuration, stylesheetfile);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14366
diff changeset
  1755
            stylesheet = DocPath.create(file.getName());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1756
        }
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1757
        HtmlTree link = HtmlTree.LINK("stylesheet", "text/css",
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1758
                pathToRoot.resolve(stylesheet).getPath(),
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14266
diff changeset
  1759
                "Style");
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1760
        head.addContent(link);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1761
        if (configuration.createindex) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1762
            HtmlTree jq_link = HtmlTree.LINK("stylesheet", "text/css",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1763
                    pathToRoot.resolve(DocPaths.JQUERY_FILES.resolve(DocPaths.JQUERY_STYLESHEET_FILE)).getPath(),
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1764
                    "Style");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1765
            head.addContent(jq_link);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1766
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1767
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1768
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1769
    /**
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1770
     * Add a link to the JavaScript file.
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
  1771
     *
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1772
     * @param head the content tree to which the files will be added
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
  1773
     */
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1774
    public void addScriptProperties(Content head) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1775
        HtmlTree javascript = HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath());
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1776
        head.addContent(javascript);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1777
        if (configuration.createindex) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1778
            if (pathToRoot != null && script != null) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1779
                String path = pathToRoot.isEmpty() ? "." : pathToRoot.getPath();
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1780
                script.addContent(new RawHtml("var pathtoroot = \"" + path + "/\";loadScripts(document, \'script\');"));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1781
            }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1782
            addJQueryFile(head, DocPaths.JSZIP_MIN);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1783
            addJQueryFile(head, DocPaths.JSZIPUTILS_MIN);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1784
            head.addContent(new RawHtml("<!--[if IE]>"));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1785
            addJQueryFile(head, DocPaths.JSZIPUTILS_IE_MIN);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1786
            head.addContent(new RawHtml("<![endif]-->"));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1787
            addJQueryFile(head, DocPaths.JQUERY_JS_1_10);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1788
            addJQueryFile(head, DocPaths.JQUERY_JS);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1789
        }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1790
    }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1791
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1792
    /**
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1793
     * Add a link to the JQuery javascript file.
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1794
     *
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1795
     * @param head the content tree to which the files will be added
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1796
     * @param filePath the DocPath of the file that needs to be added
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1797
     */
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1798
    private void addJQueryFile(Content head, DocPath filePath) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1799
        HtmlTree jqyeryScriptFile = HtmlTree.SCRIPT(
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1800
                pathToRoot.resolve(DocPaths.JQUERY_FILES.resolve(filePath)).getPath());
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31943
diff changeset
  1801
        head.addContent(jqyeryScriptFile);
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
  1802
    }
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
  1803
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
  1804
    /**
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 8631
diff changeset
  1805
     * According to
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 8631
diff changeset
  1806
     * <cite>The Java&trade; Language Specification</cite>,
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 8631
diff changeset
  1807
     * all the outer classes and static nested classes are core classes.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1808
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1809
    public boolean isCoreClass(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1810
        return cd.containingClass() == null || cd.isStatic();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1811
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1812
06bc494ca11e Initial load
duke
parents:
diff changeset
  1813
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1814
     * Adds the annotatation types for the given packageDoc.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1815
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1816
     * @param packageDoc the package to write annotations for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1817
     * @param htmltree the documentation tree to which the annotation info will be
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1818
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1819
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1820
    public void addAnnotationInfo(PackageDoc packageDoc, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1821
        addAnnotationInfo(packageDoc, packageDoc.annotations(), htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1822
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1823
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1824
    /**
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1825
     * Add the annotation types of the executable receiver.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1826
     *
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1827
     * @param method the executable to write the receiver annotations for.
16964
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 16319
diff changeset
  1828
     * @param descList list of annotation description.
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1829
     * @param htmltree the documentation tree to which the annotation info will be
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1830
     *        added
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1831
     */
16964
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 16319
diff changeset
  1832
    public void addReceiverAnnotationInfo(ExecutableMemberDoc method, AnnotationDesc[] descList,
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 16319
diff changeset
  1833
            Content htmltree) {
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 16319
diff changeset
  1834
        addAnnotationInfo(0, method, descList, false, htmltree);
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1835
    }
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1836
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1837
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1838
     * Adds the annotatation types for the given doc.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1839
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
  1840
     * @param doc the package to write annotations for
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1841
     * @param htmltree the content tree to which the annotation types will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1842
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1843
    public void addAnnotationInfo(ProgramElementDoc doc, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1844
        addAnnotationInfo(doc, doc.annotations(), htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1845
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1846
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1847
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1848
     * Add the annotatation types for the given doc and parameter.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1849
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1850
     * @param indent the number of spaces to indent the parameters.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1851
     * @param doc the doc to write annotations for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1852
     * @param param the parameter to write annotations for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1853
     * @param tree the content tree to which the annotation types will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1854
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1855
    public boolean addAnnotationInfo(int indent, Doc doc, Parameter param,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1856
            Content tree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1857
        return addAnnotationInfo(indent, doc, param.annotations(), false, tree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1858
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1859
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1860
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1861
     * Adds the annotatation types for the given doc.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1862
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1863
     * @param doc the doc to write annotations for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1864
     * @param descList the array of {@link AnnotationDesc}.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1865
     * @param htmltree the documentation tree to which the annotation info will be
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1866
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1867
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1868
    private void addAnnotationInfo(Doc doc, AnnotationDesc[] descList,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1869
            Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1870
        addAnnotationInfo(0, doc, descList, true, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1871
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1872
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1873
    /**
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1874
     * Adds the annotation types for the given doc.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1875
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1876
     * @param indent the number of extra spaces to indent the annotations.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1877
     * @param doc the doc to write annotations for.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1878
     * @param descList the array of {@link AnnotationDesc}.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1879
     * @param htmltree the documentation tree to which the annotation info will be
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1880
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1881
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1882
    private boolean addAnnotationInfo(int indent, Doc doc,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1883
            AnnotationDesc[] descList, boolean lineBreak, Content htmltree) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1884
        List<Content> annotations = getAnnotations(indent, descList, lineBreak);
16964
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 16319
diff changeset
  1885
        String sep ="";
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1886
        if (annotations.isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1887
            return false;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1888
        }
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1889
        for (Content annotation: annotations) {
16964
096de5815398 8005091: javadoc should be able to return the receiver type
bpatel
parents: 16319
diff changeset
  1890
            htmltree.addContent(sep);
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1891
            htmltree.addContent(annotation);
31943
72b69ab429c9 8062647: Wrong indentation of arguments of annotated methods
igerasim
parents: 31297
diff changeset
  1892
            if (!lineBreak) {
72b69ab429c9 8062647: Wrong indentation of arguments of annotated methods
igerasim
parents: 31297
diff changeset
  1893
                sep = " ";
72b69ab429c9 8062647: Wrong indentation of arguments of annotated methods
igerasim
parents: 31297
diff changeset
  1894
            }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1895
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1896
        return true;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1897
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1898
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1899
   /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1900
     * Return the string representations of the annotation types for
06bc494ca11e Initial load
duke
parents:
diff changeset
  1901
     * the given doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1902
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1903
     * @param indent the number of extra spaces to indent the annotations.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1904
     * @param descList the array of {@link AnnotationDesc}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1905
     * @param linkBreak if true, add new line between each member value.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1906
     * @return an array of strings representing the annotations being
06bc494ca11e Initial load
duke
parents:
diff changeset
  1907
     *         documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1908
     */
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1909
    private List<Content> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) {
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1910
        return getAnnotations(indent, descList, linkBreak, true);
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1911
    }
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1912
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1913
    /**
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1914
     * Return the string representations of the annotation types for
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1915
     * the given doc.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1916
     *
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1917
     * A {@code null} {@code elementType} indicates that all the
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1918
     * annotations should be returned without any filtering.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1919
     *
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1920
     * @param indent the number of extra spaces to indent the annotations.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1921
     * @param descList the array of {@link AnnotationDesc}.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1922
     * @param linkBreak if true, add new line between each member value.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1923
     * @param elementType the type of targeted element (used for filtering
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1924
     *        type annotations from declaration annotations)
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1925
     * @return an array of strings representing the annotations being
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1926
     *         documented.
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1927
     */
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1928
    public List<Content> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak,
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1929
            boolean isJava5DeclarationLocation) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22160
diff changeset
  1930
        List<Content> results = new ArrayList<>();
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1931
        ContentBuilder annotation;
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  1932
        for (AnnotationDesc aDesc : descList) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  1933
            AnnotationTypeDoc annotationDoc = aDesc.annotationType();
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1934
            // If an annotation is not documented, do not add it to the list. If
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1935
            // the annotation is of a repeatable type, and if it is not documented
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1936
            // and also if its container annotation is not documented, do not add it
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1937
            // to the list. If an annotation of a repeatable type is not documented
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1938
            // but its container is documented, it will be added to the list.
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
  1939
            if (!utils.isDocumentedAnnotation(annotationDoc) &&
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  1940
                (!isAnnotationDocumented && !isContainerDocumented)) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1941
                continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1942
            }
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1943
            /* TODO: check logic here to correctly handle declaration
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1944
             * and type annotations.
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
  1945
            if  (util.isDeclarationAnnotation(annotationDoc, isJava5DeclarationLocation)) {
15385
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1946
                continue;
ee1eebe7e210 8006775: JSR 308: Compiler changes in JDK8
jjg
parents: 15035
diff changeset
  1947
            }*/
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1948
            annotation = new ContentBuilder();
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1949
            isAnnotationDocumented = false;
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
  1950
            LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  1951
                                                     LinkInfoImpl.Kind.ANNOTATION, annotationDoc);
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  1952
            AnnotationDesc.ElementValuePair[] pairs = aDesc.elementValues();
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1953
            // If the annotation is synthesized, do not print the container.
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  1954
            if (aDesc.isSynthesized()) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  1955
                for (AnnotationDesc.ElementValuePair pair : pairs) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  1956
                    AnnotationValue annotationValue = pair.value();
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22160
diff changeset
  1957
                    List<AnnotationValue> annotationTypeValues = new ArrayList<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1958
                    if (annotationValue.value() instanceof AnnotationValue[]) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1959
                        AnnotationValue[] annotationArray =
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1960
                                (AnnotationValue[]) annotationValue.value();
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1961
                        annotationTypeValues.addAll(Arrays.asList(annotationArray));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1962
                    } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1963
                        annotationTypeValues.add(annotationValue);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1964
                    }
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1965
                    String sep = "";
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1966
                    for (AnnotationValue av : annotationTypeValues) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1967
                        annotation.addContent(sep);
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1968
                        annotation.addContent(annotationValueToContent(av));
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1969
                        sep = " ";
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1970
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1971
                }
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1972
            }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1973
            else if (isAnnotationArray(pairs)) {
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1974
                // If the container has 1 or more value defined and if the
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1975
                // repeatable type annotation is not documented, do not print
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1976
                // the container.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1977
                if (pairs.length == 1 && isAnnotationDocumented) {
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1978
                    AnnotationValue[] annotationArray =
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1979
                            (AnnotationValue[]) (pairs[0].value()).value();
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22160
diff changeset
  1980
                    List<AnnotationValue> annotationTypeValues = new ArrayList<>();
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1981
                    annotationTypeValues.addAll(Arrays.asList(annotationArray));
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1982
                    String sep = "";
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1983
                    for (AnnotationValue av : annotationTypeValues) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1984
                        annotation.addContent(sep);
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  1985
                        annotation.addContent(annotationValueToContent(av));
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1986
                        sep = " ";
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1987
                    }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1988
                }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1989
                // If the container has 1 or more value defined and if the
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1990
                // repeatable type annotation is not documented, print the container.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1991
                else {
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1992
                    addAnnotations(annotationDoc, linkInfo, annotation, pairs,
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  1993
                                   indent, false);
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1994
                }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1995
            }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1996
            else {
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  1997
                addAnnotations(annotationDoc, linkInfo, annotation, pairs,
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  1998
                               indent, linkBreak);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1999
            }
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2000
            annotation.addContent(linkBreak ? DocletConstants.NL : "");
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2001
            results.add(annotation);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2002
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2003
        return results;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2004
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2005
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2006
    /**
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2007
     * Add annotation to the annotation string.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2008
     *
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2009
     * @param annotationDoc the annotation being documented
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2010
     * @param linkInfo the information about the link
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2011
     * @param annotation the annotation string to which the annotation will be added
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2012
     * @param pairs annotation type element and value pairs
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2013
     * @param indent the number of extra spaces to indent the annotations.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2014
     * @param linkBreak if true, add new line between each member value
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2015
     */
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2016
    private void addAnnotations(AnnotationTypeDoc annotationDoc, LinkInfoImpl linkInfo,
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2017
            ContentBuilder annotation, AnnotationDesc.ElementValuePair[] pairs,
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2018
            int indent, boolean linkBreak) {
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  2019
        linkInfo.label = new StringContent("@" + annotationDoc.name());
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2020
        annotation.addContent(getLink(linkInfo));
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2021
        if (pairs.length > 0) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2022
            annotation.addContent("(");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2023
            for (int j = 0; j < pairs.length; j++) {
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2024
                if (j > 0) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2025
                    annotation.addContent(",");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2026
                    if (linkBreak) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2027
                        annotation.addContent(DocletConstants.NL);
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2028
                        int spaces = annotationDoc.name().length() + 2;
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2029
                        for (int k = 0; k < (spaces + indent); k++) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2030
                            annotation.addContent(" ");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2031
                        }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2032
                    }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2033
                }
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2034
                annotation.addContent(getDocLink(LinkInfoImpl.Kind.ANNOTATION,
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2035
                        pairs[j].element(), pairs[j].element().name(), false));
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2036
                annotation.addContent("=");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2037
                AnnotationValue annotationValue = pairs[j].value();
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22160
diff changeset
  2038
                List<AnnotationValue> annotationTypeValues = new ArrayList<>();
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2039
                if (annotationValue.value() instanceof AnnotationValue[]) {
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2040
                    AnnotationValue[] annotationArray =
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2041
                            (AnnotationValue[]) annotationValue.value();
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2042
                    annotationTypeValues.addAll(Arrays.asList(annotationArray));
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2043
                } else {
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2044
                    annotationTypeValues.add(annotationValue);
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2045
                }
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2046
                annotation.addContent(annotationTypeValues.size() == 1 ? "" : "{");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2047
                String sep = "";
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2048
                for (AnnotationValue av : annotationTypeValues) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2049
                    annotation.addContent(sep);
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2050
                    annotation.addContent(annotationValueToContent(av));
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2051
                    sep = ",";
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2052
                }
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2053
                annotation.addContent(annotationTypeValues.size() == 1 ? "" : "}");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2054
                isContainerDocumented = false;
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2055
            }
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2056
            annotation.addContent(")");
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2057
        }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2058
    }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2059
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2060
    /**
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2061
     * Check if the annotation contains an array of annotation as a value. This
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2062
     * check is to verify if a repeatable type annotation is present or not.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2063
     *
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2064
     * @param pairs annotation type element and value pairs
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2065
     *
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2066
     * @return true if the annotation contains an array of annotation as a value.
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2067
     */
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2068
    private boolean isAnnotationArray(AnnotationDesc.ElementValuePair[] pairs) {
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2069
        AnnotationValue annotationValue;
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  2070
        for (AnnotationDesc.ElementValuePair pair : pairs) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
  2071
            annotationValue = pair.value();
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2072
            if (annotationValue.value() instanceof AnnotationValue[]) {
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2073
                AnnotationValue[] annotationArray =
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2074
                        (AnnotationValue[]) annotationValue.value();
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2075
                if (annotationArray.length > 1) {
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2076
                    if (annotationArray[0].value() instanceof AnnotationDesc) {
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2077
                        AnnotationTypeDoc annotationDoc =
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2078
                                ((AnnotationDesc) annotationArray[0].value()).annotationType();
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2079
                        isContainerDocumented = true;
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24603
diff changeset
  2080
                        if (utils.isDocumentedAnnotation(annotationDoc)) {
15035
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2081
                            isAnnotationDocumented = true;
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2082
                        }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2083
                        return true;
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2084
                    }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2085
                }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2086
            }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2087
        }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2088
        return false;
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2089
    }
d03c311f44e6 8005092: javadoc should check for synthesized bit on an annotation
bpatel
parents: 14549
diff changeset
  2090
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2091
    private Content annotationValueToContent(AnnotationValue annotationValue) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2092
        if (annotationValue.value() instanceof Type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2093
            Type type = (Type) annotationValue.value();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2094
            if (type.asClassDoc() != null) {
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
  2095
                LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 17547
diff changeset
  2096
                    LinkInfoImpl.Kind.ANNOTATION, type);
17560
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  2097
                linkInfo.label = new StringContent((type.asClassDoc().isIncluded() ?
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  2098
                    type.typeName() :
9f6771abbd1a 8011650: reduce use of RawHtml nodes in doclet
jjg
parents: 17559
diff changeset
  2099
                    type.qualifiedTypeName()) + type.dimension() + ".class");
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2100
                return getLink(linkInfo);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2101
            } else {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2102
                return new StringContent(type.typeName() + type.dimension() + ".class");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2103
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2104
        } else if (annotationValue.value() instanceof AnnotationDesc) {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2105
            List<Content> list = getAnnotations(0,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2106
                new AnnotationDesc[]{(AnnotationDesc) annotationValue.value()},
06bc494ca11e Initial load
duke
parents:
diff changeset
  2107
                    false);
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2108
            ContentBuilder buf = new ContentBuilder();
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2109
            for (Content c: list) {
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2110
                buf.addContent(c);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2111
            }
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2112
            return buf;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2113
        } else if (annotationValue.value() instanceof MemberDoc) {
17558
eee4ccf66cfd 8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents: 17547
diff changeset
  2114
            return getDocLink(LinkInfoImpl.Kind.ANNOTATION,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2115
                (MemberDoc) annotationValue.value(),
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2116
                ((MemberDoc) annotationValue.value()).name(), false);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2117
         } else {
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17569
diff changeset
  2118
            return new StringContent(annotationValue.toString());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2119
         }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2120
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2121
06bc494ca11e Initial load
duke
parents:
diff changeset
  2122
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  2123
     * Return the configuation for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2124
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  2125
     * @return the configuration for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2126
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2127
    public Configuration configuration() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2128
        return configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2129
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2130
}