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