langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
author jjg
Tue, 08 Sep 2009 13:53:10 -0700
changeset 3891 69ac41cb327b
parent 2321 57fc341671c4
child 5520 86e4b9a9da40
permissions -rw-r--r--
5093723: REGRESSION: ClassCastException in SingleIndexWriter Reviewed-by: jjg Contributed-by: ahe@google.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
2212
1d3dc0e0ba0c 6814575: Update copyright year
xdono
parents: 2086
diff changeset
     2
 * Copyright 1998-2009 Sun Microsystems, Inc.  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
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
 * have any questions.
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.*;
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
    35
import com.sun.tools.doclets.internal.toolkit.util.*;
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.taglets.*;
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
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * @since 1.2
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * @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
    46
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
public class HtmlDocletWriter extends HtmlDocWriter {
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
     * Relative path from the file getting generated to the destination
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
     * directory. For example, if the file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
     * "java/lang/Object.html", then the relative path string is "../../".
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
     * This string can be empty if the file getting generated is in
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
     * the destination directory.
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    public String relativePath = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
     * Same as relativepath, but normalized to never be empty or
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
     * end with a slash.
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
    public String relativepathNoSlash = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     * Platform-dependent directory path from the current or the
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     * destination directory to the file getting generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     * Used when creating the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
     * For example, if the file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
     * "java/lang/Object.html", then the path string is "java/lang".
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    public String path = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
     * Name of the file getting generated. If the file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     * "java/lang/Object.html", then the filename is "Object.html".
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
    public String filename = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
     * The display length used for indentation while generating the class page.
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    public int displayLength = 0;
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 global configuration information for this run.
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
    public ConfigurationImpl configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
     * Constructor to construct the HtmlStandardWriter object.
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
     * @param filename File to be generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    public HtmlDocletWriter(ConfigurationImpl configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
                              String filename) throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
        super(configuration, filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
        this.configuration = configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
        this.filename = filename;
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
     * Constructor to construct the HtmlStandardWriter object.
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
     * @param path         Platform-dependent {@link #path} used when
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     *                     creating file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
     * @param filename     Name of file to be generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     * @param relativePath Value for the variable {@link #relativePath}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    public HtmlDocletWriter(ConfigurationImpl configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
                              String path, String filename,
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
                              String relativePath) throws IOException {
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
        super(configuration, path, filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
        this.configuration = configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
        this.path = path;
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
        this.relativePath = relativePath;
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
        this.relativepathNoSlash =
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
            DirectoryManager.getPathNoTrailingSlash(this.relativePath);
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
        this.filename = filename;
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
     * Replace {@docRoot} tag used in options that accept HTML text, such
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
     * as -header, -footer, -top and -bottom, and when converting a relative
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     * HREF where commentTagsToString inserts a {@docRoot} where one was
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     * missing.  (Also see DocRootTaglet for {@docRoot} tags in doc
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
     * comments.)
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
     * Replace {&#064;docRoot} tag in htmlstr with the relative path to the
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     * destination directory from the directory where the file is being
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     * written, looping to handle all such tags in htmlstr.
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     * For example, for "-d docs" and -header containing {&#064;docRoot}, when
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     * the HTML page for source file p/C1.java is being generated, the
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     * {&#064;docRoot} tag would be inserted into the header as "../",
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     * the relative path from docs/p/ to docs/ (the document root).
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     * Note: This doc comment was written with '&amp;#064;' representing '@'
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * to prevent the inline tag from being interpreted.
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    public String replaceDocRootDir(String htmlstr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
        // Return if no inline tags exist
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
        int index = htmlstr.indexOf("{@");
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
        if (index < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
            return htmlstr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
        String lowerHtml = htmlstr.toLowerCase();
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
        // Return index of first occurrence of {@docroot}
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
        // Note: {@docRoot} is not case sensitive when passed in w/command line option
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
        index = lowerHtml.indexOf("{@docroot}", index);
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
        if (index < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
            return htmlstr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
        StringBuffer buf = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
        int previndex = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
        while (true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
            // Search for lowercase version of {@docRoot}
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
            index = lowerHtml.indexOf("{@docroot}", previndex);
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
            // If next {@docRoot} tag not found, append rest of htmlstr and exit loop
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
            if (index < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
                buf.append(htmlstr.substring(previndex));
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
                break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
            // If next {@docroot} tag found, append htmlstr up to start of tag
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
            buf.append(htmlstr.substring(previndex, index));
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
            previndex = index + 10;  // length for {@docroot} string
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
            // Insert relative path where {@docRoot} was located
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
            buf.append(relativepathNoSlash);
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
            // Append slash if next character is not a slash
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
            if (relativepathNoSlash.length() > 0 && previndex < htmlstr.length()
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
                    && htmlstr.charAt(previndex) != '/') {
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
                buf.append(DirectoryManager.URL_FILE_SEPERATOR);
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
        return buf.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
     * Print Html Hyper Link, with target frame.  This
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
     * link will only appear if page is not in a frame.
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
     * @param link String name of the file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
     * @param where Position in the file
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     * @param target Name of the target frame.
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
     * @param label Tag 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
   186
     * @param strong Whether the label should be strong or not?
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
    public void printNoFramesTargetHyperLink(String link, String where,
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
                                               String target, 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
   190
                                               boolean strong) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
        script();
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
        println("  <!--");
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
        println("  if(window==top) {");
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
        println("    document.writeln('"
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
   195
            + getHyperLink(link, where, label, strong, "", "", target) + "');");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
        println("  }");
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
        println("  //-->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
        scriptEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
        noScript();
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
   200
        println("  " + getHyperLink(link, where, label, strong, "", "", target));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
        noScriptEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
        println(DocletConstants.NL);
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
    private void printMethodInfo(MethodDoc method) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
        ClassDoc[] intfacs = method.containingClass().interfaces();
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
        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
   208
        // 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
   209
        // 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
   210
        // 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
   211
        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
   212
                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
   213
                overriddenMethod != null) {
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   214
            printMemberDetailsListStartTag();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
            dd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
            printTagsInfoHeader();
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
            MethodWriterImpl.printImplementsInfo(this, method);
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
            if (overriddenMethod != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
                MethodWriterImpl.printOverridden(this,
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
                    method.overriddenType(), overriddenMethod);
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
            printTagsInfoFooter();
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
            ddEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
    protected void printTags(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
        if(configuration.nocomment){
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
        if (doc instanceof MethodDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
            printMethodInfo((MethodDoc) doc);
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
        TagletOutputImpl output = new TagletOutputImpl("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
        TagletWriter.genTagOuput(configuration.tagletManager, doc,
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
            configuration.tagletManager.getCustomTags(doc),
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
                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
   238
        String outputString = output.toString().trim();
2321
57fc341671c4 6820360: Fix for definition list tags nesting adds an extra list tag for package summary page.
bpatel
parents: 2320
diff changeset
   239
        // For RootDoc, ClassDoc and PackageDoc, this section is not the
57fc341671c4 6820360: Fix for definition list tags nesting adds an extra list tag for package summary page.
bpatel
parents: 2320
diff changeset
   240
        // definition description but the start of definition list.
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   241
        if (!outputString.isEmpty()) {
2321
57fc341671c4 6820360: Fix for definition list tags nesting adds an extra list tag for package summary page.
bpatel
parents: 2320
diff changeset
   242
            if (!(doc instanceof RootDoc || doc instanceof ClassDoc ||
57fc341671c4 6820360: Fix for definition list tags nesting adds an extra list tag for package summary page.
bpatel
parents: 2320
diff changeset
   243
                    doc instanceof PackageDoc)) {
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   244
                printMemberDetailsListStartTag();
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   245
                dd();
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   246
            }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
            printTagsInfoHeader();
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   248
            print(outputString);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
            printTagsInfoFooter();
2321
57fc341671c4 6820360: Fix for definition list tags nesting adds an extra list tag for package summary page.
bpatel
parents: 2320
diff changeset
   250
            if (!(doc instanceof RootDoc || doc instanceof ClassDoc ||
57fc341671c4 6820360: Fix for definition list tags nesting adds an extra list tag for package summary page.
bpatel
parents: 2320
diff changeset
   251
                    doc instanceof PackageDoc))
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   252
                ddEnd();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
    /**
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   257
     * 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
   258
     * 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
   259
     *
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   260
     * @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
   261
     * @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
   262
     */
2216
b124d5c924eb 6786690: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - DL tag and nesting issue
bpatel
parents: 2086
diff changeset
   263
    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
   264
        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
   265
        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
   266
            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
   267
                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
   268
        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
   269
    }
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   270
cca2603eab0b 6802694: Javadoc doclet does not display deprecated information with -nocomment option for serialized form
bpatel
parents: 1789
diff changeset
   271
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
     * Returns a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
     * @return a TagletWriter that knows how to write HTML.
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
    public TagletWriter getTagletWriterInstance(boolean isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
        return new TagletWriterImpl(this, isFirstSentence);
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
    protected void printTagsInfoHeader() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
        dl();
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
    protected void printTagsInfoFooter() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
        dlEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
     * Print Package link, with target frame.
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
     * @param pd The link will be to the "package-summary.html" page for this
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
     * package.
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
     * @param target Name of the target frame.
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
     * @param label Tag for the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
    public void printTargetPackageLink(PackageDoc pd, String target,
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
        String label) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
        print(getHyperLink(pathString(pd, "package-summary.html"), "", label,
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
            false, "", "", target));
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
     * Print the html file header. Also print Html page title and stylesheet
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
     * default properties.
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
     * @param title         String window title to go in the &lt;TITLE&gt; tag
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
     * @param metakeywords  Array of String keywords for META tag.  Each element
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
     *                      of the array is assigned to a separate META tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
     *                      Pass in null for no array.
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
     * @param includeScript boolean true if printing windowtitle script.
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
     *             False for files that appear in the left-hand frames.
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
    public void printHtmlHeader(String title, String[] metakeywords,
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
            boolean includeScript) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
        println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " +
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
                    "Transitional//EN\" " +
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
                    "\"http://www.w3.org/TR/html4/loose.dtd\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
        println("<!--NewPage-->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
        html();
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
        head();
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
        if (! configuration.notimestamp) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
            print("<!-- Generated by javadoc (build " + ConfigurationImpl.BUILD_DATE + ") on ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
            print(today());
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
            println(" -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
        if (configuration.charset.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
            println("<META http-equiv=\"Content-Type\" content=\"text/html; "
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
                        + "charset=" + configuration.charset + "\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
        if ( configuration.windowtitle.length() > 0 ) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
            title += " (" + configuration.windowtitle  + ")";
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
        title(title);
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
        println(title);
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
        titleEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
        if (! configuration.notimestamp) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
                println("<META NAME=\"date\" "
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
                                    + "CONTENT=\"" + dateFormat.format(new Date()) + "\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
        if ( metakeywords != null ) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
            for ( int i=0; i < metakeywords.length; i++ ) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
                println("<META NAME=\"keywords\" "
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
                            + "CONTENT=\"" + metakeywords[i] + "\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
        printStyleSheetProperties();
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
        // Don't print windowtitle script for overview-frame, allclasses-frame
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
        // and package-frame
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
        if (includeScript) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
            printWinTitleScript(title);
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
        headEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
        body("white", includeScript);
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
     * Print user specified header and the footer.
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
     * @param header if true print the user provided header else print the
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
     * user provided footer.
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
    public void printUserHeaderFooter(boolean header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
        em();
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
        if (header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
            print(replaceDocRootDir(configuration.header));
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
            if (configuration.footer.length() != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
                print(replaceDocRootDir(configuration.footer));
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
                print(replaceDocRootDir(configuration.header));
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
        emEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
     * Print the user specified top.
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
    public void printTop() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
        print(replaceDocRootDir(configuration.top));
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
        hr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
     * Print the user specified bottom.
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
    public void printBottom() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
        hr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
        print(replaceDocRootDir(configuration.bottom));
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
     * Print the navigation bar for the Html page at the top and and the bottom.
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
     * @param header If true print navigation bar at the top of the page else
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
     * print the nevigation bar at the bottom.
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
    protected void navLinks(boolean header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
        println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
        if (!configuration.nonavbar) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
            if (header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
                println(DocletConstants.NL + "<!-- ========= START OF TOP NAVBAR ======= -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
                anchor("navbar_top");
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
                println();
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
                print(getHyperLink("", "skip-navbar_top", "", false, "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
                    configuration.getText("doclet.Skip_navigation_links"), ""));
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
                println(DocletConstants.NL + "<!-- ======= START OF BOTTOM NAVBAR ====== -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
                anchor("navbar_bottom");
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
                println();
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
                print(getHyperLink("", "skip-navbar_bottom", "", false, "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   418
                    configuration.getText("doclet.Skip_navigation_links"), ""));
06bc494ca11e Initial load
duke
parents:
diff changeset
   419
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   420
            table(0, "100%", 1, 0);
06bc494ca11e Initial load
duke
parents:
diff changeset
   421
            tr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   422
            tdColspanBgcolorStyle(2, "#EEEEFF", "NavBarCell1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   423
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   424
            if (header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
                anchor("navbar_top_firstrow");
06bc494ca11e Initial load
duke
parents:
diff changeset
   426
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
                anchor("navbar_bottom_firstrow");
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
            table(0, 0, 3);
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
            print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   431
            trAlignVAlign("center", "top");
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
06bc494ca11e Initial load
duke
parents:
diff changeset
   433
            if (configuration.createoverview) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   434
                navLinkContents();
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
            if (configuration.packages.length == 1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
                navLinkPackage(configuration.packages[0]);
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
            } else if (configuration.packages.length > 1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   440
                navLinkPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
   441
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   442
06bc494ca11e Initial load
duke
parents:
diff changeset
   443
            navLinkClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
            if(configuration.classuse) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
                navLinkClassUse();
06bc494ca11e Initial load
duke
parents:
diff changeset
   447
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
            if(configuration.createtree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   449
                navLinkTree();
06bc494ca11e Initial load
duke
parents:
diff changeset
   450
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
            if(!(configuration.nodeprecated ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
                     configuration.nodeprecatedlist)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
                navLinkDeprecated();
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   455
            if(configuration.createindex) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
                navLinkIndex();
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   458
            if (!configuration.nohelp) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   459
                navLinkHelp();
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   461
            print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   462
            trEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   463
            tableEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   464
            tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   465
06bc494ca11e Initial load
duke
parents:
diff changeset
   466
            tdAlignVAlignRowspan("right", "top", 3);
06bc494ca11e Initial load
duke
parents:
diff changeset
   467
06bc494ca11e Initial load
duke
parents:
diff changeset
   468
            printUserHeaderFooter(header);
06bc494ca11e Initial load
duke
parents:
diff changeset
   469
            tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   470
            trEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   471
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   472
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
            tr();
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
            tdBgcolorStyle("white", "NavBarCell2");
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
            font("-2");
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   477
            navLinkPrevious();
06bc494ca11e Initial load
duke
parents:
diff changeset
   478
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   479
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   480
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   481
            navLinkNext();
06bc494ca11e Initial load
duke
parents:
diff changeset
   482
            fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   483
            tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   484
06bc494ca11e Initial load
duke
parents:
diff changeset
   485
            tdBgcolorStyle("white", "NavBarCell2");
06bc494ca11e Initial load
duke
parents:
diff changeset
   486
            font("-2");
06bc494ca11e Initial load
duke
parents:
diff changeset
   487
            print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   488
            navShowLists();
06bc494ca11e Initial load
duke
parents:
diff changeset
   489
            print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   490
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   491
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   492
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   493
            navHideLists(filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
   494
            print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   495
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   496
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   497
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   498
            navLinkClassIndex();
06bc494ca11e Initial load
duke
parents:
diff changeset
   499
            fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   500
            tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   501
06bc494ca11e Initial load
duke
parents:
diff changeset
   502
            trEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   503
06bc494ca11e Initial load
duke
parents:
diff changeset
   504
            printSummaryDetailLinks();
06bc494ca11e Initial load
duke
parents:
diff changeset
   505
06bc494ca11e Initial load
duke
parents:
diff changeset
   506
            tableEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   507
            if (header) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   508
                aName("skip-navbar_top");
06bc494ca11e Initial load
duke
parents:
diff changeset
   509
                aEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   510
                println(DocletConstants.NL + "<!-- ========= END OF TOP NAVBAR ========= -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   511
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   512
                aName("skip-navbar_bottom");
06bc494ca11e Initial load
duke
parents:
diff changeset
   513
                aEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   514
                println(DocletConstants.NL + "<!-- ======== END OF BOTTOM NAVBAR ======= -->");
06bc494ca11e Initial load
duke
parents:
diff changeset
   515
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   516
            println("");
06bc494ca11e Initial load
duke
parents:
diff changeset
   517
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   518
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   519
06bc494ca11e Initial load
duke
parents:
diff changeset
   520
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   521
     * Print the word "NEXT" to indicate that no link is available.  Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   522
     * this method to customize next link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   523
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   524
    protected void navLinkNext() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   525
        navLinkNext(null);
06bc494ca11e Initial load
duke
parents:
diff changeset
   526
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   527
06bc494ca11e Initial load
duke
parents:
diff changeset
   528
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   529
     * Print the word "PREV" to indicate that no link is available.  Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   530
     * this method to customize prev link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   531
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   532
    protected void navLinkPrevious() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   533
        navLinkPrevious(null);
06bc494ca11e Initial load
duke
parents:
diff changeset
   534
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   535
06bc494ca11e Initial load
duke
parents:
diff changeset
   536
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   537
     * Do nothing. This is the default method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   538
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   539
    protected void printSummaryDetailLinks() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   540
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   541
06bc494ca11e Initial load
duke
parents:
diff changeset
   542
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   543
     * Print link to the "overview-summary.html" page.
06bc494ca11e Initial load
duke
parents:
diff changeset
   544
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   545
    protected void navLinkContents() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   546
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   547
        printHyperLink(relativePath + "overview-summary.html", "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   548
                       configuration.getText("doclet.Overview"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   549
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   550
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   551
06bc494ca11e Initial load
duke
parents:
diff changeset
   552
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   553
     * Description for a cell in the navigation bar.
06bc494ca11e Initial load
duke
parents:
diff changeset
   554
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   555
    protected void navCellStart() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   556
        print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   557
        tdBgcolorStyle("#EEEEFF", "NavBarCell1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   558
        print("    ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   559
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   560
06bc494ca11e Initial load
duke
parents:
diff changeset
   561
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   562
     * Description for a cell in the navigation bar, but with reverse
06bc494ca11e Initial load
duke
parents:
diff changeset
   563
     * high-light effect.
06bc494ca11e Initial load
duke
parents:
diff changeset
   564
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   565
    protected void navCellRevStart() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   566
        print("  ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   567
        tdBgcolorStyle("#FFFFFF", "NavBarCell1Rev");
06bc494ca11e Initial load
duke
parents:
diff changeset
   568
        print(" ");
06bc494ca11e Initial load
duke
parents:
diff changeset
   569
        space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   570
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   571
06bc494ca11e Initial load
duke
parents:
diff changeset
   572
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   573
     * Closing tag for navigation bar cell.
06bc494ca11e Initial load
duke
parents:
diff changeset
   574
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   575
    protected void navCellEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   576
        space();
06bc494ca11e Initial load
duke
parents:
diff changeset
   577
        tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   578
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   579
06bc494ca11e Initial load
duke
parents:
diff changeset
   580
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   581
     * Print link to the "package-summary.html" page for the package passed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   582
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   583
     * @param pkg Package to which link will be generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   584
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   585
    protected void navLinkPackage(PackageDoc pkg) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   586
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   587
        printPackageLink(pkg, configuration.getText("doclet.Package"), true,
06bc494ca11e Initial load
duke
parents:
diff changeset
   588
            "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   589
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   590
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   591
06bc494ca11e Initial load
duke
parents:
diff changeset
   592
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   593
     * Print the word "Package" in the navigation bar cell, to indicate that
06bc494ca11e Initial load
duke
parents:
diff changeset
   594
     * link is not available here.
06bc494ca11e Initial load
duke
parents:
diff changeset
   595
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   596
    protected void navLinkPackage() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   597
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   598
        fontStyle("NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   599
        printText("doclet.Package");
06bc494ca11e Initial load
duke
parents:
diff changeset
   600
        fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   601
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   602
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   603
06bc494ca11e Initial load
duke
parents:
diff changeset
   604
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   605
     * Print the word "Use" in the navigation bar cell, to indicate that link
06bc494ca11e Initial load
duke
parents:
diff changeset
   606
     * is not available.
06bc494ca11e Initial load
duke
parents:
diff changeset
   607
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   608
    protected void navLinkClassUse() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   609
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   610
        fontStyle("NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   611
        printText("doclet.navClassUse");
06bc494ca11e Initial load
duke
parents:
diff changeset
   612
        fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   613
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   614
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   615
06bc494ca11e Initial load
duke
parents:
diff changeset
   616
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   617
     * Print link for previous file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   618
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   619
     * @param prev File name for the prev link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   620
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   621
    public void navLinkPrevious(String prev) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   622
        String tag = configuration.getText("doclet.Prev");
06bc494ca11e Initial load
duke
parents:
diff changeset
   623
        if (prev != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   624
            printHyperLink(prev, "", tag, true) ;
06bc494ca11e Initial load
duke
parents:
diff changeset
   625
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   626
            print(tag);
06bc494ca11e Initial load
duke
parents:
diff changeset
   627
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   628
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   629
06bc494ca11e Initial load
duke
parents:
diff changeset
   630
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   631
     * Print link for next file.  If next is null, just print the label
06bc494ca11e Initial load
duke
parents:
diff changeset
   632
     * without linking it anywhere.
06bc494ca11e Initial load
duke
parents:
diff changeset
   633
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   634
     * @param next File name for the next link.
06bc494ca11e Initial load
duke
parents:
diff changeset
   635
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   636
    public void navLinkNext(String next) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   637
        String tag = configuration.getText("doclet.Next");
06bc494ca11e Initial load
duke
parents:
diff changeset
   638
        if (next != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   639
            printHyperLink(next, "", tag, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
   640
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   641
            print(tag);
06bc494ca11e Initial load
duke
parents:
diff changeset
   642
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   643
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   644
06bc494ca11e Initial load
duke
parents:
diff changeset
   645
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   646
     * Print "FRAMES" link, to switch to the frame version of the output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   647
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   648
     * @param link File to be linked, "index.html".
06bc494ca11e Initial load
duke
parents:
diff changeset
   649
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   650
    protected void navShowLists(String link) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   651
        print(getHyperLink(link + "?" + path + filename, "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   652
            configuration.getText("doclet.FRAMES"), true, "", "", "_top"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   653
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   654
06bc494ca11e Initial load
duke
parents:
diff changeset
   655
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   656
     * Print "FRAMES" link, to switch to the frame version of the output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   657
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   658
    protected void navShowLists() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   659
        navShowLists(relativePath + "index.html");
06bc494ca11e Initial load
duke
parents:
diff changeset
   660
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   661
06bc494ca11e Initial load
duke
parents:
diff changeset
   662
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   663
     * Print "NO FRAMES" link, to switch to the non-frame version of the output.
06bc494ca11e Initial load
duke
parents:
diff changeset
   664
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   665
     * @param link File to be linked.
06bc494ca11e Initial load
duke
parents:
diff changeset
   666
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   667
    protected void navHideLists(String link) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   668
        print(getHyperLink(link, "", configuration.getText("doclet.NO_FRAMES"),
06bc494ca11e Initial load
duke
parents:
diff changeset
   669
            true, "", "", "_top"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   670
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   671
06bc494ca11e Initial load
duke
parents:
diff changeset
   672
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   673
     * Print "Tree" link in the navigation bar. If there is only one package
06bc494ca11e Initial load
duke
parents:
diff changeset
   674
     * specified on the command line, then the "Tree" link will be to the
06bc494ca11e Initial load
duke
parents:
diff changeset
   675
     * only "package-tree.html" file otherwise it will be to the
06bc494ca11e Initial load
duke
parents:
diff changeset
   676
     * "overview-tree.html" file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   677
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   678
    protected void navLinkTree() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   679
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   680
        PackageDoc[] packages = configuration.root.specifiedPackages();
06bc494ca11e Initial load
duke
parents:
diff changeset
   681
        if (packages.length == 1 && configuration.root.specifiedClasses().length == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   682
            printHyperLink(pathString(packages[0], "package-tree.html"), "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   683
                           configuration.getText("doclet.Tree"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   684
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   685
            printHyperLink(relativePath + "overview-tree.html", "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   686
                           configuration.getText("doclet.Tree"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   687
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   688
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   689
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   690
06bc494ca11e Initial load
duke
parents:
diff changeset
   691
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   692
     * Print "Tree" link to the "overview-tree.html" file.
06bc494ca11e Initial load
duke
parents:
diff changeset
   693
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   694
    protected void navLinkMainTree(String label) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   695
        printHyperLink(relativePath + "overview-tree.html", label);
06bc494ca11e Initial load
duke
parents:
diff changeset
   696
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   697
06bc494ca11e Initial load
duke
parents:
diff changeset
   698
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   699
     * Print the word "Class" in the navigation bar cell, to indicate that
06bc494ca11e Initial load
duke
parents:
diff changeset
   700
     * class link is not available.
06bc494ca11e Initial load
duke
parents:
diff changeset
   701
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   702
    protected void navLinkClass() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   703
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   704
        fontStyle("NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   705
        printText("doclet.Class");
06bc494ca11e Initial load
duke
parents:
diff changeset
   706
        fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   707
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   708
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   709
06bc494ca11e Initial load
duke
parents:
diff changeset
   710
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   711
     * Print "Deprecated" API link in the navigation bar.
06bc494ca11e Initial load
duke
parents:
diff changeset
   712
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   713
    protected void navLinkDeprecated() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   714
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   715
        printHyperLink(relativePath + "deprecated-list.html", "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   716
                       configuration.getText("doclet.navDeprecated"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   717
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   718
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   719
06bc494ca11e Initial load
duke
parents:
diff changeset
   720
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   721
     * Print link for generated index. If the user has used "-splitindex"
06bc494ca11e Initial load
duke
parents:
diff changeset
   722
     * command line option, then link to file "index-files/index-1.html" is
06bc494ca11e Initial load
duke
parents:
diff changeset
   723
     * generated otherwise link to file "index-all.html" is generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   724
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   725
    protected void navLinkClassIndex() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   726
        printNoFramesTargetHyperLink(relativePath +
06bc494ca11e Initial load
duke
parents:
diff changeset
   727
                AllClassesFrameWriter.OUTPUT_FILE_NAME_NOFRAMES,
06bc494ca11e Initial load
duke
parents:
diff changeset
   728
            "", "", configuration.getText("doclet.All_Classes"), true);
06bc494ca11e Initial load
duke
parents:
diff changeset
   729
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   730
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   731
     * Print link for generated class index.
06bc494ca11e Initial load
duke
parents:
diff changeset
   732
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   733
    protected void navLinkIndex() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   734
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   735
        printHyperLink(relativePath +
06bc494ca11e Initial load
duke
parents:
diff changeset
   736
                           (configuration.splitindex?
06bc494ca11e Initial load
duke
parents:
diff changeset
   737
                                DirectoryManager.getPath("index-files") +
06bc494ca11e Initial load
duke
parents:
diff changeset
   738
                                fileseparator: "") +
06bc494ca11e Initial load
duke
parents:
diff changeset
   739
                           (configuration.splitindex?
06bc494ca11e Initial load
duke
parents:
diff changeset
   740
                                "index-1.html" : "index-all.html"), "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   741
                       configuration.getText("doclet.Index"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   742
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   743
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   744
06bc494ca11e Initial load
duke
parents:
diff changeset
   745
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   746
     * Print help file link. If user has provided a help file, then generate a
06bc494ca11e Initial load
duke
parents:
diff changeset
   747
     * link to the user given file, which is already copied to current or
06bc494ca11e Initial load
duke
parents:
diff changeset
   748
     * destination directory.
06bc494ca11e Initial load
duke
parents:
diff changeset
   749
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   750
    protected void navLinkHelp() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   751
        String helpfilenm = configuration.helpfile;
06bc494ca11e Initial load
duke
parents:
diff changeset
   752
        if (helpfilenm.equals("")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   753
            helpfilenm = "help-doc.html";
06bc494ca11e Initial load
duke
parents:
diff changeset
   754
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   755
            int lastsep;
06bc494ca11e Initial load
duke
parents:
diff changeset
   756
            if ((lastsep = helpfilenm.lastIndexOf(File.separatorChar)) != -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   757
                helpfilenm = helpfilenm.substring(lastsep + 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
   758
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   759
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   760
        navCellStart();
06bc494ca11e Initial load
duke
parents:
diff changeset
   761
        printHyperLink(relativePath + helpfilenm, "",
06bc494ca11e Initial load
duke
parents:
diff changeset
   762
                       configuration.getText("doclet.Help"), true, "NavBarFont1");
06bc494ca11e Initial load
duke
parents:
diff changeset
   763
        navCellEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   764
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   765
06bc494ca11e Initial load
duke
parents:
diff changeset
   766
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   767
     * Print the word "Detail" in the navigation bar. No link is available.
06bc494ca11e Initial load
duke
parents:
diff changeset
   768
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   769
    protected void navDetail() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   770
        printText("doclet.Detail");
06bc494ca11e Initial load
duke
parents:
diff changeset
   771
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   772
06bc494ca11e Initial load
duke
parents:
diff changeset
   773
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   774
     * Print the word "Summary" in the navigation bar. No link is available.
06bc494ca11e Initial load
duke
parents:
diff changeset
   775
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   776
    protected void navSummary() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   777
        printText("doclet.Summary");
06bc494ca11e Initial load
duke
parents:
diff changeset
   778
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   779
06bc494ca11e Initial load
duke
parents:
diff changeset
   780
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   781
     * Print the Html table tag for the index summary tables. The table tag
06bc494ca11e Initial load
duke
parents:
diff changeset
   782
     * printed is
06bc494ca11e Initial load
duke
parents:
diff changeset
   783
     * &lt;TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
06bc494ca11e Initial load
duke
parents:
diff changeset
   784
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   785
    public void tableIndexSummary() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   786
        table(1, "100%", 3, 0);
06bc494ca11e Initial load
duke
parents:
diff changeset
   787
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   788
06bc494ca11e Initial load
duke
parents:
diff changeset
   789
    /**
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   790
     * Print the Html table tag for the index summary tables.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   791
     *
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   792
     * @param summary the summary for the table tag summary attribute.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   793
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   794
    public void tableIndexSummary(String summary) {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   795
        table(1, "100%", 3, 0, summary);
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   796
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   797
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   798
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   799
     * Same as {@link #tableIndexSummary()}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   800
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   801
    public void tableIndexDetail() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   802
        table(1, "100%", 3, 0);
06bc494ca11e Initial load
duke
parents:
diff changeset
   803
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   804
06bc494ca11e Initial load
duke
parents:
diff changeset
   805
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   806
     * Print Html tag for table elements. The tag printed is
06bc494ca11e Initial load
duke
parents:
diff changeset
   807
     * &lt;TD ALIGN="right" VALIGN="top" WIDTH="1%"&gt;.
06bc494ca11e Initial load
duke
parents:
diff changeset
   808
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   809
    public void tdIndex() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   810
        print("<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   811
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   812
06bc494ca11e Initial load
duke
parents:
diff changeset
   813
    /**
2320
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   814
     * Print table caption.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   815
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   816
    public void tableCaptionStart() {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   817
        captionStyle("TableCaption");
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   818
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   819
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   820
    /**
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   821
     * Print table sub-caption.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   822
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   823
    public void tableSubCaptionStart() {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   824
        captionStyle("TableSubCaption");
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   825
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   826
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   827
    /**
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   828
     * Print table caption end tags.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   829
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   830
    public void tableCaptionEnd() {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   831
        captionEnd();
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   832
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   833
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   834
    /**
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   835
     * Print summary table header.
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   836
     */
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   837
    public void summaryTableHeader(String[] header, String scope) {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   838
        tr();
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   839
        for ( int i=0; i < header.length; i++ ) {
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   840
            thScopeNoWrap("TableHeader", scope);
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   841
            print(header[i]);
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   842
            thEnd();
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   843
        }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   844
        trEnd();
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   845
    }
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   846
5b8c377175f4 6786688: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Table must have captions and headers
bpatel
parents: 2223
diff changeset
   847
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   848
     * Prine table header information about color, column span and the font.
06bc494ca11e Initial load
duke
parents:
diff changeset
   849
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   850
     * @param color Background color.
06bc494ca11e Initial load
duke
parents:
diff changeset
   851
     * @param span  Column span.
06bc494ca11e Initial load
duke
parents:
diff changeset
   852
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   853
    public void tableHeaderStart(String color, int span) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   854
        trBgcolorStyle(color, "TableHeadingColor");
06bc494ca11e Initial load
duke
parents:
diff changeset
   855
        thAlignColspan("left", span);
06bc494ca11e Initial load
duke
parents:
diff changeset
   856
        font("+2");
06bc494ca11e Initial load
duke
parents:
diff changeset
   857
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   858
06bc494ca11e Initial load
duke
parents:
diff changeset
   859
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   860
     * Print table header for the inherited members summary tables. Print the
06bc494ca11e Initial load
duke
parents:
diff changeset
   861
     * background color information.
06bc494ca11e Initial load
duke
parents:
diff changeset
   862
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   863
     * @param color Background color.
06bc494ca11e Initial load
duke
parents:
diff changeset
   864
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   865
    public void tableInheritedHeaderStart(String color) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   866
        trBgcolorStyle(color, "TableSubHeadingColor");
06bc494ca11e Initial load
duke
parents:
diff changeset
   867
        thAlign("left");
06bc494ca11e Initial load
duke
parents:
diff changeset
   868
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   869
06bc494ca11e Initial load
duke
parents:
diff changeset
   870
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   871
     * Print "Use" table header. Print the background color and the column span.
06bc494ca11e Initial load
duke
parents:
diff changeset
   872
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   873
     * @param color Background color.
06bc494ca11e Initial load
duke
parents:
diff changeset
   874
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   875
    public void tableUseInfoHeaderStart(String color) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   876
        trBgcolorStyle(color, "TableSubHeadingColor");
06bc494ca11e Initial load
duke
parents:
diff changeset
   877
        thAlignColspan("left", 2);
06bc494ca11e Initial load
duke
parents:
diff changeset
   878
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   879
06bc494ca11e Initial load
duke
parents:
diff changeset
   880
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   881
     * Print table header with the background color with default column span 2.
06bc494ca11e Initial load
duke
parents:
diff changeset
   882
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   883
     * @param color Background color.
06bc494ca11e Initial load
duke
parents:
diff changeset
   884
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   885
    public void tableHeaderStart(String color) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   886
        tableHeaderStart(color, 2);
06bc494ca11e Initial load
duke
parents:
diff changeset
   887
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   888
06bc494ca11e Initial load
duke
parents:
diff changeset
   889
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   890
     * Print table header with the column span, with the default color #CCCCFF.
06bc494ca11e Initial load
duke
parents:
diff changeset
   891
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   892
     * @param span Column span.
06bc494ca11e Initial load
duke
parents:
diff changeset
   893
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   894
    public void tableHeaderStart(int span) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   895
        tableHeaderStart("#CCCCFF", span);
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
     * Print table header with default column span 2 and default color #CCCCFF.
06bc494ca11e Initial load
duke
parents:
diff changeset
   900
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   901
    public void tableHeaderStart() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   902
        tableHeaderStart(2);
06bc494ca11e Initial load
duke
parents:
diff changeset
   903
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   904
06bc494ca11e Initial load
duke
parents:
diff changeset
   905
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   906
     * Print table header end tags for font, column and row.
06bc494ca11e Initial load
duke
parents:
diff changeset
   907
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   908
    public void tableHeaderEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   909
        fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   910
        thEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   911
        trEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   912
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   913
06bc494ca11e Initial load
duke
parents:
diff changeset
   914
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   915
     * Print table header end tags in inherited tables for column and row.
06bc494ca11e Initial load
duke
parents:
diff changeset
   916
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   917
    public void tableInheritedHeaderEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   918
        thEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   919
        trEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   920
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   921
06bc494ca11e Initial load
duke
parents:
diff changeset
   922
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   923
     * Print the summary table row cell attribute width.
06bc494ca11e Initial load
duke
parents:
diff changeset
   924
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   925
     * @param width Width of the table cell.
06bc494ca11e Initial load
duke
parents:
diff changeset
   926
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   927
    public void summaryRow(int width) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   928
        if (width != 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   929
            tdWidth(width + "%");
06bc494ca11e Initial load
duke
parents:
diff changeset
   930
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   931
            td();
06bc494ca11e Initial load
duke
parents:
diff changeset
   932
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   933
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   934
06bc494ca11e Initial load
duke
parents:
diff changeset
   935
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   936
     * Print the summary table row cell end tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   937
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   938
    public void summaryRowEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   939
        tdEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
   940
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   941
06bc494ca11e Initial load
duke
parents:
diff changeset
   942
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   943
     * Print the heading in Html &lt;H2> format.
06bc494ca11e Initial load
duke
parents:
diff changeset
   944
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   945
     * @param str The Header string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   946
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   947
    public void printIndexHeading(String str) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   948
        h2();
06bc494ca11e Initial load
duke
parents:
diff changeset
   949
        print(str);
06bc494ca11e Initial load
duke
parents:
diff changeset
   950
        h2End();
06bc494ca11e Initial load
duke
parents:
diff changeset
   951
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   952
06bc494ca11e Initial load
duke
parents:
diff changeset
   953
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   954
     * Print Html tag &lt;FRAMESET=arg&gt;.
06bc494ca11e Initial load
duke
parents:
diff changeset
   955
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   956
     * @param arg Argument for the tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   957
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   958
    public void frameSet(String arg) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   959
        println("<FRAMESET " + arg + ">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   960
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   961
06bc494ca11e Initial load
duke
parents:
diff changeset
   962
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   963
     * Print Html closing tag &lt;/FRAMESET&gt;.
06bc494ca11e Initial load
duke
parents:
diff changeset
   964
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   965
    public void frameSetEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   966
        println("</FRAMESET>");
06bc494ca11e Initial load
duke
parents:
diff changeset
   967
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   968
06bc494ca11e Initial load
duke
parents:
diff changeset
   969
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   970
     * Print Html tag &lt;FRAME=arg&gt;.
06bc494ca11e Initial load
duke
parents:
diff changeset
   971
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   972
     * @param arg Argument for the tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   973
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   974
    public void frame(String arg) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   975
        println("<FRAME " + arg + ">");
06bc494ca11e Initial load
duke
parents:
diff changeset
   976
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   977
06bc494ca11e Initial load
duke
parents:
diff changeset
   978
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   979
     * Print Html closing tag &lt;/FRAME&gt;.
06bc494ca11e Initial load
duke
parents:
diff changeset
   980
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   981
    public void frameEnd() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   982
        println("</FRAME>");
06bc494ca11e Initial load
duke
parents:
diff changeset
   983
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   984
06bc494ca11e Initial load
duke
parents:
diff changeset
   985
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   986
     * Return path to the class page for a classdoc. For example, the class
06bc494ca11e Initial load
duke
parents:
diff changeset
   987
     * name is "java.lang.Object" and if the current file getting generated is
06bc494ca11e Initial load
duke
parents:
diff changeset
   988
     * "java/io/File.html", then the path string to the class, returned is
06bc494ca11e Initial load
duke
parents:
diff changeset
   989
     * "../../java/lang.Object.html".
06bc494ca11e Initial load
duke
parents:
diff changeset
   990
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   991
     * @param cd Class to which the path is requested.
06bc494ca11e Initial load
duke
parents:
diff changeset
   992
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   993
    protected String pathToClass(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   994
        return pathString(cd.containingPackage(), cd.name() + ".html");
06bc494ca11e Initial load
duke
parents:
diff changeset
   995
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   996
06bc494ca11e Initial load
duke
parents:
diff changeset
   997
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   998
     * Return the path to the class page for a classdoc. Works same as
06bc494ca11e Initial load
duke
parents:
diff changeset
   999
     * {@link #pathToClass(ClassDoc)}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1000
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1001
     * @param cd   Class to which the path is requested.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1002
     * @param name Name of the file(doesn't include path).
06bc494ca11e Initial load
duke
parents:
diff changeset
  1003
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1004
    protected String pathString(ClassDoc cd, String name) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1005
        return pathString(cd.containingPackage(), name);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1006
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1007
06bc494ca11e Initial load
duke
parents:
diff changeset
  1008
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1009
     * Return path to the given file name in the given package. So if the name
06bc494ca11e Initial load
duke
parents:
diff changeset
  1010
     * passed is "Object.html" and the name of the package is "java.lang", and
06bc494ca11e Initial load
duke
parents:
diff changeset
  1011
     * if the relative path is "../.." then returned string will be
06bc494ca11e Initial load
duke
parents:
diff changeset
  1012
     * "../../java/lang/Object.html"
06bc494ca11e Initial load
duke
parents:
diff changeset
  1013
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1014
     * @param pd Package in which the file name is assumed to be.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1015
     * @param name File name, to which path string is.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1016
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1017
    protected String pathString(PackageDoc pd, String name) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1018
        StringBuffer buf = new StringBuffer(relativePath);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1019
        buf.append(DirectoryManager.getPathToPackage(pd, name));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1020
        return buf.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1021
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1022
06bc494ca11e Initial load
duke
parents:
diff changeset
  1023
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1024
     * Print the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1025
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1026
     * @param pkg the package to link to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1027
     * @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
  1028
     * @param isStrong true if the label should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1029
     */
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1030
    public void printPackageLink(PackageDoc pkg, String label, boolean isStrong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1031
        print(getPackageLink(pkg, label, isStrong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1032
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1033
06bc494ca11e Initial load
duke
parents:
diff changeset
  1034
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1035
     * Print the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1036
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1037
     * @param pkg the package to link to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1038
     * @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
  1039
     * @param isStrong true if the label should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1040
     * @param style  the font of the package link label.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1041
     */
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1042
    public void printPackageLink(PackageDoc pkg, String label, boolean isStrong,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1043
            String style) {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1044
        print(getPackageLink(pkg, label, isStrong, style));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1045
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1046
06bc494ca11e Initial load
duke
parents:
diff changeset
  1047
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1048
     * Return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1049
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1050
     * @param pkg the package to link to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1051
     * @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
  1052
     * @param isStrong true if the label should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1053
     * @return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1054
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1055
    public String getPackageLink(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
  1056
                                 boolean isStrong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1057
        return getPackageLink(pkg, label, isStrong, "");
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1058
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1059
06bc494ca11e Initial load
duke
parents:
diff changeset
  1060
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1061
     * Return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1062
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1063
     * @param pkg the package to link to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1064
     * @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
  1065
     * @param isStrong true if the label should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1066
     * @param style  the font of the package link label.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1067
     * @return the link to the given package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1068
     */
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1069
    public String getPackageLink(PackageDoc pkg, String label, boolean isStrong,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1070
            String style) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1071
        boolean included = pkg != null && pkg.isIncluded();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1072
        if (! included) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1073
            PackageDoc[] packages = configuration.packages;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1074
            for (int i = 0; i < packages.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1075
                if (packages[i].equals(pkg)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1076
                    included = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1077
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1078
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1079
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1080
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1081
        if (included || pkg == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1082
            return getHyperLink(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
  1083
                                "", label, isStrong, style);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1084
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1085
            String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1086
            if (crossPkgLink != null) {
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1087
                return getHyperLink(crossPkgLink, "", label, isStrong, style);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1088
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1089
                return label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1090
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1091
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1092
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1093
06bc494ca11e Initial load
duke
parents:
diff changeset
  1094
    public String italicsClassName(ClassDoc cd, boolean qual) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1095
        String name = (qual)? cd.qualifiedName(): cd.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1096
        return (cd.isInterface())?  italicsText(name): name;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1097
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1098
06bc494ca11e Initial load
duke
parents:
diff changeset
  1099
    public void printSrcLink(ProgramElementDoc d, String label) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1100
        if (d == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1101
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1102
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1103
        ClassDoc cd = d.containingClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1104
        if (cd == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1105
            //d must be a class doc since in has no containing class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1106
            cd = (ClassDoc) d;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1107
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1108
        String href = relativePath + DocletConstants.SOURCE_OUTPUT_DIR_NAME
06bc494ca11e Initial load
duke
parents:
diff changeset
  1109
            + DirectoryManager.getDirectoryPath(cd.containingPackage())
06bc494ca11e Initial load
duke
parents:
diff changeset
  1110
            + cd.name() + ".html#" + SourceToHTMLConverter.getAnchorName(d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1111
        printHyperLink(href, "", label, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1112
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1113
06bc494ca11e Initial load
duke
parents:
diff changeset
  1114
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1115
     * Return the link to the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1116
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1117
     * @param linkInfo the information about the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1118
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1119
     * @return the link for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1120
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1121
    public String getLink(LinkInfoImpl linkInfo) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1122
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1123
        String link = ((LinkOutputImpl) factory.getLinkOutput(linkInfo)).toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1124
        displayLength += linkInfo.displayLength;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1125
        return link;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1126
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1127
06bc494ca11e Initial load
duke
parents:
diff changeset
  1128
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1129
     * Return the type parameters for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1130
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1131
     * @param linkInfo the information about the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1132
     * @return the type for the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1133
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1134
    public String getTypeParameterLinks(LinkInfoImpl linkInfo) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1135
        LinkFactoryImpl factory = new LinkFactoryImpl(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1136
        return ((LinkOutputImpl)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1137
            factory.getTypeParameterLinks(linkInfo, false)).toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1138
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1139
06bc494ca11e Initial load
duke
parents:
diff changeset
  1140
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1141
     * Print the link to the given class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1142
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1143
    public void printLink(LinkInfoImpl linkInfo) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1144
        print(getLink(linkInfo));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1145
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1146
06bc494ca11e Initial load
duke
parents:
diff changeset
  1147
    /*************************************************************
06bc494ca11e Initial load
duke
parents:
diff changeset
  1148
     * Return a class cross link to external class documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1149
     * The name must be fully qualified to determine which package
06bc494ca11e Initial load
duke
parents:
diff changeset
  1150
     * the class is in.  The -link option does not allow users to
06bc494ca11e Initial load
duke
parents:
diff changeset
  1151
     * link to external classes in the "default" package.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1152
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1153
     * @param qualifiedClassName the qualified name of the external class.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1154
     * @param refMemName the name of the member being referenced.  This should
06bc494ca11e Initial load
duke
parents:
diff changeset
  1155
     * be null or empty string if no member is being referenced.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1156
     * @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
  1157
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1158
     * @param style the style of the link.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1159
     * @param code true if the label should be code font.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1160
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1161
    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
  1162
                                    String label, boolean strong, String style,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1163
                                    boolean code) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1164
        String className = "",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1165
            packageName = qualifiedClassName == null ? "" : qualifiedClassName;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1166
        int periodIndex;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1167
        while((periodIndex = packageName.lastIndexOf('.')) != -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1168
            className = packageName.substring(periodIndex + 1, packageName.length()) +
06bc494ca11e Initial load
duke
parents:
diff changeset
  1169
                (className.length() > 0 ? "." + className : "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1170
            String defaultLabel = code ? getCode() + className + getCodeEnd() : className;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1171
            packageName = packageName.substring(0, periodIndex);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1172
            if (getCrossPackageLink(packageName) != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1173
                //The package exists in external documentation, so link to the external
06bc494ca11e Initial load
duke
parents:
diff changeset
  1174
                //class (assuming that it exists).  This is definitely a limitation of
06bc494ca11e Initial load
duke
parents:
diff changeset
  1175
                //the -link option.  There are ways to determine if an external package
06bc494ca11e Initial load
duke
parents:
diff changeset
  1176
                //exists, but no way to determine if the external class exists.  We just
06bc494ca11e Initial load
duke
parents:
diff changeset
  1177
                //have to assume that it does.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1178
                return getHyperLink(
06bc494ca11e Initial load
duke
parents:
diff changeset
  1179
                    configuration.extern.getExternalLink(packageName, relativePath,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1180
                                className + ".html?is-external=true"),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1181
                    refMemName == null ? "" : refMemName,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1182
                    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
  1183
                    strong, style,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1184
                    configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1185
                    "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1186
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1187
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1188
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1189
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1190
06bc494ca11e Initial load
duke
parents:
diff changeset
  1191
    public boolean isClassLinkable(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1192
        if (cd.isIncluded()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1193
            return configuration.isGeneratedDoc(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1194
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1195
        return configuration.extern.isExternal(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1196
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1197
06bc494ca11e Initial load
duke
parents:
diff changeset
  1198
    public String getCrossPackageLink(String pkgName) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1199
        return configuration.extern.getExternalLink(pkgName, relativePath,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1200
            "package-summary.html?is-external=true");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1201
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1202
06bc494ca11e Initial load
duke
parents:
diff changeset
  1203
    public void printQualifiedClassLink(int context, ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1204
        printLink(new LinkInfoImpl(context, cd,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1205
            configuration.getClassName(cd), ""));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1206
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1207
06bc494ca11e Initial load
duke
parents:
diff changeset
  1208
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1209
     * Print Class link, with only class name as the link and prefixing
06bc494ca11e Initial load
duke
parents:
diff changeset
  1210
     * plain package name.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1211
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1212
    public void printPreQualifiedClassLink(int context, ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1213
        print(getPreQualifiedClassLink(context, cd, false));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1214
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1215
06bc494ca11e Initial load
duke
parents:
diff changeset
  1216
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1217
     * Retrieve the class link with the package portion of the label in
06bc494ca11e Initial load
duke
parents:
diff changeset
  1218
     * plain text.  If the qualifier is excluded, it willnot be included in the
06bc494ca11e Initial load
duke
parents:
diff changeset
  1219
     * link label.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1220
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1221
     * @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
  1222
     * @param isStrong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1223
     * @return the link with the package portion of the label in plain text.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1224
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1225
    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
  1226
            ClassDoc cd, boolean isStrong) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1227
        String classlink = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1228
        PackageDoc pd = cd.containingPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1229
        if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1230
            classlink = getPkgName(cd);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1231
        }
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1232
        classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isStrong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1233
        return classlink;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1234
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1235
06bc494ca11e Initial load
duke
parents:
diff changeset
  1236
06bc494ca11e Initial load
duke
parents:
diff changeset
  1237
    /**
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1238
     * Print Class link, with only class name as the strong link and prefixing
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1239
     * plain package name.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1240
     */
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1241
    public void printPreQualifiedStrongClassLink(int context, ClassDoc cd) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1242
        print(getPreQualifiedClassLink(context, cd, true));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1243
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1244
06bc494ca11e Initial load
duke
parents:
diff changeset
  1245
    public void printText(String key) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1246
        print(configuration.getText(key));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1247
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1248
06bc494ca11e Initial load
duke
parents:
diff changeset
  1249
    public void printText(String key, String a1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1250
        print(configuration.getText(key, a1));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1251
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1252
06bc494ca11e Initial load
duke
parents:
diff changeset
  1253
    public void printText(String key, String a1, String a2) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1254
        print(configuration.getText(key, a1, a2));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1255
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1256
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1257
    public void strongText(String key) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1258
        strong(configuration.getText(key));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1259
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1260
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1261
    public void strongText(String key, String a1) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1262
        strong(configuration.getText(key, a1));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1263
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1264
1787
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1265
    public void strongText(String key, String a1, String a2) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1266
        strong(configuration.getText(key, a1, a2));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1267
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1268
06bc494ca11e Initial load
duke
parents:
diff changeset
  1269
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1270
     * Print the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1271
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1272
     * @param context the id of the context where the link will be printed.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1273
     * @param doc the member being linked to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1274
     * @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
  1275
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1276
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1277
    public void printDocLink(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
  1278
            boolean strong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1279
        print(getDocLink(context, doc, label, strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1280
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1281
06bc494ca11e Initial load
duke
parents:
diff changeset
  1282
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1283
     * Print the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1284
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1285
     * @param context the id of the context where the link will be printed.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1286
     * @param classDoc the classDoc that we should link to.  This is not
06bc494ca11e Initial load
duke
parents:
diff changeset
  1287
     *                 necessarily equal to doc.containingClass().  We may be
06bc494ca11e Initial load
duke
parents:
diff changeset
  1288
     *                 inheriting comments.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1289
     * @param doc the member being linked to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1290
     * @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
  1291
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1292
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1293
    public void printDocLink(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
  1294
            String label, boolean strong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1295
        print(getDocLink(context, classDoc, doc, label, strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1296
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1297
06bc494ca11e Initial load
duke
parents:
diff changeset
  1298
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1299
     * Return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1300
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1301
     * @param context the id of the context where the link will be printed.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1302
     * @param doc the member being linked to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1303
     * @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
  1304
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1305
     * @return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1306
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1307
    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
  1308
                boolean strong) {
1aa079321cd2 6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents: 1264
diff changeset
  1309
        return getDocLink(context, doc.containingClass(), doc, label, strong);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1310
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1311
06bc494ca11e Initial load
duke
parents:
diff changeset
  1312
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1313
     * Return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1314
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1315
     * @param context the id of the context where the link will be printed.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1316
     * @param classDoc the classDoc that we should link to.  This is not
06bc494ca11e Initial load
duke
parents:
diff changeset
  1317
     *                 necessarily equal to doc.containingClass().  We may be
06bc494ca11e Initial load
duke
parents:
diff changeset
  1318
     *                 inheriting comments.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1319
     * @param doc the member being linked to.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1320
     * @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
  1321
     * @param strong true if the link should be strong.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1322
     * @return the link for the given member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1323
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1324
    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
  1325
        String label, boolean strong) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1326
        if (! (doc.isIncluded() ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1327
            Util.isLinkable(classDoc, configuration()))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1328
            return label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1329
        } else if (doc instanceof ExecutableMemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1330
            ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1331
            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
  1332
                getAnchor(emd), label, strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1333
        } else if (doc instanceof MemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1334
            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
  1335
                doc.name(), label, strong));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1336
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1337
            return label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1338
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1339
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1340
06bc494ca11e Initial load
duke
parents:
diff changeset
  1341
    public void anchor(ExecutableMemberDoc emd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1342
        anchor(getAnchor(emd));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1343
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1344
06bc494ca11e Initial load
duke
parents:
diff changeset
  1345
    public String getAnchor(ExecutableMemberDoc emd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1346
        StringBuilder signature = new StringBuilder(emd.signature());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1347
        StringBuilder signatureParsed = new StringBuilder();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1348
        int counter = 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1349
        for (int i = 0; i < signature.length(); i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1350
            char c = signature.charAt(i);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1351
            if (c == '<') {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1352
                counter++;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1353
            } else if (c == '>') {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1354
                counter--;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1355
            } else if (counter == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1356
                signatureParsed.append(c);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1357
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1358
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1359
        return emd.name() + signatureParsed.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1360
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1361
06bc494ca11e Initial load
duke
parents:
diff changeset
  1362
    public String seeTagToString(SeeTag see) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1363
        String tagName = see.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1364
        if (! (tagName.startsWith("@link") || tagName.equals("@see"))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1365
            return "";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1366
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1367
        StringBuffer result = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1368
        boolean isplaintext = tagName.toLowerCase().equals("@linkplain");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1369
        String label = see.label();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1370
        label = (label.length() > 0)?
06bc494ca11e Initial load
duke
parents:
diff changeset
  1371
            ((isplaintext) ? label :
06bc494ca11e Initial load
duke
parents:
diff changeset
  1372
                 getCode() + label + getCodeEnd()):"";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1373
        String seetext = replaceDocRootDir(see.text());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1374
06bc494ca11e Initial load
duke
parents:
diff changeset
  1375
        //Check if @see is an href or "string"
06bc494ca11e Initial load
duke
parents:
diff changeset
  1376
        if (seetext.startsWith("<") || seetext.startsWith("\"")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1377
            result.append(seetext);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1378
            return result.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1379
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1380
06bc494ca11e Initial load
duke
parents:
diff changeset
  1381
        //The text from the @see tag.  We will output this text when a label is not specified.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1382
        String text = (isplaintext) ? seetext : getCode() + seetext + getCodeEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1383
06bc494ca11e Initial load
duke
parents:
diff changeset
  1384
        ClassDoc refClass = see.referencedClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1385
        String refClassName = see.referencedClassName();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1386
        MemberDoc refMem = see.referencedMember();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1387
        String refMemName = see.referencedMemberName();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1388
        if (refClass == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1389
            //@see is not referencing an included class
06bc494ca11e Initial load
duke
parents:
diff changeset
  1390
            PackageDoc refPackage = see.referencedPackage();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1391
            if (refPackage != null && refPackage.isIncluded()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1392
                //@see is referencing an included package
06bc494ca11e Initial load
duke
parents:
diff changeset
  1393
                String packageName = isplaintext ? refPackage.name() :
06bc494ca11e Initial load
duke
parents:
diff changeset
  1394
                    getCode() + refPackage.name() + getCodeEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1395
                result.append(getPackageLink(refPackage,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1396
                    label.length() == 0 ? packageName : label, false));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1397
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1398
                //@see is not referencing an included class or package.  Check for cross links.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1399
                String classCrossLink, packageCrossLink = getCrossPackageLink(refClassName);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1400
                if (packageCrossLink != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1401
                    //Package cross link found
06bc494ca11e Initial load
duke
parents:
diff changeset
  1402
                    result.append(getHyperLink(packageCrossLink, "",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1403
                        (label.length() == 0)? text : label, false));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1404
                } else if ((classCrossLink = getCrossClassLink(refClassName,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1405
                        refMemName, label, false, "", ! isplaintext)) != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1406
                    //Class cross link found (possiblly to a member in the class)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1407
                    result.append(classCrossLink);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1408
                } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1409
                    //No cross link found so print warning
06bc494ca11e Initial load
duke
parents:
diff changeset
  1410
                    configuration.getDocletSpecificMsg().warning(see.position(), "doclet.see.class_or_package_not_found",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1411
                            tagName, seetext);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1412
                    result.append((label.length() == 0)? text: label);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1413
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1414
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1415
        } else if (refMemName == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1416
            // Must be a class reference since refClass is not null and refMemName is null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1417
            if (label.length() == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1418
                label = (isplaintext) ? refClass.name() : getCode() + refClass.name() + getCodeEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1419
                result.append(getLink(new LinkInfoImpl(refClass, label)));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1420
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1421
                result.append(getLink(new LinkInfoImpl(refClass, label)));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1422
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1423
        } else if (refMem == null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1424
            // Must be a member reference since refClass is not null and refMemName is not null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1425
            // However, refMem is null, so this referenced member does not exist.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1426
            result.append((label.length() == 0)? text: label);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1427
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1428
            // Must be a member reference since refClass is not null and refMemName is not null.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1429
            // refMem is not null, so this @see tag must be referencing a valid member.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1430
            ClassDoc containing = refMem.containingClass();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1431
            if (see.text().trim().startsWith("#") &&
06bc494ca11e Initial load
duke
parents:
diff changeset
  1432
                ! (containing.isPublic() ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1433
                Util.isLinkable(containing, configuration()))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1434
                // Since the link is relative and the holder is not even being
06bc494ca11e Initial load
duke
parents:
diff changeset
  1435
                // documented, this must be an inherited link.  Redirect it.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1436
                // The current class either overrides the referenced member or
06bc494ca11e Initial load
duke
parents:
diff changeset
  1437
                // inherits it automatically.
3891
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1438
                if (this instanceof ClassWriterImpl) {
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1439
                    containing = ((ClassWriterImpl) this).getClassDoc();
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1440
                } else if (!containing.isPublic()){
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1441
                    configuration.getDocletSpecificMsg().warning(
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1442
                        see.position(), "doclet.see.class_or_package_not_accessible",
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1443
                        tagName, containing.qualifiedName());
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1444
                } else {
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1445
                    configuration.getDocletSpecificMsg().warning(
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1446
                        see.position(), "doclet.see.class_or_package_not_found",
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1447
                        tagName, seetext);
69ac41cb327b 5093723: REGRESSION: ClassCastException in SingleIndexWriter
jjg
parents: 2321
diff changeset
  1448
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1449
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1450
            if (configuration.currentcd != containing) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1451
                refMemName = containing.name() + "." + refMemName;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1452
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1453
            if (refMem instanceof ExecutableMemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1454
                if (refMemName.indexOf('(') < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1455
                    refMemName += ((ExecutableMemberDoc)refMem).signature();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1456
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1457
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1458
            text = (isplaintext) ?
06bc494ca11e Initial load
duke
parents:
diff changeset
  1459
                refMemName : getCode() + refMemName + getCodeEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1460
06bc494ca11e Initial load
duke
parents:
diff changeset
  1461
            result.append(getDocLink(LinkInfoImpl.CONTEXT_SEE_TAG, containing,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1462
                refMem, (label.length() == 0)? text: label, false));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1463
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1464
        return result.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1465
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1466
06bc494ca11e Initial load
duke
parents:
diff changeset
  1467
    public void printInlineComment(Doc doc, Tag tag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1468
        printCommentTags(doc, tag.inlineTags(), false, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1469
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1470
06bc494ca11e Initial load
duke
parents:
diff changeset
  1471
    public void printInlineDeprecatedComment(Doc doc, Tag tag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1472
        printCommentTags(doc, tag.inlineTags(), true, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1473
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1474
06bc494ca11e Initial load
duke
parents:
diff changeset
  1475
    public void printSummaryComment(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1476
        printSummaryComment(doc, doc.firstSentenceTags());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1477
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1478
06bc494ca11e Initial load
duke
parents:
diff changeset
  1479
    public void printSummaryComment(Doc doc, Tag[] firstSentenceTags) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1480
        printCommentTags(doc, firstSentenceTags, false, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1481
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1482
06bc494ca11e Initial load
duke
parents:
diff changeset
  1483
    public void printSummaryDeprecatedComment(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1484
        printCommentTags(doc, doc.firstSentenceTags(), true, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1485
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1486
06bc494ca11e Initial load
duke
parents:
diff changeset
  1487
    public void printSummaryDeprecatedComment(Doc doc, Tag tag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1488
        printCommentTags(doc, tag.firstSentenceTags(), true, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1489
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1490
06bc494ca11e Initial load
duke
parents:
diff changeset
  1491
    public void printInlineComment(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1492
        printCommentTags(doc, doc.inlineTags(), false, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1493
        p();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1494
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1495
06bc494ca11e Initial load
duke
parents:
diff changeset
  1496
    public void printInlineDeprecatedComment(Doc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1497
        printCommentTags(doc, doc.inlineTags(), true, false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1498
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1499
06bc494ca11e Initial load
duke
parents:
diff changeset
  1500
    private void printCommentTags(Doc doc, Tag[] tags, boolean depr, boolean first) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1501
        if(configuration.nocomment){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1502
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1503
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1504
        if (depr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1505
            italic();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1506
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1507
        String result = commentTagsToString(null, doc, tags, first);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1508
        print(result);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1509
        if (depr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1510
            italicEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1511
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1512
        if (tags.length == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1513
            space();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1514
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1515
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1516
06bc494ca11e Initial load
duke
parents:
diff changeset
  1517
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1518
     * Converts inline tags and text to text strings, expanding the
06bc494ca11e Initial load
duke
parents:
diff changeset
  1519
     * inline tags along the way.  Called wherever text can contain
06bc494ca11e Initial load
duke
parents:
diff changeset
  1520
     * an inline tag, such as in comments or in free-form text arguments
06bc494ca11e Initial load
duke
parents:
diff changeset
  1521
     * to non-inline tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1522
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1523
     * @param holderTag    specific tag where comment resides
06bc494ca11e Initial load
duke
parents:
diff changeset
  1524
     * @param doc    specific doc where comment resides
06bc494ca11e Initial load
duke
parents:
diff changeset
  1525
     * @param tags   array of text tags and inline tags (often alternating)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1526
     *               present in the text of interest for this doc
06bc494ca11e Initial load
duke
parents:
diff changeset
  1527
     * @param isFirstSentence  true if text is first sentence
06bc494ca11e Initial load
duke
parents:
diff changeset
  1528
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1529
    public String commentTagsToString(Tag holderTag, Doc doc, Tag[] tags,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1530
            boolean isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1531
        StringBuffer result = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1532
        // Array of all possible inline tags for this javadoc run
06bc494ca11e Initial load
duke
parents:
diff changeset
  1533
        configuration.tagletManager.checkTags(doc, tags, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1534
        for (int i = 0; i < tags.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1535
            Tag tagelem = tags[i];
06bc494ca11e Initial load
duke
parents:
diff changeset
  1536
            String tagName = tagelem.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1537
            if (tagelem instanceof SeeTag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1538
                result.append(seeTagToString((SeeTag)tagelem));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1539
            } else if (! tagName.equals("Text")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1540
                int originalLength = result.length();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1541
                TagletOutput output = TagletWriter.getInlineTagOuput(
06bc494ca11e Initial load
duke
parents:
diff changeset
  1542
                    configuration.tagletManager, holderTag,
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  1543
                    tagelem, getTagletWriterInstance(isFirstSentence));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1544
                result.append(output == null ? "" : output.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1545
                if (originalLength == 0 && isFirstSentence && tagelem.name().equals("@inheritDoc") && result.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1546
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1547
                } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1548
                        continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1549
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1550
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1551
                //This is just a regular text tag.  The text may contain html links (<a>)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1552
                //or inline tag {@docRoot}, which will be handled as special cases.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1553
                String text = redirectRelativeLinks(tagelem.holder(), tagelem.text());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1554
06bc494ca11e Initial load
duke
parents:
diff changeset
  1555
                // Replace @docRoot only if not represented by an instance of DocRootTaglet,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1556
                // that is, only if it was not present in a source file doc comment.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1557
                // This happens when inserted by the doclet (a few lines
06bc494ca11e Initial load
duke
parents:
diff changeset
  1558
                // above in this method).  [It might also happen when passed in on the command
06bc494ca11e Initial load
duke
parents:
diff changeset
  1559
                // line as a text argument to an option (like -header).]
06bc494ca11e Initial load
duke
parents:
diff changeset
  1560
                text = replaceDocRootDir(text);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1561
                if (isFirstSentence) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1562
                    text = removeNonInlineHtmlTags(text);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1563
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1564
                StringTokenizer lines = new StringTokenizer(text, "\r\n", true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1565
                StringBuffer textBuff = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1566
                while (lines.hasMoreTokens()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1567
                    StringBuffer line = new StringBuffer(lines.nextToken());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1568
                    Util.replaceTabs(configuration.sourcetab, line);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1569
                    textBuff.append(line.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1570
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1571
                result.append(textBuff);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1572
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1573
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1574
        return result.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1575
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1576
06bc494ca11e Initial load
duke
parents:
diff changeset
  1577
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1578
     * Return true if relative links should not be redirected.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1579
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1580
     * @return Return true if a relative link should not be redirected.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1581
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1582
    private boolean shouldNotRedirectRelativeLinks() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1583
        return  this instanceof AnnotationTypeWriter ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1584
                this instanceof ClassWriter ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1585
                this instanceof PackageSummaryWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1586
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1587
06bc494ca11e Initial load
duke
parents:
diff changeset
  1588
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1589
     * Suppose a piece of documentation has a relative link.  When you copy
06bc494ca11e Initial load
duke
parents:
diff changeset
  1590
     * that documetation to another place such as the index or class-use page,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1591
     * that relative link will no longer work.  We should redirect those links
06bc494ca11e Initial load
duke
parents:
diff changeset
  1592
     * so that they will work again.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1593
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  1594
     * Here is the algorithm used to fix the link:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1595
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  1596
     * &lt;relative link&gt; => docRoot + &lt;relative path to file&gt; + &lt;relative link&gt;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1597
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  1598
     * For example, suppose com.sun.javadoc.RootDoc has this link:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1599
     * &lt;a href="package-summary.html"&gt;The package Page&lt;/a&gt;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1600
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
  1601
     * If this link appeared in the index, we would redirect
06bc494ca11e Initial load
duke
parents:
diff changeset
  1602
     * the link like this:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1603
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1604
     * &lt;a href="./com/sun/javadoc/package-summary.html"&gt;The package Page&lt;/a&gt;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1605
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1606
     * @param doc the Doc object whose documentation is being written.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1607
     * @param text the text being written.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1608
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1609
     * @return the text, with all the relative links redirected to work.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1610
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1611
    private String redirectRelativeLinks(Doc doc, String text) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1612
        if (doc == null || shouldNotRedirectRelativeLinks()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1613
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1614
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1615
06bc494ca11e Initial load
duke
parents:
diff changeset
  1616
        String redirectPathFromRoot;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1617
        if (doc instanceof ClassDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1618
            redirectPathFromRoot = DirectoryManager.getDirectoryPath(((ClassDoc) doc).containingPackage());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1619
        } else if (doc instanceof MemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1620
            redirectPathFromRoot = DirectoryManager.getDirectoryPath(((MemberDoc) doc).containingPackage());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1621
        } else if (doc instanceof PackageDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1622
            redirectPathFromRoot = DirectoryManager.getDirectoryPath((PackageDoc) doc);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1623
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1624
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1625
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1626
06bc494ca11e Initial load
duke
parents:
diff changeset
  1627
        if (! redirectPathFromRoot.endsWith(DirectoryManager.URL_FILE_SEPERATOR)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1628
            redirectPathFromRoot += DirectoryManager.URL_FILE_SEPERATOR;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1629
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1630
06bc494ca11e Initial load
duke
parents:
diff changeset
  1631
        //Redirect all relative links.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1632
        int end, begin = text.toLowerCase().indexOf("<a");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1633
        if(begin >= 0){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1634
            StringBuffer textBuff = new StringBuffer(text);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1635
06bc494ca11e Initial load
duke
parents:
diff changeset
  1636
            while(begin >=0){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1637
                if (textBuff.length() > begin + 2 && ! Character.isWhitespace(textBuff.charAt(begin+2))) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1638
                    begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1639
                    continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1640
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1641
06bc494ca11e Initial load
duke
parents:
diff changeset
  1642
                begin = textBuff.indexOf("=", begin) + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1643
                end = textBuff.indexOf(">", begin +1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1644
                if(begin == 0){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1645
                    //Link has no equal symbol.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1646
                    configuration.root.printWarning(
06bc494ca11e Initial load
duke
parents:
diff changeset
  1647
                        doc.position(),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1648
                        configuration.getText("doclet.malformed_html_link_tag", text));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1649
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1650
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1651
                if (end == -1) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1652
                    //Break without warning.  This <a> tag is not necessarily malformed.  The text
06bc494ca11e Initial load
duke
parents:
diff changeset
  1653
                    //might be missing '>' character because the href has an inline tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1654
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1655
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1656
                if(textBuff.substring(begin, end).indexOf("\"") != -1){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1657
                    begin = textBuff.indexOf("\"", begin) + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1658
                    end = textBuff.indexOf("\"", begin +1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1659
                    if(begin == 0 || end == -1){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1660
                        //Link is missing a quote.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1661
                        break;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1662
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1663
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1664
                String relativeLink = textBuff.substring(begin, end);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1665
                if(!(relativeLink.toLowerCase().startsWith("mailto:") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1666
                     relativeLink.toLowerCase().startsWith("http:") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1667
                     relativeLink.toLowerCase().startsWith("https:") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
  1668
                     relativeLink.toLowerCase().startsWith("file:"))){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1669
                     relativeLink = "{@"+(new DocRootTaglet()).getName() + "}"
06bc494ca11e Initial load
duke
parents:
diff changeset
  1670
                        + redirectPathFromRoot
06bc494ca11e Initial load
duke
parents:
diff changeset
  1671
                        + relativeLink;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1672
                    textBuff.replace(begin, end, relativeLink);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1673
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1674
                begin = textBuff.toString().toLowerCase().indexOf("<a", begin + 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1675
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1676
            return textBuff.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1677
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1678
        return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1679
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1680
06bc494ca11e Initial load
duke
parents:
diff changeset
  1681
    public String removeNonInlineHtmlTags(String text) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1682
        if (text.indexOf('<') < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1683
            return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1684
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1685
        String noninlinetags[] = { "<ul>", "</ul>", "<ol>", "</ol>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1686
                "<dl>", "</dl>", "<table>", "</table>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1687
                "<tr>", "</tr>", "<td>", "</td>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1688
                "<th>", "</th>", "<p>", "</p>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1689
                "<li>", "</li>", "<dd>", "</dd>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1690
                "<dir>", "</dir>", "<dt>", "</dt>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1691
                "<h1>", "</h1>", "<h2>", "</h2>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1692
                "<h3>", "</h3>", "<h4>", "</h4>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1693
                "<h5>", "</h5>", "<h6>", "</h6>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1694
                "<pre>", "</pre>", "<menu>", "</menu>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1695
                "<listing>", "</listing>", "<hr>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1696
                "<blockquote>", "</blockquote>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1697
                "<center>", "</center>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1698
                "<UL>", "</UL>", "<OL>", "</OL>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1699
                "<DL>", "</DL>", "<TABLE>", "</TABLE>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1700
                "<TR>", "</TR>", "<TD>", "</TD>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1701
                "<TH>", "</TH>", "<P>", "</P>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1702
                "<LI>", "</LI>", "<DD>", "</DD>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1703
                "<DIR>", "</DIR>", "<DT>", "</DT>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1704
                "<H1>", "</H1>", "<H2>", "</H2>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1705
                "<H3>", "</H3>", "<H4>", "</H4>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1706
                "<H5>", "</H5>", "<H6>", "</H6>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1707
                "<PRE>", "</PRE>", "<MENU>", "</MENU>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1708
                "<LISTING>", "</LISTING>", "<HR>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1709
                "<BLOCKQUOTE>", "</BLOCKQUOTE>",
06bc494ca11e Initial load
duke
parents:
diff changeset
  1710
                "<CENTER>", "</CENTER>"
06bc494ca11e Initial load
duke
parents:
diff changeset
  1711
        };
06bc494ca11e Initial load
duke
parents:
diff changeset
  1712
        for (int i = 0; i < noninlinetags.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1713
            text = replace(text, noninlinetags[i], "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1714
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1715
        return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1716
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1717
06bc494ca11e Initial load
duke
parents:
diff changeset
  1718
    public String replace(String text, String tobe, String by) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1719
        while (true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1720
            int startindex = text.indexOf(tobe);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1721
            if (startindex < 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1722
                return text;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1723
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1724
            int endindex = startindex + tobe.length();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1725
            StringBuffer replaced = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1726
            if (startindex > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1727
                replaced.append(text.substring(0, startindex));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1728
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1729
            replaced.append(by);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1730
            if (text.length() > endindex) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1731
                replaced.append(text.substring(endindex));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1732
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1733
            text = replaced.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1734
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1735
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1736
06bc494ca11e Initial load
duke
parents:
diff changeset
  1737
    public void printStyleSheetProperties() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1738
        String filename = configuration.stylesheetfile;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1739
        if (filename.length() > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1740
            File stylefile = new File(filename);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1741
            String parent = stylefile.getParent();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1742
            filename = (parent == null)?
06bc494ca11e Initial load
duke
parents:
diff changeset
  1743
                filename:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1744
                filename.substring(parent.length() + 1);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1745
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1746
            filename = "stylesheet.css";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1747
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1748
        filename = relativePath + filename;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1749
        link("REL =\"stylesheet\" TYPE=\"text/css\" HREF=\"" +
06bc494ca11e Initial load
duke
parents:
diff changeset
  1750
                 filename + "\" " + "TITLE=\"Style\"");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1751
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1752
06bc494ca11e Initial load
duke
parents:
diff changeset
  1753
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1754
     * According to the Java Language Specifications, all the outer classes
06bc494ca11e Initial load
duke
parents:
diff changeset
  1755
     * and static nested classes are core classes.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1756
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1757
    public boolean isCoreClass(ClassDoc cd) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1758
        return cd.containingClass() == null || cd.isStatic();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1759
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1760
06bc494ca11e Initial load
duke
parents:
diff changeset
  1761
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1762
     * Write the annotatation types for the given packageDoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1763
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1764
     * @param packageDoc the package to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1765
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1766
    public void writeAnnotationInfo(PackageDoc packageDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1767
        writeAnnotationInfo(packageDoc, packageDoc.annotations());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1768
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1769
06bc494ca11e Initial load
duke
parents:
diff changeset
  1770
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1771
     * Write the annotatation types for the given doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1772
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1773
     * @param doc the doc to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1774
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1775
    public void writeAnnotationInfo(ProgramElementDoc doc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1776
        writeAnnotationInfo(doc, doc.annotations());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1777
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1778
06bc494ca11e Initial load
duke
parents:
diff changeset
  1779
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1780
     * Write the annotatation types for the given doc and parameter.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1781
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1782
     * @param indent the number of spaced to indent the parameters.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1783
     * @param doc the doc to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1784
     * @param param the parameter to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1785
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1786
    public boolean writeAnnotationInfo(int indent, Doc doc, Parameter param) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1787
        return writeAnnotationInfo(indent, doc, param.annotations(), false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1788
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1789
06bc494ca11e Initial load
duke
parents:
diff changeset
  1790
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1791
     * Write the annotatation types for the given doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1792
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1793
     * @param doc the doc to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1794
     * @param descList the array of {@link AnnotationDesc}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1795
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1796
    private void writeAnnotationInfo(Doc doc, AnnotationDesc[] descList) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1797
        writeAnnotationInfo(0, doc, descList, true);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1798
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1799
06bc494ca11e Initial load
duke
parents:
diff changeset
  1800
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1801
     * Write the annotatation types for the given doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1802
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1803
     * @param indent the number of extra spaces to indent the annotations.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1804
     * @param doc the doc to write annotations for.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1805
     * @param descList the array of {@link AnnotationDesc}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1806
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1807
    private boolean writeAnnotationInfo(int indent, Doc doc, AnnotationDesc[] descList, boolean lineBreak) {
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  1808
        List<String> annotations = getAnnotations(indent, descList, lineBreak);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1809
        if (annotations.size() == 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1810
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1811
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1812
        fontNoNewLine("-1");
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  1813
        for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) {
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  1814
            print(iter.next());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1815
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1816
        fontEnd();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1817
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1818
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1819
06bc494ca11e Initial load
duke
parents:
diff changeset
  1820
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1821
     * Return the string representations of the annotation types for
06bc494ca11e Initial load
duke
parents:
diff changeset
  1822
     * the given doc.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1823
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1824
     * @param indent the number of extra spaces to indent the annotations.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1825
     * @param descList the array of {@link AnnotationDesc}.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1826
     * @param linkBreak if true, add new line between each member value.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1827
     * @return an array of strings representing the annotations being
06bc494ca11e Initial load
duke
parents:
diff changeset
  1828
     *         documented.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1829
     */
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  1830
    private List<String> getAnnotations(int indent, AnnotationDesc[] descList, boolean linkBreak) {
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  1831
        List<String> results = new ArrayList<String>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1832
        StringBuffer annotation;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1833
        for (int i = 0; i < descList.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1834
            AnnotationTypeDoc annotationDoc = descList[i].annotationType();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1835
            if (! Util.isDocumentedAnnotation(annotationDoc)){
06bc494ca11e Initial load
duke
parents:
diff changeset
  1836
                continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1837
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1838
            annotation = new StringBuffer();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1839
            LinkInfoImpl linkInfo = new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
  1840
                LinkInfoImpl.CONTEXT_ANNOTATION, annotationDoc);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1841
            linkInfo.label = "@" + annotationDoc.name();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1842
            annotation.append(getLink(linkInfo));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1843
            AnnotationDesc.ElementValuePair[] pairs = descList[i].elementValues();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1844
            if (pairs.length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1845
                annotation.append('(');
06bc494ca11e Initial load
duke
parents:
diff changeset
  1846
                for (int j = 0; j < pairs.length; j++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1847
                    if (j > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1848
                        annotation.append(",");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1849
                        if (linkBreak) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1850
                            annotation.append(DocletConstants.NL);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1851
                            int spaces = annotationDoc.name().length() + 2;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1852
                            for (int k = 0; k < (spaces + indent); k++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1853
                                annotation.append(' ');
06bc494ca11e Initial load
duke
parents:
diff changeset
  1854
                            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1855
                        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1856
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1857
                    annotation.append(getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1858
                        pairs[j].element(), pairs[j].element().name(), false));
06bc494ca11e Initial load
duke
parents:
diff changeset
  1859
                    annotation.append('=');
06bc494ca11e Initial load
duke
parents:
diff changeset
  1860
                    AnnotationValue annotationValue = pairs[j].value();
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
  1861
                    List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1862
                    if (annotationValue.value() instanceof AnnotationValue[]) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1863
                        AnnotationValue[] annotationArray =
06bc494ca11e Initial load
duke
parents:
diff changeset
  1864
                            (AnnotationValue[]) annotationValue.value();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1865
                        for (int k = 0; k < annotationArray.length; k++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1866
                            annotationTypeValues.add(annotationArray[k]);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1867
                        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1868
                    } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1869
                        annotationTypeValues.add(annotationValue);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1870
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1871
                    annotation.append(annotationTypeValues.size() == 1 ? "" : "{");
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  1872
                    for (Iterator<AnnotationValue> iter = annotationTypeValues.iterator(); iter.hasNext(); ) {
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  1873
                        annotation.append(annotationValueToString(iter.next()));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1874
                        annotation.append(iter.hasNext() ? "," : "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1875
                    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1876
                    annotation.append(annotationTypeValues.size() == 1 ? "" : "}");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1877
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1878
                annotation.append(")");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1879
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1880
            annotation.append(linkBreak ? DocletConstants.NL : "");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1881
            results.add(annotation.toString());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1882
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1883
        return results;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1884
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1885
06bc494ca11e Initial load
duke
parents:
diff changeset
  1886
    private String annotationValueToString(AnnotationValue annotationValue) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1887
        if (annotationValue.value() instanceof Type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1888
            Type type = (Type) annotationValue.value();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1889
            if (type.asClassDoc() != null) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1890
                LinkInfoImpl linkInfo = new LinkInfoImpl(
06bc494ca11e Initial load
duke
parents:
diff changeset
  1891
                    LinkInfoImpl.CONTEXT_ANNOTATION, type);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1892
                    linkInfo.label = (type.asClassDoc().isIncluded() ?
06bc494ca11e Initial load
duke
parents:
diff changeset
  1893
                        type.typeName() :
06bc494ca11e Initial load
duke
parents:
diff changeset
  1894
                        type.qualifiedTypeName()) + type.dimension() + ".class";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1895
                return getLink(linkInfo);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1896
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1897
                return type.typeName() + type.dimension() + ".class";
06bc494ca11e Initial load
duke
parents:
diff changeset
  1898
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1899
        } else if (annotationValue.value() instanceof AnnotationDesc) {
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  1900
            List<String> list = getAnnotations(0,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1901
                new AnnotationDesc[]{(AnnotationDesc) annotationValue.value()},
06bc494ca11e Initial load
duke
parents:
diff changeset
  1902
                    false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1903
            StringBuffer buf = new StringBuffer();
1789
7ac8c0815000 6765045: Remove rawtypes warnings from langtools
mcimadamore
parents: 1787
diff changeset
  1904
            for (Iterator<String> iter = list.iterator(); iter.hasNext(); ) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1905
                buf.append(iter.next());
06bc494ca11e Initial load
duke
parents:
diff changeset
  1906
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1907
            return buf.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1908
        } else if (annotationValue.value() instanceof MemberDoc) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1909
            return getDocLink(LinkInfoImpl.CONTEXT_ANNOTATION,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1910
                (MemberDoc) annotationValue.value(),
06bc494ca11e Initial load
duke
parents:
diff changeset
  1911
                ((MemberDoc) annotationValue.value()).name(), false);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1912
         } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1913
            return annotationValue.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
  1914
         }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1915
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1916
06bc494ca11e Initial load
duke
parents:
diff changeset
  1917
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1918
     * Return the configuation for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1919
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
  1920
     * @return the configuration for this doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1921
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1922
    public Configuration configuration() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1923
        return configuration;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1924
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1925
}