langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
author jjg
Tue, 16 Oct 2012 21:03:36 -0700
changeset 14266 69453558960d
parent 14265 4e8e488eeae0
child 14357 faf9cde2817b
permissions -rw-r--r--
8000673: remove dead code from HtmlWriter and subtypes Reviewed-by: bpatel
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
     2
 * Copyright (c) 1998, 2012, 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.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    32
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
    33
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
    34
import com.sun.tools.doclets.internal.toolkit.*;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 13844
diff changeset
    35
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
    36
import com.sun.tools.doclets.internal.toolkit.util.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * Class for the Html Format Code Generation specific to JavaDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * This Class contains methods related to the Html Code Generation which
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * are used extensively while generating the entire documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    43
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    44
 *  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
    45
 *  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
    46
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14259
diff changeset
    47
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * @since 1.2
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * @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
    51
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
public class HtmlDocletWriter extends HtmlDocWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     * Relative path from the file getting generated to the destination
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     * directory. For example, if the file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     * "java/lang/Object.html", then the relative path string is "../../".
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     * This string can be empty if the file getting generated is in
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
     * the destination directory.
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    public String relativePath = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     * Same as relativepath, but normalized to never be empty or
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     * end with a slash.
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    public String relativepathNoSlash = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     * Platform-dependent directory path from the current or the
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     * destination directory to the file getting generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
     * Used when creating the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
     * For example, if the file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * "java/lang/Object.html", then the path string is "java/lang".
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    public String path = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     * Name of the file getting generated. If the file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     * "java/lang/Object.html", then the filename is "Object.html".
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    public String filename = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     * The display length used for indentation while generating the class page.
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
    public int displayLength = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     * The global configuration information for this run.
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    public ConfigurationImpl configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    96
     * 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
    97
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    98
    protected boolean printedAnnotationHeading = false;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
    99
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   100
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
     * Constructor to construct the HtmlStandardWriter object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
     * @param filename File to be generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    public HtmlDocletWriter(ConfigurationImpl configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
                              String filename) throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
        super(configuration, filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
        this.configuration = configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
        this.filename = filename;
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     * Constructor to construct the HtmlStandardWriter object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
     * @param path         Platform-dependent {@link #path} used when
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     *                     creating file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
     * @param filename     Name of file to be generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
     * @param relativePath Value for the variable {@link #relativePath}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
    public HtmlDocletWriter(ConfigurationImpl configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
                              String path, String filename,
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
                              String relativePath) throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
        super(configuration, path, filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
        this.configuration = configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        this.path = path;
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        this.relativePath = relativePath;
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
        this.relativepathNoSlash =
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
            DirectoryManager.getPathNoTrailingSlash(this.relativePath);
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
        this.filename = filename;
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     * Replace {&#064;docRoot} tag used in options that accept HTML text, such
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     * as -header, -footer, -top and -bottom, and when converting a relative
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     * HREF where commentTagsToString inserts a {&#064;docRoot} where one was
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * missing.  (Also see DocRootTaglet for {&#064;docRoot} tags in doc
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * comments.)
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * Replace {&#064;docRoot} tag in htmlstr with the relative path to the
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * destination directory from the directory where the file is being
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     * written, looping to handle all such tags in htmlstr.
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     * For example, for "-d docs" and -header containing {&#064;docRoot}, when
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     * the HTML page for source file p/C1.java is being generated, the
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     * {&#064;docRoot} tag would be inserted into the header as "../",
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
     * the relative path from docs/p/ to docs/ (the document root).
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
     * Note: This doc comment was written with '&amp;#064;' representing '@'
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
     * to prevent the inline tag from being interpreted.
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    public String replaceDocRootDir(String htmlstr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
        // Return if no inline tags exist
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
        int index = htmlstr.indexOf("{@");
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
        if (index < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
            return htmlstr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
        String lowerHtml = htmlstr.toLowerCase();
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
        // Return index of first occurrence of {@docroot}
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
        // Note: {@docRoot} is not case sensitive when passed in w/command line option
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
        index = lowerHtml.indexOf("{@docroot}", index);
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
        if (index < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
            return htmlstr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
        }
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
   164
        StringBuilder buf = new StringBuilder();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
        int previndex = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
        while (true) {
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   167
            if (configuration.docrootparent.length() > 0) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   168
                // Search for lowercase version of {@docRoot}/..
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   169
                index = lowerHtml.indexOf("{@docroot}/..", previndex);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   170
                // If next {@docRoot}/.. pattern not found, append rest of htmlstr and exit loop
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   171
                if (index < 0) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   172
                    buf.append(htmlstr.substring(previndex));
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   173
                    break;
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   174
                }
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   175
                // If next {@docroot}/.. pattern found, append htmlstr up to start of tag
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   176
                buf.append(htmlstr.substring(previndex, index));
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   177
                previndex = index + 13;  // length for {@docroot}/.. string
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   178
                // Insert docrootparent absolute path where {@docRoot}/.. was located
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   179
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   180
                buf.append(configuration.docrootparent);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   181
                // Append slash if next character is not a slash
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   182
                if (previndex < htmlstr.length() && htmlstr.charAt(previndex) != '/') {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   183
                    buf.append(DirectoryManager.URL_FILE_SEPARATOR);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   184
                }
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   185
            } else {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   186
                // Search for lowercase version of {@docRoot}
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   187
                index = lowerHtml.indexOf("{@docroot}", previndex);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   188
                // If next {@docRoot} tag not found, append rest of htmlstr and exit loop
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   189
                if (index < 0) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   190
                    buf.append(htmlstr.substring(previndex));
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   191
                    break;
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   192
                }
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   193
                // If next {@docroot} tag found, append htmlstr up to start of tag
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   194
                buf.append(htmlstr.substring(previndex, index));
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   195
                previndex = index + 10;  // length for {@docroot} string
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   196
                // Insert relative path where {@docRoot} was located
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   197
                buf.append(relativepathNoSlash);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   198
                // Append slash if next character is not a slash
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   199
                if (relativepathNoSlash.length() > 0 && previndex < htmlstr.length() &&
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   200
                        htmlstr.charAt(previndex) != '/') {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   201
                    buf.append(DirectoryManager.URL_FILE_SEPARATOR);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
   202
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
        return buf.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   209
     * 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
   210
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   211
     * @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
   212
     * @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
   213
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   214
    public Content getAllClassesLinkScript(String id) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   215
        HtmlTree script = new HtmlTree(HtmlTag.SCRIPT);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   216
        script.addAttr(HtmlAttr.TYPE, "text/javascript");
7641
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   217
        String scriptCode = "<!--" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   218
                "  allClassesLink = document.getElementById(\"" + id + "\");" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   219
                "  if(window==top) {" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   220
                "    allClassesLink.style.display = \"block\";" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   221
                "  }" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   222
                "  else {" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   223
                "    allClassesLink.style.display = \"none\";" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   224
                "  }" + DocletConstants.NL +
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   225
                "  //-->" + DocletConstants.NL;
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   226
        Content scriptContent = new RawHtml(scriptCode);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   227
        script.addContent(scriptContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   228
        Content div = HtmlTree.DIV(script);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   229
        return div;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   230
    }
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   233
     * Add method information.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   234
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   235
     * @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
   236
     * @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
   237
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   238
    private void addMethodInfo(MethodDoc method, Content dl) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   239
        ClassDoc[] intfacs = method.containingClass().interfaces();
06bc494ca11e Initial load
duke
parents:
diff changeset
   240
        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
   241
        // 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
   242
        // 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
   243
        // 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
   244
        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
   245
                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
   246
                overriddenMethod != null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   247
            MethodWriterImpl.addImplementsInfo(this, method, dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
            if (overriddenMethod != null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   249
                MethodWriterImpl.addOverridden(this,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   250
                        method.overriddenType(), overriddenMethod, 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
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   255
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   256
     * Adds the tags information.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   257
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   258
     * @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
   259
     * @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
   260
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   261
    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
   262
        if (configuration.nocomment) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   263
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   264
        }
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   265
        Content dl = new HtmlTree(HtmlTag.DL);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
        if (doc instanceof MethodDoc) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   267
            addMethodInfo((MethodDoc) doc, dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
        TagletOutputImpl output = new TagletOutputImpl("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
        TagletWriter.genTagOuput(configuration.tagletManager, doc,
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
            configuration.tagletManager.getCustomTags(doc),
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
                getTagletWriterInstance(false), output);
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   273
        String outputString = output.toString().trim();
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   274
        if (!outputString.isEmpty()) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   275
            Content resultString = new RawHtml(outputString);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   276
            dl.addContent(resultString);
10
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
        htmltree.addContent(dl);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
    /**
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   282
     * 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
   283
     * 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
   284
     *
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   285
     * @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
   286
     * @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
   287
     */
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   288
    protected boolean hasSerializationOverviewTags(FieldDoc field) {
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   289
        TagletOutputImpl output = new TagletOutputImpl("");
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   290
        TagletWriter.genTagOuput(configuration.tagletManager, field,
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   291
            configuration.tagletManager.getCustomTags(field),
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   292
                getTagletWriterInstance(false), output);
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   293
        return (!output.toString().trim().isEmpty());
2086
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   294
    }
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   295
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   296
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
     * Returns a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
     * @return a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
    public TagletWriter getTagletWriterInstance(boolean isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
        return new TagletWriterImpl(this, isFirstSentence);
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   306
     * Get Package link, with target frame.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   308
     * @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
   309
     * @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
   310
     * @param label tag for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   311
     * @return a content for the target package link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   313
    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
   314
            Content label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   315
        return getHyperLink(pathString(pd, "package-summary.html"), "", label, "", target);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   319
     * 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
   320
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   321
     * @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
   322
     *                     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
   323
     *                     Pass in null for no array
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   324
     * @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
   325
     *                      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
   326
     * @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
   327
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   328
    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
   329
            Content body) throws IOException {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   330
        Content htmlDocType = DocType.Transitional();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   331
        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
   332
        Content head = new HtmlTree(HtmlTag.HEAD);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   333
        if (!configuration.notimestamp) {
14262
058238ba531e 8000418: javadoc should used a standard "generated by javadoc" string
jjg
parents: 14260
diff changeset
   334
            Content headComment = new Comment(getGeneratedByString());
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   335
            head.addContent(headComment);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   336
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   337
        if (configuration.charset.length() > 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   338
            Content meta = HtmlTree.META("Content-Type", "text/html",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   339
                    configuration.charset);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   340
            head.addContent(meta);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   341
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   342
        head.addContent(getTitle());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   343
        if (!configuration.notimestamp) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   344
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   345
            Content meta = HtmlTree.META("date", dateFormat.format(new Date()));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   346
            head.addContent(meta);
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
        if (metakeywords != null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   349
            for (int i=0; i < metakeywords.length; i++) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   350
                Content meta = HtmlTree.META("keywords", metakeywords[i]);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   351
                head.addContent(meta);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   352
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   353
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   354
        head.addContent(getStyleSheetProperties());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   355
        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
   356
                head, body);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   357
        Content htmlDocument = new HtmlDocument(htmlDocType,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   358
                htmlComment, htmlTree);
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
   359
        write(htmlDocument);
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   360
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   361
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   362
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   363
     * Get the window title.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   364
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   365
     * @param 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
   366
     * @return the window title string
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
    public String getWindowTitle(String title) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   369
        if (configuration.windowtitle.length() > 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   370
            title += " (" + configuration.windowtitle  + ")";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   371
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   372
        return title;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   373
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   374
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   375
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   376
     * 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
   377
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   378
     * @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
   379
     * user provided footer.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   380
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   381
    public Content getUserHeaderFooter(boolean header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   382
        String content;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   383
        if (header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   384
            content = replaceDocRootDir(configuration.header);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   385
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   386
            if (configuration.footer.length() != 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   387
                content = replaceDocRootDir(configuration.footer);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   388
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   389
                content = replaceDocRootDir(configuration.header);
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
        Content rawContent = new RawHtml(content);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   393
        Content em = HtmlTree.EM(rawContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   394
        return em;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   395
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   396
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   397
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   398
     * Adds the user specified top.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   399
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   400
     * @param body the content tree to which user specified top will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   401
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   402
    public void addTop(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   403
        Content top = new RawHtml(replaceDocRootDir(configuration.top));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   404
        body.addContent(top);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   405
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   406
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   407
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   408
     * Adds the user specified bottom.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   409
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   410
     * @param body the content tree to which user specified bottom will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   411
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   412
    public void addBottom(Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   413
        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
   414
        Content small = HtmlTree.SMALL(bottom);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   415
        Content p = HtmlTree.P(HtmlStyle.legalCopy, small);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   416
        body.addContent(p);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   417
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   418
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   419
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   420
     * 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
   421
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   422
     * @param header If true print navigation bar at the top of the page else
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   423
     * @param body the HtmlTree to which the nav links will be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   424
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   425
    protected void addNavLinks(boolean header, Content body) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   426
        if (!configuration.nonavbar) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   427
            String allClassesId = "allclasses_";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   428
            HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   429
            if (header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   430
                body.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   431
                navDiv.addStyle(HtmlStyle.topNav);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   432
                allClassesId += "navbar_top";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   433
                Content a = getMarkerAnchor("navbar_top");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   434
                navDiv.addContent(a);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   435
                Content skipLinkContent = getHyperLink("",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   436
                        "skip-navbar_top", HtmlTree.EMPTY, configuration.getText(
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   437
                        "doclet.Skip_navigation_links"), "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   438
                navDiv.addContent(skipLinkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   439
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   440
                body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   441
                navDiv.addStyle(HtmlStyle.bottomNav);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   442
                allClassesId += "navbar_bottom";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   443
                Content a = getMarkerAnchor("navbar_bottom");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   444
                navDiv.addContent(a);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   445
                Content skipLinkContent = getHyperLink("",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   446
                        "skip-navbar_bottom", HtmlTree.EMPTY, configuration.getText(
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   447
                        "doclet.Skip_navigation_links"), "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   448
                navDiv.addContent(skipLinkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   449
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   450
            if (header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   451
                navDiv.addContent(getMarkerAnchor("navbar_top_firstrow"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   452
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   453
                navDiv.addContent(getMarkerAnchor("navbar_bottom_firstrow"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   454
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   455
            HtmlTree navList = new HtmlTree(HtmlTag.UL);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   456
            navList.addStyle(HtmlStyle.navList);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   457
            navList.addAttr(HtmlAttr.TITLE, "Navigation");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   458
            if (configuration.createoverview) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   459
                navList.addContent(getNavLinkContents());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   460
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   461
            if (configuration.packages.length == 1) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   462
                navList.addContent(getNavLinkPackage(configuration.packages[0]));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   463
            } else if (configuration.packages.length > 1) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   464
                navList.addContent(getNavLinkPackage());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   465
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   466
            navList.addContent(getNavLinkClass());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   467
            if(configuration.classuse) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   468
                navList.addContent(getNavLinkClassUse());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   469
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   470
            if(configuration.createtree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   471
                navList.addContent(getNavLinkTree());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   472
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   473
            if(!(configuration.nodeprecated ||
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   474
                     configuration.nodeprecatedlist)) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   475
                navList.addContent(getNavLinkDeprecated());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   476
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   477
            if(configuration.createindex) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   478
                navList.addContent(getNavLinkIndex());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   479
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   480
            if (!configuration.nohelp) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   481
                navList.addContent(getNavLinkHelp());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   482
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   483
            navDiv.addContent(navList);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   484
            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
   485
            navDiv.addContent(aboutDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   486
            body.addContent(navDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   487
            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
   488
            ulNav.addContent(getNavLinkNext());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   489
            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
   490
            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
   491
            ulFrames.addContent(getNavHideLists(filename));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   492
            subDiv.addContent(ulFrames);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   493
            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
   494
            ulAllClasses.addAttr(HtmlAttr.ID, allClassesId.toString());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   495
            subDiv.addContent(ulAllClasses);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   496
            subDiv.addContent(getAllClassesLinkScript(allClassesId.toString()));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   497
            addSummaryDetailLinks(subDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   498
            if (header) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   499
                subDiv.addContent(getMarkerAnchor("skip-navbar_top"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   500
                body.addContent(subDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   501
                body.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   502
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   503
                subDiv.addContent(getMarkerAnchor("skip-navbar_bottom"));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   504
                body.addContent(subDiv);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   505
                body.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR);
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() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   542
        Content linkContent = getHyperLink(relativePath +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   543
                "overview-summary.html", "", overviewLabel, "", "");
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
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   587
    public Content getNavLinkPrevious(String prev) {
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) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   590
            li = HtmlTree.LI(getHyperLink(prev, "", prevLabel, "", ""));
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
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   604
    public Content getNavLinkNext(String next) {
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) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   607
            li = HtmlTree.LI(getHyperLink(next, "", nextLabel, "", ""));
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
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   620
    protected Content getNavShowLists(String link) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   621
        Content framesContent = getHyperLink(link + "?" + path +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   622
                filename, "", framesLabel, "", "_top");
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() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   633
        return getNavShowLists(relativePath + "index.html");
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
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   642
    protected Content getNavHideLists(String link) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   643
        Content noFramesContent = getHyperLink(link, "", noframesLabel, "", "_top");
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],
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   661
                    "package-tree.html"), "", treeLabel,
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 {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   664
            treeLinkContent = getHyperLink(relativePath + "overview-tree.html",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   665
                    "", treeLabel, "", "");
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) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   678
        Content mainTreeContent = getHyperLink(relativePath + "overview-tree.html",
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() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   700
        Content linkContent = getHyperLink(relativePath +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   701
                "deprecated-list.html", "", deprecatedLabel, "", "");
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() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   714
        Content allClassesContent = getHyperLink(relativePath +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   715
                AllClassesFrameWriter.OUTPUT_FILE_NAME_NOFRAMES, "",
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() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   727
        Content linkContent = getHyperLink(relativePath +(configuration.splitindex?
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   728
            DirectoryManager.getPath("index-files") + fileseparator: "") +
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   729
            (configuration.splitindex?"index-1.html" : "index-all.html"), "",
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   730
            indexLabel, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   731
        Content li = HtmlTree.LI(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   732
        return li;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   733
    }
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
     * 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
   737
     * 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
   738
     * destination directory.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   739
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   740
     * @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
   741
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   742
    protected Content getNavLinkHelp() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   743
        String helpfilenm = configuration.helpfile;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   744
        if (helpfilenm.equals("")) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   745
            helpfilenm = "help-doc.html";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   746
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   747
            int lastsep;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   748
            if ((lastsep = helpfilenm.lastIndexOf(File.separatorChar)) != -1) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   749
                helpfilenm = helpfilenm.substring(lastsep + 1);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   750
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   751
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   752
        Content linkContent = getHyperLink(relativePath + helpfilenm, "",
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
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   792
    public Content getTableCaption(String rawText) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   793
        Content title = new RawHtml(rawText);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   794
        Content captionSpan = HtmlTree.SPAN(title);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   795
        Content space = getSpace();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   796
        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
   797
        Content caption = HtmlTree.CAPTION(captionSpan);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   798
        caption.addContent(tabSpan);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   799
        return caption;
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   803
     * 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
   804
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   805
     * @param anchorName the anchor name attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   806
     * @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
   807
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   808
    public Content getMarkerAnchor(String anchorName) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   809
        return getMarkerAnchor(anchorName, null);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   810
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   811
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   812
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   813
     * 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
   814
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   815
     * @param anchorName the anchor name attribute
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   816
     * @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
   817
     * @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
   818
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   819
    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
   820
        if (anchorContent == null)
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   821
            anchorContent = new Comment(" ");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   822
        Content markerAnchor = HtmlTree.A_NAME(anchorName, anchorContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   823
        return markerAnchor;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   824
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   825
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   826
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   827
     * Returns a packagename content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   828
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   829
     * @param packageDoc the package to check
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   830
     * @return package name content
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
    public Content getPackageName(PackageDoc packageDoc) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   833
        return packageDoc == null || packageDoc.name().length() == 0 ?
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   834
            defaultPackageLabel :
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   835
            getPackageLabel(packageDoc.name());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   836
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   837
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
     * Returns a package name label.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   840
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
   841
     * @param packageName the package name
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   842
     * @return the package name content
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   843
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   844
    public Content getPackageLabel(String packageName) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   845
        return new StringContent(packageName);
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
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   848
    /**
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   849
     * Add package deprecation information to the documentation tree
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   850
     *
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   851
     * @param deprPkgs list of deprecated packages
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   852
     * @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
   853
     * @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
   854
     * @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
   855
     * @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
   856
     */
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   857
    protected void addPackageDeprecatedAPI(List<Doc> deprPkgs, String headingKey,
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   858
            String tableSummary, String[] tableHeader, Content contentTree) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   859
        if (deprPkgs.size() > 0) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   860
            Content table = HtmlTree.TABLE(0, 3, 0, tableSummary,
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   861
                    getTableCaption(configuration().getText(headingKey)));
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   862
            table.addContent(getSummaryTableHeader(tableHeader, "col"));
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   863
            Content tbody = new HtmlTree(HtmlTag.TBODY);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   864
            for (int i = 0; i < deprPkgs.size(); i++) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   865
                PackageDoc pkg = (PackageDoc) deprPkgs.get(i);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   866
                HtmlTree td = HtmlTree.TD(HtmlStyle.colOne,
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   867
                        getPackageLink(pkg, getPackageName(pkg)));
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   868
                if (pkg.tags("deprecated").length > 0) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   869
                    addInlineDeprecatedComment(pkg, pkg.tags("deprecated")[0], td);
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
                HtmlTree tr = HtmlTree.TR(td);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   872
                if (i % 2 == 0) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   873
                    tr.addStyle(HtmlStyle.altColor);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   874
                } else {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   875
                    tr.addStyle(HtmlStyle.rowColor);
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
                tbody.addContent(tr);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   878
            }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   879
            table.addContent(tbody);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   880
            Content li = HtmlTree.LI(HtmlStyle.blockList, table);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   881
            Content ul = HtmlTree.UL(HtmlStyle.blockList, li);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   882
            contentTree.addContent(ul);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   883
        }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   884
    }
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   885
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 9592
diff changeset
   886
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   887
     * Return path to the class page for a classdoc. For example, the class
06bc494ca11e Initial load
duke
parents:
diff changeset
   888
     * name is "java.lang.Object" and if the current file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
   889
     * "java/io/File.html", then the path string to the class, returned is
06bc494ca11e Initial load
duke
parents:
diff changeset
   890
     * "../../java/lang.Object.html".
06bc494ca11e Initial load
duke
parents:
diff changeset
   891
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   892
     * @param cd Class to which the path is requested.
06bc494ca11e Initial load
duke
parents:
diff changeset
   893
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   894
    protected String pathToClass(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   895
        return pathString(cd.containingPackage(), cd.name() + ".html");
06bc494ca11e Initial load
duke
parents:
diff changeset
   896
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   897
06bc494ca11e Initial load
duke
parents:
diff changeset
   898
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   899
     * Return the path to the class page for a classdoc. Works same as
06bc494ca11e Initial load
duke
parents:
diff changeset
   900
     * {@link #pathToClass(ClassDoc)}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   901
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   902
     * @param cd   Class to which the path is requested.
06bc494ca11e Initial load
duke
parents:
diff changeset
   903
     * @param name Name of the file(doesn't include path).
06bc494ca11e Initial load
duke
parents:
diff changeset
   904
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   905
    protected String pathString(ClassDoc cd, String name) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   906
        return pathString(cd.containingPackage(), name);
06bc494ca11e Initial load
duke
parents:
diff changeset
   907
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   908
06bc494ca11e Initial load
duke
parents:
diff changeset
   909
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   910
     * Return path to the given file name in the given package. So if the name
06bc494ca11e Initial load
duke
parents:
diff changeset
   911
     * passed is "Object.html" and the name of the package is "java.lang", and
06bc494ca11e Initial load
duke
parents:
diff changeset
   912
     * if the relative path is "../.." then returned string will be
06bc494ca11e Initial load
duke
parents:
diff changeset
   913
     * "../../java/lang/Object.html"
06bc494ca11e Initial load
duke
parents:
diff changeset
   914
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   915
     * @param pd Package in which the file name is assumed to be.
06bc494ca11e Initial load
duke
parents:
diff changeset
   916
     * @param name File name, to which path string is.
06bc494ca11e Initial load
duke
parents:
diff changeset
   917
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   918
    protected String pathString(PackageDoc pd, String name) {
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
   919
        StringBuilder buf = new StringBuilder(relativePath);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   920
        buf.append(DirectoryManager.getPathToPackage(pd, name));
06bc494ca11e Initial load
duke
parents:
diff changeset
   921
        return buf.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
   922
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   923
06bc494ca11e Initial load
duke
parents:
diff changeset
   924
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   925
     * Return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
   926
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   927
     * @param pkg the package to link to.
06bc494ca11e Initial load
duke
parents:
diff changeset
   928
     * @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
   929
     * @param isStrong true if the label should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   930
     * @return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
   931
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   932
    public String getPackageLinkString(PackageDoc pkg, String label,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
   933
                                 boolean isStrong) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   934
        return getPackageLinkString(pkg, label, isStrong, "");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   935
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   936
06bc494ca11e Initial load
duke
parents:
diff changeset
   937
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   938
     * Return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
   939
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   940
     * @param pkg the package to link to.
06bc494ca11e Initial load
duke
parents:
diff changeset
   941
     * @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
   942
     * @param isStrong true if the label should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   943
     * @param style  the font of the package link label.
06bc494ca11e Initial load
duke
parents:
diff changeset
   944
     * @return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
   945
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   946
    public String getPackageLinkString(PackageDoc pkg, String label, boolean isStrong,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   947
            String style) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   948
        boolean included = pkg != null && pkg.isIncluded();
06bc494ca11e Initial load
duke
parents:
diff changeset
   949
        if (! included) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   950
            PackageDoc[] packages = configuration.packages;
06bc494ca11e Initial load
duke
parents:
diff changeset
   951
            for (int i = 0; i < packages.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   952
                if (packages[i].equals(pkg)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   953
                    included = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   954
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   955
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   956
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   957
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   958
        if (included || pkg == null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   959
            return getHyperLinkString(pathString(pkg, "package-summary.html"),
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
   960
                                "", label, isStrong, style);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   961
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   962
            String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
06bc494ca11e Initial load
duke
parents:
diff changeset
   963
            if (crossPkgLink != null) {
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   964
                return getHyperLinkString(crossPkgLink, "", label, isStrong, style);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   965
            } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   966
                return label;
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
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   970
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   971
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   972
     * Return the link to the given package.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   973
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   974
     * @param pkg the package to link to.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   975
     * @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
   976
     * @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
   977
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   978
    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
   979
        boolean included = pkg != null && pkg.isIncluded();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   980
        if (! included) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   981
            PackageDoc[] packages = configuration.packages;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   982
            for (int i = 0; i < packages.length; i++) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   983
                if (packages[i].equals(pkg)) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   984
                    included = true;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   985
                    break;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   986
                }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   987
            }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   988
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   989
        if (included || pkg == null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   990
            return getHyperLink(pathString(pkg, "package-summary.html"),
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   991
                                "", label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   992
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   993
            String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   994
            if (crossPkgLink != null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
   995
                return getHyperLink(crossPkgLink, "", label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   996
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   997
                return label;
06bc494ca11e Initial load
duke
parents:
diff changeset
   998
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   999
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1000
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1001
06bc494ca11e Initial load
duke
parents:
diff changeset
  1002
    public String italicsClassName(ClassDoc cd, boolean qual) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1003
        String name = (qual)? cd.qualifiedName(): cd.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1004
        return (cd.isInterface())?  italicsText(name): name;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1005
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1006
06bc494ca11e Initial load
duke
parents:
diff changeset
  1007
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1008
     * 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
  1009
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1010
     * @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
  1011
     * @param label label for the link
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1012
     * @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
  1013
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1014
    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
  1015
        if (doc == null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1016
            return;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1017
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1018
        ClassDoc cd = doc.containingClass();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1019
        if (cd == null) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1020
            //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
  1021
            cd = (ClassDoc) doc;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1022
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1023
        String href = relativePath + DocletConstants.SOURCE_OUTPUT_DIR_NAME
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1024
                + DirectoryManager.getDirectoryPath(cd.containingPackage())
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1025
                + cd.name() + ".html#" + SourceToHTMLConverter.getAnchorName(doc);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1026
        Content linkContent = getHyperLink(href, "", label, "", "");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1027
        htmltree.addContent(linkContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1028
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1029
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1030
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1031
     * Return the link to the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1032
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1033
     * @param linkInfo the information about the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1034
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1035
     * @return the link for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1036
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1037
    public String getLink(LinkInfoImpl linkInfo) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1038
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1039
        String link = ((LinkOutputImpl) factory.getLinkOutput(linkInfo)).toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1040
        displayLength += linkInfo.displayLength;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1041
        return link;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1042
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1043
06bc494ca11e Initial load
duke
parents:
diff changeset
  1044
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1045
     * Return the type parameters for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1046
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1047
     * @param linkInfo the information about the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1048
     * @return the type for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1049
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1050
    public String getTypeParameterLinks(LinkInfoImpl linkInfo) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1051
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1052
        return ((LinkOutputImpl)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1053
            factory.getTypeParameterLinks(linkInfo, false)).toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1054
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1055
06bc494ca11e Initial load
duke
parents:
diff changeset
  1056
    /*************************************************************
06bc494ca11e Initial load
duke
parents:
diff changeset
  1057
     * Return a class cross link to external class documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1058
     * The name must be fully qualified to determine which package
06bc494ca11e Initial load
duke
parents:
diff changeset
  1059
     * the class is in.  The -link option does not allow users to
06bc494ca11e Initial load
duke
parents:
diff changeset
  1060
     * link to external classes in the "default" package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1061
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1062
     * @param qualifiedClassName the qualified name of the external class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1063
     * @param refMemName the name of the member being referenced.  This should
06bc494ca11e Initial load
duke
parents:
diff changeset
  1064
     * be null or empty string if no member is being referenced.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1065
     * @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
  1066
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1067
     * @param style the style of the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1068
     * @param code true if the label should be code font.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1069
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1070
    public String getCrossClassLink(String qualifiedClassName, String refMemName,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1071
                                    String label, boolean strong, String style,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1072
                                    boolean code) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1073
        String className = "",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1074
            packageName = qualifiedClassName == null ? "" : qualifiedClassName;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1075
        int periodIndex;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1076
        while((periodIndex = packageName.lastIndexOf('.')) != -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1077
            className = packageName.substring(periodIndex + 1, packageName.length()) +
06bc494ca11e Initial load
duke
parents:
diff changeset
  1078
                (className.length() > 0 ? "." + className : "");
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1079
            String defaultLabel = code ? codeText(className) : className;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1080
            packageName = packageName.substring(0, periodIndex);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1081
            if (getCrossPackageLink(packageName) != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1082
                //The package exists in external documentation, so link to the external
06bc494ca11e Initial load
duke
parents:
diff changeset
  1083
                //class (assuming that it exists).  This is definitely a limitation of
06bc494ca11e Initial load
duke
parents:
diff changeset
  1084
                //the -link option.  There are ways to determine if an external package
06bc494ca11e Initial load
duke
parents:
diff changeset
  1085
                //exists, but no way to determine if the external class exists.  We just
06bc494ca11e Initial load
duke
parents:
diff changeset
  1086
                //have to assume that it does.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1087
                return getHyperLinkString(
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1088
                    configuration.extern.getExternalLink(packageName, relativePath,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1089
                                className + ".html?is-external=true"),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1090
                    refMemName == null ? "" : refMemName,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1091
                    label == null || label.length() == 0 ? 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
  1092
                    strong, style,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1093
                    configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1094
                    "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1095
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1096
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1097
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1098
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1099
06bc494ca11e Initial load
duke
parents:
diff changeset
  1100
    public boolean isClassLinkable(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1101
        if (cd.isIncluded()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1102
            return configuration.isGeneratedDoc(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1103
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1104
        return configuration.extern.isExternal(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1105
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1106
06bc494ca11e Initial load
duke
parents:
diff changeset
  1107
    public String getCrossPackageLink(String pkgName) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1108
        return configuration.extern.getExternalLink(pkgName, relativePath,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1109
            "package-summary.html?is-external=true");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1110
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1111
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1112
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1113
     * Get the class link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1114
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1115
     * @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
  1116
     * @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
  1117
     * @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
  1118
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1119
    public Content getQualifiedClassLink(int context, ClassDoc cd) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1120
        return new RawHtml(getLink(new LinkInfoImpl(context, cd,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1121
                configuration.getClassName(cd), "")));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1122
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1123
06bc494ca11e Initial load
duke
parents:
diff changeset
  1124
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1125
     * Add the class link.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1126
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1127
     * @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
  1128
     * @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
  1129
     * @param contentTree the content tree to which the link will be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1130
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1131
    public void addPreQualifiedClassLink(int context, ClassDoc cd, Content contentTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1132
        addPreQualifiedClassLink(context, cd, false, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1133
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1134
06bc494ca11e Initial load
duke
parents:
diff changeset
  1135
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1136
     * Retrieve the class link with the package portion of the label in
06bc494ca11e Initial load
duke
parents:
diff changeset
  1137
     * plain text.  If the qualifier is excluded, it willnot be included in the
06bc494ca11e Initial load
duke
parents:
diff changeset
  1138
     * link label.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1139
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1140
     * @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
  1141
     * @param isStrong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1142
     * @return the link with the package portion of the label in plain text.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1143
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1144
    public String getPreQualifiedClassLink(int context,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1145
            ClassDoc cd, boolean isStrong) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1146
        String classlink = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1147
        PackageDoc pd = cd.containingPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1148
        if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1149
            classlink = getPkgName(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1150
        }
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1151
        classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isStrong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1152
        return classlink;
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1156
     * 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
  1157
     * 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
  1158
     * link label.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1159
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1160
     * @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
  1161
     * @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
  1162
     * @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
  1163
     * @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
  1164
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1165
    public void addPreQualifiedClassLink(int context,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1166
            ClassDoc cd, boolean isStrong, Content contentTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1167
        PackageDoc pd = cd.containingPackage();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1168
        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
  1169
            contentTree.addContent(getPkgName(cd));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1170
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1171
        contentTree.addContent(new RawHtml(getLink(new LinkInfoImpl(
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1172
                context, cd, cd.name(), isStrong))));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1173
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1174
06bc494ca11e Initial load
duke
parents:
diff changeset
  1175
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1176
     * Add the class link, with only class name as the strong link and prefixing
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1177
     * plain package name.
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1178
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1179
     * @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
  1180
     * @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
  1181
     * @param contentTree the content tree to which the link with be added
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1182
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1183
    public void addPreQualifiedStrongClassLink(int context, ClassDoc cd, Content contentTree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1184
        addPreQualifiedClassLink(context, cd, true, contentTree);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1185
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1186
06bc494ca11e Initial load
duke
parents:
diff changeset
  1187
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1188
     * Get the link for the given member.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1189
     *
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1190
     * @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
  1191
     * @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
  1192
     * @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
  1193
     * @return a content tree for the doc link
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1194
     */
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1195
    public Content getDocLink(int context, MemberDoc doc, String label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1196
        return getDocLink(context, doc.containingClass(), doc, label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1197
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1198
06bc494ca11e Initial load
duke
parents:
diff changeset
  1199
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1200
     * Return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1201
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1202
     * @param context the id of the context where the link will be printed.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1203
     * @param doc the member being linked to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1204
     * @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
  1205
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1206
     * @return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1207
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1208
    public String getDocLink(int context, MemberDoc doc, String label,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1209
                boolean strong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1210
        return getDocLink(context, doc.containingClass(), doc, label, strong);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1211
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1212
06bc494ca11e Initial load
duke
parents:
diff changeset
  1213
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1214
     * Return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1215
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1216
     * @param context the id of the context where the link will be printed.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1217
     * @param classDoc the classDoc that we should link to.  This is not
06bc494ca11e Initial load
duke
parents:
diff changeset
  1218
     *                 necessarily equal to doc.containingClass().  We may be
06bc494ca11e Initial load
duke
parents:
diff changeset
  1219
     *                 inheriting comments.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1220
     * @param doc the member being linked to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1221
     * @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
  1222
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1223
     * @return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1224
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1225
    public String getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1226
        String label, boolean strong) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1227
        if (! (doc.isIncluded() ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1228
            Util.isLinkable(classDoc, configuration()))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1229
            return label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1230
        } else if (doc instanceof ExecutableMemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1231
            ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1232
            return getLink(new LinkInfoImpl(context, classDoc,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1233
                getAnchor(emd), label, strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1234
        } else if (doc instanceof MemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1235
            return getLink(new LinkInfoImpl(context, classDoc,
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1236
                doc.name(), label, strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1237
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1238
            return label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1239
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1240
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1241
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1242
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1243
     * 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
  1244
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1245
     * @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
  1246
     * @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
  1247
     *                 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
  1248
     *                 inheriting comments
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1249
     * @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
  1250
     * @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
  1251
     * @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
  1252
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1253
    public Content getDocLink(int context, ClassDoc classDoc, MemberDoc doc,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1254
        String label) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1255
        if (! (doc.isIncluded() ||
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1256
            Util.isLinkable(classDoc, configuration()))) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1257
            return new StringContent(label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1258
        } else if (doc instanceof ExecutableMemberDoc) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1259
            ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1260
            return new RawHtml(getLink(new LinkInfoImpl(context, classDoc,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1261
                getAnchor(emd), label, false)));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1262
        } else if (doc instanceof MemberDoc) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1263
            return new RawHtml(getLink(new LinkInfoImpl(context, classDoc,
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1264
                doc.name(), label, false)));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1265
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1266
            return new StringContent(label);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1267
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1268
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1269
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1270
    public String getAnchor(ExecutableMemberDoc emd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1271
        StringBuilder signature = new StringBuilder(emd.signature());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1272
        StringBuilder signatureParsed = new StringBuilder();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1273
        int counter = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1274
        for (int i = 0; i < signature.length(); i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1275
            char c = signature.charAt(i);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1276
            if (c == '<') {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1277
                counter++;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1278
            } else if (c == '>') {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1279
                counter--;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1280
            } else if (counter == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1281
                signatureParsed.append(c);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1282
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1283
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1284
        return emd.name() + signatureParsed.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1285
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1286
06bc494ca11e Initial load
duke
parents:
diff changeset
  1287
    public String seeTagToString(SeeTag see) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1288
        String tagName = see.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1289
        if (! (tagName.startsWith("@link") || tagName.equals("@see"))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1290
            return "";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1291
        }
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1292
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1293
        String seetext = replaceDocRootDir(see.text());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1294
06bc494ca11e Initial load
duke
parents:
diff changeset
  1295
        //Check if @see is an href or "string"
06bc494ca11e Initial load
duke
parents:
diff changeset
  1296
        if (seetext.startsWith("<") || seetext.startsWith("\"")) {
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1297
            return seetext;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1298
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1299
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1300
        boolean plain = tagName.equalsIgnoreCase("@linkplain");
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1301
        String label = plainOrCodeText(plain, see.label());
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1302
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1303
        //The text from the @see tag.  We will output this text when a label is not specified.
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1304
        String text = plainOrCodeText(plain, seetext);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1305
06bc494ca11e Initial load
duke
parents:
diff changeset
  1306
        ClassDoc refClass = see.referencedClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1307
        String refClassName = see.referencedClassName();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1308
        MemberDoc refMem = see.referencedMember();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1309
        String refMemName = see.referencedMemberName();
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1310
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1311
        if (refClass == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1312
            //@see is not referencing an included class
06bc494ca11e Initial load
duke
parents:
diff changeset
  1313
            PackageDoc refPackage = see.referencedPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1314
            if (refPackage != null && refPackage.isIncluded()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1315
                //@see is referencing an included package
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1316
                if (label.isEmpty())
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1317
                    label = plainOrCodeText(plain, refPackage.name());
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1318
                return getPackageLinkString(refPackage, label, false);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1319
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1320
                //@see is not referencing an included class or package.  Check for cross links.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1321
                String classCrossLink, packageCrossLink = getCrossPackageLink(refClassName);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1322
                if (packageCrossLink != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1323
                    //Package cross link found
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1324
                    return getHyperLinkString(packageCrossLink, "",
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1325
                        (label.isEmpty() ? text : label), false);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1326
                } else if ((classCrossLink = getCrossClassLink(refClassName,
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1327
                        refMemName, label, false, "", !plain)) != null) {
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1328
                    //Class cross link found (possibly to a member in the class)
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1329
                    return classCrossLink;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1330
                } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1331
                    //No cross link found so print warning
06bc494ca11e Initial load
duke
parents:
diff changeset
  1332
                    configuration.getDocletSpecificMsg().warning(see.position(), "doclet.see.class_or_package_not_found",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1333
                            tagName, seetext);
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1334
                    return (label.isEmpty() ? text: label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1335
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1336
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1337
        } else if (refMemName == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1338
            // 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
  1339
            if (label.isEmpty()) {
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1340
                label = plainOrCodeText(plain, refClass.name());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1341
            }
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1342
            return getLink(new LinkInfoImpl(refClass, label));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1343
        } else if (refMem == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1344
            // Must be a member reference since refClass is not null and refMemName is not null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1345
            // However, refMem is null, so this referenced member does not exist.
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1346
            return (label.isEmpty() ? text: label);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1347
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1348
            // Must be a member reference since refClass is not null and refMemName is not null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1349
            // refMem is not null, so this @see tag must be referencing a valid member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1350
            ClassDoc containing = refMem.containingClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1351
            if (see.text().trim().startsWith("#") &&
06bc494ca11e Initial load
duke
parents:
diff changeset
  1352
                ! (containing.isPublic() ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1353
                Util.isLinkable(containing, configuration()))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1354
                // Since the link is relative and the holder is not even being
06bc494ca11e Initial load
duke
parents:
diff changeset
  1355
                // documented, this must be an inherited link.  Redirect it.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1356
                // The current class either overrides the referenced member or
06bc494ca11e Initial load
duke
parents:
diff changeset
  1357
                // inherits it automatically.
3891
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1358
                if (this instanceof ClassWriterImpl) {
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1359
                    containing = ((ClassWriterImpl) this).getClassDoc();
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1360
                } else if (!containing.isPublic()){
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1361
                    configuration.getDocletSpecificMsg().warning(
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1362
                        see.position(), "doclet.see.class_or_package_not_accessible",
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1363
                        tagName, containing.qualifiedName());
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1364
                } else {
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1365
                    configuration.getDocletSpecificMsg().warning(
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1366
                        see.position(), "doclet.see.class_or_package_not_found",
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1367
                        tagName, seetext);
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1368
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1369
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1370
            if (configuration.currentcd != containing) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1371
                refMemName = containing.name() + "." + refMemName;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1372
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1373
            if (refMem instanceof ExecutableMemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1374
                if (refMemName.indexOf('(') < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1375
                    refMemName += ((ExecutableMemberDoc)refMem).signature();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1376
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1377
            }
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1378
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1379
            text = plainOrCodeText(plain, Util.escapeHtmlChars(refMemName));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1380
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1381
            return getDocLink(LinkInfoImpl.CONTEXT_SEE_TAG, containing,
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1382
                refMem, (label.isEmpty() ? text: label), false);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1383
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1384
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1385
14266
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1386
    private String plainOrCodeText(boolean plain, String text) {
69453558960d 8000673: remove dead code from HtmlWriter and subtypes
jjg
parents: 14265
diff changeset
  1387
        return (plain || text.isEmpty()) ? text : codeText(text);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1388
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1389
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1390
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1391
     * Add the inline comment.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1392
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1393
     * @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
  1394
     * @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
  1395
     * @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
  1396
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1397
    public void addInlineComment(Doc doc, Tag tag, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1398
        addCommentTags(doc, tag.inlineTags(), false, false, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1399
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1400
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1401
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1402
     * Add the inline deprecated comment.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1403
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1404
     * @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
  1405
     * @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
  1406
     * @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
  1407
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1408
    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
  1409
        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
  1410
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1411
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
     * Adds the summary content.
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 summary will be generated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1416
     * @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
  1417
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1418
    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
  1419
        addSummaryComment(doc, doc.firstSentenceTags(), htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1420
    }
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
     * Adds the summary content.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1424
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1425
     * @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
  1426
     * @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
  1427
     * @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
  1428
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1429
    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
  1430
        addCommentTags(doc, firstSentenceTags, false, true, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1431
    }
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
    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
  1434
        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
  1435
    }
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
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1438
     * Adds the inline comment.
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
     * @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
  1441
     * @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
  1442
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1443
    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
  1444
        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
  1445
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1446
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1447
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1448
     * Adds the comment tags.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1449
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1450
     * @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
  1451
     * @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
  1452
     * @param depr true if it is deprecated
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1453
     * @param first true if the first sentenge tags should be added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1454
     * @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
  1455
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1456
    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
  1457
            boolean first, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1458
        if(configuration.nocomment){
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1459
            return;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1460
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1461
        Content div;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1462
        Content result = new RawHtml(commentTagsToString(null, doc, tags, first));
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1463
        if (depr) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1464
            Content italic = HtmlTree.I(result);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1465
            div = HtmlTree.DIV(HtmlStyle.block, italic);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1466
            htmltree.addContent(div);
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
        else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1469
            div = HtmlTree.DIV(HtmlStyle.block, result);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1470
            htmltree.addContent(div);
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
        if (tags.length == 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1473
            htmltree.addContent(getSpace());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1474
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1475
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1476
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1477
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1478
     * Converts inline tags and text to text strings, expanding the
06bc494ca11e Initial load
duke
parents:
diff changeset
  1479
     * inline tags along the way.  Called wherever text can contain
06bc494ca11e Initial load
duke
parents:
diff changeset
  1480
     * an inline tag, such as in comments or in free-form text arguments
06bc494ca11e Initial load
duke
parents:
diff changeset
  1481
     * to non-inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1482
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1483
     * @param holderTag    specific tag where comment resides
06bc494ca11e Initial load
duke
parents:
diff changeset
  1484
     * @param doc    specific doc where comment resides
06bc494ca11e Initial load
duke
parents:
diff changeset
  1485
     * @param tags   array of text tags and inline tags (often alternating)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1486
     *               present in the text of interest for this doc
06bc494ca11e Initial load
duke
parents:
diff changeset
  1487
     * @param isFirstSentence  true if text is first sentence
06bc494ca11e Initial load
duke
parents:
diff changeset
  1488
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1489
    public String commentTagsToString(Tag holderTag, Doc doc, Tag[] tags,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1490
            boolean isFirstSentence) {
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
  1491
        StringBuilder result = new StringBuilder();
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1492
        boolean textTagChange = false;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1493
        // Array of all possible inline tags for this javadoc run
06bc494ca11e Initial load
duke
parents:
diff changeset
  1494
        configuration.tagletManager.checkTags(doc, tags, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1495
        for (int i = 0; i < tags.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1496
            Tag tagelem = tags[i];
06bc494ca11e Initial load
duke
parents:
diff changeset
  1497
            String tagName = tagelem.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1498
            if (tagelem instanceof SeeTag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1499
                result.append(seeTagToString((SeeTag)tagelem));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1500
            } else if (! tagName.equals("Text")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1501
                int originalLength = result.length();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1502
                TagletOutput output = TagletWriter.getInlineTagOuput(
06bc494ca11e Initial load
duke
parents:
diff changeset
  1503
                    configuration.tagletManager, holderTag,
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  1504
                    tagelem, getTagletWriterInstance(isFirstSentence));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1505
                result.append(output == null ? "" : output.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1506
                if (originalLength == 0 && isFirstSentence && tagelem.name().equals("@inheritDoc") && result.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1507
                    break;
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1508
                } else if (configuration.docrootparent.length() > 0 &&
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1509
                        tagelem.name().equals("@docRoot") &&
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1510
                        ((tags[i + 1]).text()).startsWith("/..")) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1511
                    //If Xdocrootparent switch ON, set the flag to remove the /.. occurance after
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1512
                    //{@docRoot} tag in the very next Text tag.
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1513
                    textTagChange = true;
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1514
                    continue;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1515
                } else {
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1516
                    continue;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1517
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1518
            } else {
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1519
                String text = tagelem.text();
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1520
                //If Xdocrootparent switch ON, remove the /.. occurance after {@docRoot} tag.
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1521
                if (textTagChange) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1522
                    text = text.replaceFirst("/..", "");
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1523
                    textTagChange = false;
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 9606
diff changeset
  1524
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1525
                //This is just a regular text tag.  The text may contain html links (<a>)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1526
                //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
  1527
                text = redirectRelativeLinks(tagelem.holder(), text);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1528
06bc494ca11e Initial load
duke
parents:
diff changeset
  1529
                // Replace @docRoot only if not represented by an instance of DocRootTaglet,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1530
                // that is, only if it was not present in a source file doc comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1531
                // This happens when inserted by the doclet (a few lines
06bc494ca11e Initial load
duke
parents:
diff changeset
  1532
                // above in this method).  [It might also happen when passed in on the command
06bc494ca11e Initial load
duke
parents:
diff changeset
  1533
                // line as a text argument to an option (like -header).]
06bc494ca11e Initial load
duke
parents:
diff changeset
  1534
                text = replaceDocRootDir(text);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1535
                if (isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1536
                    text = removeNonInlineHtmlTags(text);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1537
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1538
                StringTokenizer lines = new StringTokenizer(text, "\r\n", true);
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
  1539
                StringBuilder textBuff = new StringBuilder();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1540
                while (lines.hasMoreTokens()) {
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
  1541
                    StringBuilder line = new StringBuilder(lines.nextToken());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1542
                    Util.replaceTabs(configuration.sourcetab, line);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1543
                    textBuff.append(line.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1544
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1545
                result.append(textBuff);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1546
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1547
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1548
        return result.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1549
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1550
06bc494ca11e Initial load
duke
parents:
diff changeset
  1551
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1552
     * Return true if relative links should not be redirected.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1553
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1554
     * @return Return true if a relative link should not be redirected.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1555
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1556
    private boolean shouldNotRedirectRelativeLinks() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1557
        return  this instanceof AnnotationTypeWriter ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1558
                this instanceof ClassWriter ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1559
                this instanceof PackageSummaryWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1560
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1561
06bc494ca11e Initial load
duke
parents:
diff changeset
  1562
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1563
     * Suppose a piece of documentation has a relative link.  When you copy
06bc494ca11e Initial load
duke
parents:
diff changeset
  1564
     * that documetation to another place such as the index or class-use page,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1565
     * that relative link will no longer work.  We should redirect those links
06bc494ca11e Initial load
duke
parents:
diff changeset
  1566
     * so that they will work again.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1567
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  1568
     * Here is the algorithm used to fix the link:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1569
     * <p>
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  1570
     * {@literal <relative link> => docRoot + <relative path to file> + <relative link> }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1571
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  1572
     * For example, suppose com.sun.javadoc.RootDoc has this link:
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  1573
     * {@literal <a href="package-summary.html">The package Page</a> }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1574
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  1575
     * If this link appeared in the index, we would redirect
06bc494ca11e Initial load
duke
parents:
diff changeset
  1576
     * the link like this:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1577
     *
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 9608
diff changeset
  1578
     * {@literal <a href="./com/sun/javadoc/package-summary.html">The package Page</a>}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1579
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1580
     * @param doc the Doc object whose documentation is being written.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1581
     * @param text the text being written.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1582
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1583
     * @return the text, with all the relative links redirected to work.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1584
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1585
    private String redirectRelativeLinks(Doc doc, String text) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1586
        if (doc == null || shouldNotRedirectRelativeLinks()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1587
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1588
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1589
06bc494ca11e Initial load
duke
parents:
diff changeset
  1590
        String redirectPathFromRoot;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1591
        if (doc instanceof ClassDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1592
            redirectPathFromRoot = DirectoryManager.getDirectoryPath(((ClassDoc) doc).containingPackage());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1593
        } else if (doc instanceof MemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1594
            redirectPathFromRoot = DirectoryManager.getDirectoryPath(((MemberDoc) doc).containingPackage());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1595
        } else if (doc instanceof PackageDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1596
            redirectPathFromRoot = DirectoryManager.getDirectoryPath((PackageDoc) doc);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1597
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1598
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1599
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1600
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1601
        if (! redirectPathFromRoot.endsWith(DirectoryManager.URL_FILE_SEPARATOR)) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1602
            redirectPathFromRoot += DirectoryManager.URL_FILE_SEPARATOR;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1603
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1604
06bc494ca11e Initial load
duke
parents:
diff changeset
  1605
        //Redirect all relative links.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1606
        int end, begin = text.toLowerCase().indexOf("<a");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1607
        if(begin >= 0){
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
  1608
            StringBuilder textBuff = new StringBuilder(text);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1609
06bc494ca11e Initial load
duke
parents:
diff changeset
  1610
            while(begin >=0){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1611
                if (textBuff.length() > begin + 2 && ! Character.isWhitespace(textBuff.charAt(begin+2))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1612
                    begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1613
                    continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1614
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1615
06bc494ca11e Initial load
duke
parents:
diff changeset
  1616
                begin = textBuff.indexOf("=", begin) + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1617
                end = textBuff.indexOf(">", begin +1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1618
                if(begin == 0){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1619
                    //Link has no equal symbol.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1620
                    configuration.root.printWarning(
06bc494ca11e Initial load
duke
parents:
diff changeset
  1621
                        doc.position(),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1622
                        configuration.getText("doclet.malformed_html_link_tag", text));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1623
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1624
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1625
                if (end == -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1626
                    //Break without warning.  This <a> tag is not necessarily malformed.  The text
06bc494ca11e Initial load
duke
parents:
diff changeset
  1627
                    //might be missing '>' character because the href has an inline tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1628
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1629
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1630
                if(textBuff.substring(begin, end).indexOf("\"") != -1){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1631
                    begin = textBuff.indexOf("\"", begin) + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1632
                    end = textBuff.indexOf("\"", begin +1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1633
                    if(begin == 0 || end == -1){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1634
                        //Link is missing a quote.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1635
                        break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1636
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1637
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1638
                String relativeLink = textBuff.substring(begin, end);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1639
                if(!(relativeLink.toLowerCase().startsWith("mailto:") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1640
                     relativeLink.toLowerCase().startsWith("http:") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1641
                     relativeLink.toLowerCase().startsWith("https:") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1642
                     relativeLink.toLowerCase().startsWith("file:"))){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1643
                     relativeLink = "{@"+(new DocRootTaglet()).getName() + "}"
06bc494ca11e Initial load
duke
parents:
diff changeset
  1644
                        + redirectPathFromRoot
06bc494ca11e Initial load
duke
parents:
diff changeset
  1645
                        + relativeLink;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1646
                    textBuff.replace(begin, end, relativeLink);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1647
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1648
                begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1649
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1650
            return textBuff.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1651
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1652
        return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1653
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1654
06bc494ca11e Initial load
duke
parents:
diff changeset
  1655
    public String removeNonInlineHtmlTags(String text) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1656
        if (text.indexOf('<') < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1657
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1658
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1659
        String noninlinetags[] = { "<ul>", "</ul>", "<ol>", "</ol>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1660
                "<dl>", "</dl>", "<table>", "</table>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1661
                "<tr>", "</tr>", "<td>", "</td>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1662
                "<th>", "</th>", "<p>", "</p>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1663
                "<li>", "</li>", "<dd>", "</dd>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1664
                "<dir>", "</dir>", "<dt>", "</dt>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1665
                "<h1>", "</h1>", "<h2>", "</h2>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1666
                "<h3>", "</h3>", "<h4>", "</h4>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1667
                "<h5>", "</h5>", "<h6>", "</h6>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1668
                "<pre>", "</pre>", "<menu>", "</menu>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1669
                "<listing>", "</listing>", "<hr>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1670
                "<blockquote>", "</blockquote>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1671
                "<center>", "</center>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1672
                "<UL>", "</UL>", "<OL>", "</OL>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1673
                "<DL>", "</DL>", "<TABLE>", "</TABLE>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1674
                "<TR>", "</TR>", "<TD>", "</TD>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1675
                "<TH>", "</TH>", "<P>", "</P>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1676
                "<LI>", "</LI>", "<DD>", "</DD>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1677
                "<DIR>", "</DIR>", "<DT>", "</DT>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1678
                "<H1>", "</H1>", "<H2>", "</H2>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1679
                "<H3>", "</H3>", "<H4>", "</H4>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1680
                "<H5>", "</H5>", "<H6>", "</H6>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1681
                "<PRE>", "</PRE>", "<MENU>", "</MENU>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1682
                "<LISTING>", "</LISTING>", "<HR>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1683
                "<BLOCKQUOTE>", "</BLOCKQUOTE>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1684
                "<CENTER>", "</CENTER>"
06bc494ca11e Initial load
duke
parents:
diff changeset
  1685
        };
06bc494ca11e Initial load
duke
parents:
diff changeset
  1686
        for (int i = 0; i < noninlinetags.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1687
            text = replace(text, noninlinetags[i], "");
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
06bc494ca11e Initial load
duke
parents:
diff changeset
  1692
    public String replace(String text, String tobe, String by) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1693
        while (true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1694
            int startindex = text.indexOf(tobe);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1695
            if (startindex < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1696
                return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1697
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1698
            int endindex = startindex + tobe.length();
8631
664f84942e74 6866185: Util.getPackageSourcePath should use lastIndexOf not indexOf and related cleanup
jjg
parents: 7681
diff changeset
  1699
            StringBuilder replaced = new StringBuilder();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1700
            if (startindex > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1701
                replaced.append(text.substring(0, startindex));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1702
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1703
            replaced.append(by);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1704
            if (text.length() > endindex) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1705
                replaced.append(text.substring(endindex));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1706
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1707
            text = replaced.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1708
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1709
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1710
06bc494ca11e Initial load
duke
parents:
diff changeset
  1711
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1712
     * Returns a link to the stylesheet file.
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1713
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1714
     * @return an HtmlTree for the lINK tag which provides the stylesheet location
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1715
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1716
    public HtmlTree getStyleSheetProperties() {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1717
        String filename = configuration.stylesheetfile;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1718
        if (filename.length() > 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1719
            File stylefile = new File(filename);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1720
            String parent = stylefile.getParent();
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1721
            filename = (parent == null)?
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1722
                filename:
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1723
                filename.substring(parent.length() + 1);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1724
        } else {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1725
            filename = "stylesheet.css";
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1726
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1727
        filename = relativePath + filename;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1728
        HtmlTree link = HtmlTree.LINK("stylesheet", "text/css", filename, "Style");
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1729
        return link;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1730
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1731
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1732
    /**
9303
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 8631
diff changeset
  1733
     * According to
eae35c201e19 7032975: API files in javax.annotation.processing need to be updated for references to JLS
jjh
parents: 8631
diff changeset
  1734
     * <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
  1735
     * all the outer classes and static nested classes are core classes.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1736
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1737
    public boolean isCoreClass(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1738
        return cd.containingClass() == null || cd.isStatic();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1739
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1740
06bc494ca11e Initial load
duke
parents:
diff changeset
  1741
    /**
7614
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1742
     * 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
  1743
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1744
     * @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
  1745
     * @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
  1746
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1747
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1748
    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
  1749
        addAnnotationInfo(packageDoc, packageDoc.annotations(), htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1750
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1751
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1752
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1753
     * 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
  1754
     *
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
  1755
     * @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
  1756
     * @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
  1757
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1758
    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
  1759
        addAnnotationInfo(doc, doc.annotations(), htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1760
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1761
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1762
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1763
     * 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
  1764
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1765
     * @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
  1766
     * @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
  1767
     * @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
  1768
     * @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
  1769
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1770
    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
  1771
            Content tree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1772
        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
  1773
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1774
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1775
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1776
     * 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
  1777
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1778
     * @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
  1779
     * @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
  1780
     * @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
  1781
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1782
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1783
    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
  1784
            Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1785
        addAnnotationInfo(0, doc, descList, true, htmltree);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1786
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1787
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1788
    /**
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1789
     * 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
  1790
     *
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1791
     * @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
  1792
     * @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
  1793
     * @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
  1794
     * @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
  1795
     *        added
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1796
     */
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1797
    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
  1798
            AnnotationDesc[] descList, boolean lineBreak, Content htmltree) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1799
        List<String> annotations = getAnnotations(indent, descList, lineBreak);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1800
        if (annotations.size() == 0) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1801
            return false;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1802
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1803
        Content annotationContent;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1804
        for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) {
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1805
            annotationContent = new RawHtml(iter.next());
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1806
            htmltree.addContent(annotationContent);
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1807
        }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1808
        return true;
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1809
    }
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1810
cfadc977ca75 6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents: 5520
diff changeset
  1811
   /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1812
     * Return the string representations of the annotation types for
06bc494ca11e Initial load
duke
parents:
diff changeset
  1813
     * the given doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1814
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1815
     * @param indent the number of extra spaces to indent the annotations.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1816
     * @param descList the array of {@link AnnotationDesc}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1817
     * @param linkBreak if true, add new line between each member value.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1818
     * @return an array of strings representing the annotations being
06bc494ca11e Initial load
duke
parents:
diff changeset
  1819
     *         documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1820
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  1821
    private List<String> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  1822
        List<String> results = new ArrayList<String>();
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
  1823
        StringBuilder annotation;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1824
        for (int i = 0; i < descList.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1825
            AnnotationTypeDoc annotationDoc = descList[i].annotationType();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1826
            if (! Util.isDocumentedAnnotation(annotationDoc)){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1827
                continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1828
            }
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
  1829
            annotation = new StringBuilder();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1830
            LinkInfoImpl linkInfo = new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
  1831
                LinkInfoImpl.CONTEXT_ANNOTATION, annotationDoc);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1832
            linkInfo.label = "@" + annotationDoc.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1833
            annotation.append(getLink(linkInfo));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1834
            AnnotationDesc.ElementValuePair[] pairs = descList[i].elementValues();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1835
            if (pairs.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1836
                annotation.append('(');
06bc494ca11e Initial load
duke
parents:
diff changeset
  1837
                for (int j = 0; j < pairs.length; j++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1838
                    if (j > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1839
                        annotation.append(",");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1840
                        if (linkBreak) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1841
                            annotation.append(DocletConstants.NL);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1842
                            int spaces = annotationDoc.name().length() + 2;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1843
                            for (int k = 0; k < (spaces + indent); k++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1844
                                annotation.append(' ');
06bc494ca11e Initial load
duke
parents:
diff changeset
  1845
                            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1846
                        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1847
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1848
                    annotation.append(getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1849
                        pairs[j].element(), pairs[j].element().name(), false));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1850
                    annotation.append('=');
06bc494ca11e Initial load
duke
parents:
diff changeset
  1851
                    AnnotationValue annotationValue = pairs[j].value();
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  1852
                    List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1853
                    if (annotationValue.value() instanceof AnnotationValue[]) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1854
                        AnnotationValue[] annotationArray =
06bc494ca11e Initial load
duke
parents:
diff changeset
  1855
                            (AnnotationValue[]) annotationValue.value();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1856
                        for (int k = 0; k < annotationArray.length; k++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1857
                            annotationTypeValues.add(annotationArray[k]);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1858
                        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1859
                    } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1860
                        annotationTypeValues.add(annotationValue);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1861
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1862
                    annotation.append(annotationTypeValues.size() == 1 ? "" : "{");
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  1863
                    for (Iterator<AnnotationValue> iter = annotationTypeValues.iterator(); iter.hasNext(); ) {
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  1864
                        annotation.append(annotationValueToString(iter.next()));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1865
                        annotation.append(iter.hasNext() ? "," : "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1866
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1867
                    annotation.append(annotationTypeValues.size() == 1 ? "" : "}");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1868
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1869
                annotation.append(")");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1870
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1871
            annotation.append(linkBreak ? DocletConstants.NL : "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1872
            results.add(annotation.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1873
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1874
        return results;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1875
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1876
06bc494ca11e Initial load
duke
parents:
diff changeset
  1877
    private String annotationValueToString(AnnotationValue annotationValue) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1878
        if (annotationValue.value() instanceof Type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1879
            Type type = (Type) annotationValue.value();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1880
            if (type.asClassDoc() != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1881
                LinkInfoImpl linkInfo = new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
  1882
                    LinkInfoImpl.CONTEXT_ANNOTATION, type);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1883
                    linkInfo.label = (type.asClassDoc().isIncluded() ?
06bc494ca11e Initial load
duke
parents:
diff changeset
  1884
                        type.typeName() :
06bc494ca11e Initial load
duke
parents:
diff changeset
  1885
                        type.qualifiedTypeName()) + type.dimension() + ".class";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1886
                return getLink(linkInfo);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1887
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1888
                return type.typeName() + type.dimension() + ".class";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1889
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1890
        } else if (annotationValue.value() instanceof AnnotationDesc) {
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  1891
            List<String> list = getAnnotations(0,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1892
                new AnnotationDesc[]{(AnnotationDesc) annotationValue.value()},
06bc494ca11e Initial load
duke
parents:
diff changeset
  1893
                    false);
14263
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
  1894
            StringBuilder buf = new StringBuilder();
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
  1895
            for (String s: list) {
473b1eaede64 8000310: Clean up use of StringBuffer in langtools
jjg
parents: 14262
diff changeset
  1896
                buf.append(s);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1897
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1898
            return buf.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1899
        } else if (annotationValue.value() instanceof MemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1900
            return getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1901
                (MemberDoc) annotationValue.value(),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1902
                ((MemberDoc) annotationValue.value()).name(), false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1903
         } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1904
            return annotationValue.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1905
         }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1906
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1907
06bc494ca11e Initial load
duke
parents:
diff changeset
  1908
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1909
     * Return the configuation for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1910
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1911
     * @return the configuration for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1912
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1913
    public Configuration configuration() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1914
        return configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1915
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1916
}